| Index: src/x87/builtins-x87.cc
|
| diff --git a/src/x87/builtins-x87.cc b/src/x87/builtins-x87.cc
|
| index 5a17736b89962970907b132ab91bbd225db05513..0f93537ebdf92563bdb4d385bf325e6c260d0fe0 100644
|
| --- a/src/x87/builtins-x87.cc
|
| +++ b/src/x87/builtins-x87.cc
|
| @@ -1579,14 +1579,14 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
|
| __ mov(ebx, Operand(esp, ecx, times_pointer_size, 0));
|
|
|
| // Load the double value of the parameter into stx_1, 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(ebx, &convert_smi);
|
| __ JumpIfRoot(FieldOperand(ebx, HeapObject::kMapOffset),
|
| 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(eax);
|
| __ SmiTag(ecx);
|
| @@ -1594,8 +1594,7 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
|
| __ Push(ecx);
|
| __ Push(edx);
|
| __ mov(eax, ebx);
|
| - ToNumberStub stub(masm->isolate());
|
| - __ CallStub(&stub);
|
| + __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET);
|
| __ mov(ebx, eax);
|
| __ Pop(edx);
|
| __ Pop(ecx);
|
| @@ -1706,8 +1705,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 (already in eax).
|
| __ bind(&no_arguments);
|
| @@ -1757,8 +1755,7 @@ void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) {
|
| __ Push(edi);
|
| __ Push(edx);
|
| __ Move(eax, ebx);
|
| - ToNumberStub stub(masm->isolate());
|
| - __ CallStub(&stub);
|
| + __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET);
|
| __ Move(ebx, eax);
|
| __ Pop(edx);
|
| __ Pop(edi);
|
| @@ -2678,6 +2675,51 @@ void Builtins::Generate_StringToNumber(MacroAssembler* masm) {
|
| __ TailCallRuntime(Runtime::kStringToNumber);
|
| }
|
|
|
| +// static
|
| +void Builtins::Generate_ToNumber(MacroAssembler* masm) {
|
| + // The ToNumber stub takes one argument in eax.
|
| + Label not_smi;
|
| + __ JumpIfNotSmi(eax, ¬_smi, Label::kNear);
|
| + __ Ret();
|
| + __ bind(¬_smi);
|
| +
|
| + Label not_heap_number;
|
| + __ CompareMap(eax, masm->isolate()->factory()->heap_number_map());
|
| + __ j(not_equal, ¬_heap_number, Label::kNear);
|
| + __ 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 eax.
|
| + __ AssertNotNumber(eax);
|
| +
|
| + Label not_string;
|
| + __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi);
|
| + // eax: object
|
| + // edi: object map
|
| + __ j(above_equal, ¬_string, Label::kNear);
|
| + __ Jump(masm->isolate()->builtins()->StringToNumber(),
|
| + RelocInfo::CODE_TARGET);
|
| + __ bind(¬_string);
|
| +
|
| + Label not_oddball;
|
| + __ CmpInstanceType(edi, ODDBALL_TYPE);
|
| + __ j(not_equal, ¬_oddball, Label::kNear);
|
| + __ mov(eax, FieldOperand(eax, Oddball::kToNumberOffset));
|
| + __ Ret();
|
| + __ bind(¬_oddball);
|
| +
|
| + __ pop(ecx); // Pop return address.
|
| + __ push(eax); // Push argument.
|
| + __ push(ecx); // Push return address.
|
| + __ TailCallRuntime(Runtime::kToNumber);
|
| +}
|
| +
|
| void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
|
| // ----------- S t a t e -------------
|
| // -- eax : actual number of arguments
|
|
|