Index: src/s390/builtins-s390.cc |
diff --git a/src/s390/builtins-s390.cc b/src/s390/builtins-s390.cc |
index ad491b7b68e27c5654d1a5327f3950a4b2133b14..625fa9292e8ff480e6c546715adf0c5ada0935e3 100644 |
--- a/src/s390/builtins-s390.cc |
+++ b/src/s390/builtins-s390.cc |
@@ -166,19 +166,18 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
__ LoadP(r2, MemOperand(r4)); |
// 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, convert_smi, convert_number, done_convert; |
__ bind(&convert); |
__ JumpIfSmi(r2, &convert_smi); |
__ LoadP(r6, FieldMemOperand(r2, HeapObject::kMapOffset)); |
__ JumpIfRoot(r6, 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. |
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
__ SmiTag(r5); |
__ Push(r3, r4, r5); |
- ToNumberStub stub(masm->isolate()); |
- __ CallStub(&stub); |
+ __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET); |
__ Pop(r3, r4, r5); |
__ SmiUntag(r5); |
{ |
@@ -254,8 +253,7 @@ void Builtins::Generate_NumberConstructor(MacroAssembler* masm) { |
} |
// 2a. Convert the first argument to a number. |
- ToNumberStub stub(masm->isolate()); |
- __ TailCallStub(&stub); |
+ __ Jump(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET); |
// 2b. No arguments, return +0. |
__ bind(&no_arguments); |
@@ -305,8 +303,7 @@ void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) { |
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
__ Push(r3, r5); |
__ LoadRR(r2, r4); |
- ToNumberStub stub(masm->isolate()); |
- __ CallStub(&stub); |
+ __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET); |
__ LoadRR(r4, r2); |
__ Pop(r3, r5); |
} |
@@ -2735,6 +2732,44 @@ void Builtins::Generate_StringToNumber(MacroAssembler* masm) { |
__ TailCallRuntime(Runtime::kStringToNumber); |
} |
+// static |
+void Builtins::Generate_ToNumber(MacroAssembler* masm) { |
+ // The ToNumber stub takes one argument in r2. |
+ STATIC_ASSERT(kSmiTag == 0); |
+ __ TestIfSmi(r2); |
+ __ Ret(eq); |
+ |
+ __ CompareObjectType(r2, r3, r3, HEAP_NUMBER_TYPE); |
+ // r2: receiver |
+ // r3: receiver instance type |
+ __ Ret(eq); |
+ |
+ __ Jump(masm->isolate()->builtins()->NonNumberToNumber(), |
+ RelocInfo::CODE_TARGET); |
+} |
+ |
+// static |
+void Builtins::Generate_NonNumberToNumber(MacroAssembler* masm) { |
+ // The NonNumberToNumber stub takes one argument in r2. |
+ __ AssertNotNumber(r2); |
+ |
+ __ CompareObjectType(r2, r3, r3, FIRST_NONSTRING_TYPE); |
+ // r2: receiver |
+ // r3: receiver instance type |
+ __ Jump(masm->isolate()->builtins()->StringToNumber(), RelocInfo::CODE_TARGET, |
+ lt); |
+ |
+ Label not_oddball; |
+ __ CmpP(r3, Operand(ODDBALL_TYPE)); |
+ __ bne(¬_oddball); |
+ __ LoadP(r2, FieldMemOperand(r2, Oddball::kToNumberOffset)); |
+ __ Ret(); |
+ __ bind(¬_oddball); |
+ |
+ __ push(r2); // Push argument. |
+ __ TailCallRuntime(Runtime::kToNumber); |
+} |
+ |
void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
// -- r2 : actual number of arguments |