Commit 6b5cd36f authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[csa] Move NumberIsNaN to Torque

This CL implements NumberIsNaN in Torque and removes it from the
CodeStubAssembler. It is currently used in TypedArray.p.sort and
Array.p.sort.

R=jgruber@chromium.org

Change-Id: Iaaa81901f89c0df68997d4501607b302a0449012
Reviewed-on: https://chromium-review.googlesource.com/1092532
Commit-Queue: Simon Zünd <szuend@google.com>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53611}
parent d5d116af
......@@ -200,6 +200,7 @@ extern operator '<=' macro IntPtrLessThanOrEqual(intptr, intptr): bool;
extern operator '>=' macro IntPtrGreaterThanOrEqual(intptr, intptr): bool;
extern operator '==' macro Float64Equal(float64, float64): bool;
extern operator '!=' macro Float64NotEqual(float64, float64): bool;
extern operator
'<' macro BranchIfNumberLessThan(Number, Number): never labels Taken, NotTaken;
......@@ -449,5 +450,12 @@ extern macro IsCallable(HeapObject): bool;
extern macro IsJSArray(HeapObject): bool;
extern macro TaggedIsCallable(Object): bool;
extern macro IsDetachedBuffer(JSArrayBuffer): bool;
extern macro IsHeapNumber(HeapObject): bool;
extern macro NumberIsNaN(Number): bool;
// Return true iff number is NaN.
macro NumberIsNaN(number: Number): bool {
if (TaggedIsSmi(number)) return false;
let value: float64 = convert<float64>(unsafe_cast<HeapNumber>(number));
return value != value;
}
......@@ -11937,26 +11937,5 @@ void CodeStubAssembler::InitializeFunctionContext(Node* native_context,
native_context);
}
TNode<BoolT> CodeStubAssembler::NumberIsNaN(TNode<Number> value) {
Label is_heapnumber(this), done(this);
TVARIABLE(BoolT, result);
GotoIf(TaggedIsNotSmi(value), &is_heapnumber);
result = Int32FalseConstant();
Goto(&done);
BIND(&is_heapnumber);
{
CSA_ASSERT(this, IsHeapNumber(CAST(value)));
TNode<Float64T> value_f = LoadHeapNumberValue(CAST(value));
result = Float64NotEqual(value_f, value_f);
Goto(&done);
}
BIND(&done);
return result.value();
}
} // namespace internal
} // namespace v8
......@@ -290,10 +290,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
return CAST(result);
}
// Returns true iff number is NaN.
// TOOD(szuend): Remove when UncheckedCasts are supported in Torque.
TNode<BoolT> NumberIsNaN(TNode<Number> number);
Node* MatchesParameterMode(Node* value, ParameterMode mode);
#define PARAMETER_BINOP(OpName, IntPtrOpName, SmiOpName) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment