Index: src/mips64/builtins-mips64.cc |
diff --git a/src/mips64/builtins-mips64.cc b/src/mips64/builtins-mips64.cc |
index 3c31bf10a5ee71e062a6e6584abbe3ca4d71f658..008b7c25bbfed8481c9f5a9c6338a1c0291a3980 100644 |
--- a/src/mips64/builtins-mips64.cc |
+++ b/src/mips64/builtins-mips64.cc |
@@ -170,21 +170,20 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
__ ld(a2, MemOperand(at)); |
// Load the double value of the parameter into f2, 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, convert_smi, convert_number, done_convert; |
__ bind(&convert); |
__ JumpIfSmi(a2, &convert_smi); |
__ ld(a4, FieldMemOperand(a2, HeapObject::kMapOffset)); |
__ JumpIfRoot(a4, Heap::kHeapNumberMapRootIndex, &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(a0); |
__ SmiTag(a3); |
__ Push(a0, a1, a3); |
__ mov(a0, a2); |
- ToNumberStub stub(masm->isolate()); |
- __ CallStub(&stub); |
+ __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET); |
__ mov(a2, v0); |
__ Pop(a0, a1, a3); |
{ |
@@ -261,8 +260,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. |
__ bind(&no_arguments); |
@@ -309,8 +307,7 @@ void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) { |
{ |
FrameScope scope(masm, StackFrame::INTERNAL); |
__ Push(a1, a3); |
- ToNumberStub stub(masm->isolate()); |
- __ CallStub(&stub); |
+ __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET); |
__ Move(a0, v0); |
__ Pop(a1, a3); |
} |
@@ -2769,6 +2766,52 @@ void Builtins::Generate_StringToNumber(MacroAssembler* masm) { |
__ TailCallRuntime(Runtime::kStringToNumber); |
} |
+// static |
+void Builtins::Generate_ToNumber(MacroAssembler* masm) { |
+ // The ToNumber stub takes one argument in a0. |
+ Label not_smi; |
+ __ JumpIfNotSmi(a0, ¬_smi); |
+ __ Ret(USE_DELAY_SLOT); |
+ __ mov(v0, a0); |
+ __ bind(¬_smi); |
+ |
+ Label not_heap_number; |
+ __ GetObjectType(a0, a1, a1); |
+ // a0: receiver |
+ // a1: receiver instance type |
+ __ Branch(¬_heap_number, ne, a1, Operand(HEAP_NUMBER_TYPE)); |
+ __ Ret(USE_DELAY_SLOT); |
+ __ mov(v0, a0); |
+ __ bind(¬_heap_number); |
+ |
+ __ Jump(masm->isolate()->builtins()->NonNumberToNumber(), |
+ RelocInfo::CODE_TARGET); |
+} |
+ |
+// static |
+void Builtins::Generate_NonNumberToNumber(MacroAssembler* masm) { |
+ // The NonNumberToNumber stub takes on argument in a0. |
+ __ AssertNotNumber(a0); |
+ |
+ Label not_string; |
+ __ GetObjectType(a0, a1, a1); |
+ // a0: receiver |
+ // a1: receiver instance type |
+ __ Branch(¬_string, hs, a1, Operand(FIRST_NONSTRING_TYPE)); |
+ __ Jump(masm->isolate()->builtins()->StringToNumber(), |
+ RelocInfo::CODE_TARGET); |
+ __ bind(¬_string); |
+ |
+ Label not_oddball; |
+ __ Branch(¬_oddball, ne, a1, Operand(ODDBALL_TYPE)); |
+ __ Ret(USE_DELAY_SLOT); |
+ __ ld(v0, FieldMemOperand(a0, Oddball::kToNumberOffset)); // In delay slot. |
+ __ bind(¬_oddball); |
+ |
+ __ Push(a0); // Push argument. |
+ __ TailCallRuntime(Runtime::kToNumber); |
+} |
+ |
void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
// State setup as expected by MacroAssembler::InvokePrologue. |
// ----------- S t a t e ------------- |