Index: src/mips/builtins-mips.cc |
diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc |
index bd4455892eaf20f5e3cf7037c2fd45f1ee8b88bf..7aa7013c0db771aae9c8236a19621d03cb98240e 100644 |
--- a/src/mips/builtins-mips.cc |
+++ b/src/mips/builtins-mips.cc |
@@ -171,21 +171,20 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
__ lw(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); |
__ lw(t0, FieldMemOperand(a2, HeapObject::kMapOffset)); |
__ JumpIfRoot(t0, 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); |
{ |
@@ -265,8 +264,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); |
@@ -314,8 +312,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); |
} |
@@ -2783,6 +2780,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); |
+ __ lw(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 ------------- |