Index: src/arm64/builtins-arm64.cc |
diff --git a/src/arm64/builtins-arm64.cc b/src/arm64/builtins-arm64.cc |
index 913b610e37bd4a97028f756b8cfdbf582bafc44e..38513fe072f939685e145562373911735f9a0453 100644 |
--- a/src/arm64/builtins-arm64.cc |
+++ b/src/arm64/builtins-arm64.cc |
@@ -170,19 +170,18 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
__ Peek(x2, Operand(x0, LSL, kPointerSizeLog2)); |
// Load the double value of the parameter into d2, maybe converting the |
- // parameter to a number first using the ToNumberStub if necessary. |
+ // parameter to a number first using the ToNumber builtin if necessary. |
Label convert_smi, convert_number, done_convert; |
__ JumpIfSmi(x2, &convert_smi); |
__ JumpIfHeapNumber(x2, &convert_number); |
{ |
- // Parameter is not a Number, use the ToNumberStub to convert it. |
+ // Parameter is not a Number, use the ToNumber builtin to convert it. |
FrameScope scope(masm, StackFrame::INTERNAL); |
__ SmiTag(x0); |
__ SmiTag(x4); |
__ Push(x0, x1, x4); |
__ Mov(x0, x2); |
- ToNumberStub stub(masm->isolate()); |
- __ CallStub(&stub); |
+ __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET); |
__ Mov(x2, x0); |
__ Pop(x4, x1, x0); |
{ |
@@ -250,8 +249,7 @@ void Builtins::Generate_NumberConstructor(MacroAssembler* masm) { |
} |
// 2a. Convert first argument to number. |
- ToNumberStub stub(masm->isolate()); |
- __ TailCallStub(&stub); |
+ __ Jump(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET); |
// 2b. No arguments, return +0 (already in x0). |
__ Bind(&no_arguments); |
@@ -299,8 +297,7 @@ void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) { |
FrameScope scope(masm, StackFrame::INTERNAL); |
__ Push(x1, x3); |
__ Move(x0, x2); |
- ToNumberStub stub(masm->isolate()); |
- __ CallStub(&stub); |
+ __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET); |
__ Move(x2, x0); |
__ Pop(x3, x1); |
} |
@@ -2782,6 +2779,7 @@ void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { |
__ TailCallRuntime(Runtime::kAllocateInTargetSpace); |
} |
+// static |
void Builtins::Generate_StringToNumber(MacroAssembler* masm) { |
// The StringToNumber stub takes one argument in x0. |
__ AssertString(x0); |
@@ -2799,6 +2797,51 @@ void Builtins::Generate_StringToNumber(MacroAssembler* masm) { |
__ TailCallRuntime(Runtime::kStringToNumber); |
} |
+// static |
+void Builtins::Generate_ToNumber(MacroAssembler* masm) { |
+ // The ToNumber stub takes one argument in x0. |
+ Label not_smi; |
+ __ JumpIfNotSmi(x0, ¬_smi); |
+ __ Ret(); |
+ __ Bind(¬_smi); |
+ |
+ Label not_heap_number; |
+ __ CompareObjectType(x0, x1, x1, HEAP_NUMBER_TYPE); |
+ // x0: receiver |
+ // x1: receiver instance type |
+ __ B(ne, ¬_heap_number); |
+ __ Ret(); |
+ __ Bind(¬_heap_number); |
+ |
+ __ Jump(masm->isolate()->builtins()->NonNumberToNumber(), |
+ RelocInfo::CODE_TARGET); |
+} |
+ |
+// static |
+void Builtins::Generate_NonNumberToNumber(MacroAssembler* masm) { |
+ // The NonNumberToNumber stub takes one argument in x0. |
+ __ AssertNotNumber(x0); |
+ |
+ Label not_string; |
+ __ CompareObjectType(x0, x1, x1, FIRST_NONSTRING_TYPE); |
+ // x0: receiver |
+ // x1: receiver instance type |
+ __ B(hs, ¬_string); |
+ __ Jump(masm->isolate()->builtins()->StringToNumber(), |
+ RelocInfo::CODE_TARGET); |
+ __ Bind(¬_string); |
+ |
+ Label not_oddball; |
+ __ Cmp(x1, ODDBALL_TYPE); |
+ __ B(ne, ¬_oddball); |
+ __ Ldr(x0, FieldMemOperand(x0, Oddball::kToNumberOffset)); |
+ __ Ret(); |
+ __ Bind(¬_oddball); |
+ |
+ __ Push(x0); // Push argument. |
+ __ TailCallRuntime(Runtime::kToNumber); |
+} |
+ |
void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
ASM_LOCATION("Builtins::Generate_ArgumentsAdaptorTrampoline"); |
// ----------- S t a t e ------------- |