OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 2674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2685 // Check if string has a cached array index. | 2685 // Check if string has a cached array index. |
2686 Label runtime; | 2686 Label runtime; |
2687 __ test(FieldOperand(eax, String::kHashFieldOffset), | 2687 __ test(FieldOperand(eax, String::kHashFieldOffset), |
2688 Immediate(String::kContainsCachedArrayIndexMask)); | 2688 Immediate(String::kContainsCachedArrayIndexMask)); |
2689 __ j(not_zero, &runtime, Label::kNear); | 2689 __ j(not_zero, &runtime, Label::kNear); |
2690 __ mov(eax, FieldOperand(eax, String::kHashFieldOffset)); | 2690 __ mov(eax, FieldOperand(eax, String::kHashFieldOffset)); |
2691 __ IndexFromHash(eax, eax); | 2691 __ IndexFromHash(eax, eax); |
2692 __ Ret(); | 2692 __ Ret(); |
2693 | 2693 |
2694 __ bind(&runtime); | 2694 __ bind(&runtime); |
2695 __ PopReturnAddressTo(ecx); // Pop return address. | 2695 { |
2696 __ Push(eax); // Push argument. | 2696 FrameScope frame(masm, StackFrame::INTERNAL); |
2697 __ PushReturnAddressFrom(ecx); // Push return address. | 2697 // Push argument. |
2698 __ TailCallRuntime(Runtime::kStringToNumber); | 2698 __ push(eax); |
| 2699 // We cannot use a tail call here because this builtin can also be called |
| 2700 // from wasm. |
| 2701 __ CallRuntime(Runtime::kStringToNumber); |
| 2702 } |
| 2703 __ Ret(); |
2699 } | 2704 } |
2700 | 2705 |
2701 // static | 2706 // static |
2702 void Builtins::Generate_ToNumber(MacroAssembler* masm) { | 2707 void Builtins::Generate_ToNumber(MacroAssembler* masm) { |
2703 // The ToNumber stub takes one argument in eax. | 2708 // The ToNumber stub takes one argument in eax. |
2704 Label not_smi; | 2709 Label not_smi; |
2705 __ JumpIfNotSmi(eax, ¬_smi, Label::kNear); | 2710 __ JumpIfNotSmi(eax, ¬_smi, Label::kNear); |
2706 __ Ret(); | 2711 __ Ret(); |
2707 __ bind(¬_smi); | 2712 __ bind(¬_smi); |
2708 | 2713 |
(...skipping 20 matching lines...) Expand all Loading... |
2729 __ Jump(masm->isolate()->builtins()->StringToNumber(), | 2734 __ Jump(masm->isolate()->builtins()->StringToNumber(), |
2730 RelocInfo::CODE_TARGET); | 2735 RelocInfo::CODE_TARGET); |
2731 __ bind(¬_string); | 2736 __ bind(¬_string); |
2732 | 2737 |
2733 Label not_oddball; | 2738 Label not_oddball; |
2734 __ CmpInstanceType(edi, ODDBALL_TYPE); | 2739 __ CmpInstanceType(edi, ODDBALL_TYPE); |
2735 __ j(not_equal, ¬_oddball, Label::kNear); | 2740 __ j(not_equal, ¬_oddball, Label::kNear); |
2736 __ mov(eax, FieldOperand(eax, Oddball::kToNumberOffset)); | 2741 __ mov(eax, FieldOperand(eax, Oddball::kToNumberOffset)); |
2737 __ Ret(); | 2742 __ Ret(); |
2738 __ bind(¬_oddball); | 2743 __ bind(¬_oddball); |
2739 | 2744 { |
2740 __ pop(ecx); // Pop return address. | 2745 FrameScope frame(masm, StackFrame::INTERNAL); |
2741 __ push(eax); // Push argument. | 2746 // Push argument. |
2742 __ push(ecx); // Push return address. | 2747 __ push(eax); |
2743 __ TailCallRuntime(Runtime::kToNumber); | 2748 // We cannot use a tail call here because this builtin can also be called |
| 2749 // from wasm. |
| 2750 __ CallRuntime(Runtime::kToNumber); |
| 2751 } |
| 2752 __ Ret(); |
2744 } | 2753 } |
2745 | 2754 |
2746 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2755 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
2747 // ----------- S t a t e ------------- | 2756 // ----------- S t a t e ------------- |
2748 // -- eax : actual number of arguments | 2757 // -- eax : actual number of arguments |
2749 // -- ebx : expected number of arguments | 2758 // -- ebx : expected number of arguments |
2750 // -- edx : new target (passed through to callee) | 2759 // -- edx : new target (passed through to callee) |
2751 // -- edi : function (passed through to callee) | 2760 // -- edi : function (passed through to callee) |
2752 // ----------------------------------- | 2761 // ----------------------------------- |
2753 | 2762 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2995 // And "return" to the OSR entry point of the function. | 3004 // And "return" to the OSR entry point of the function. |
2996 __ ret(0); | 3005 __ ret(0); |
2997 } | 3006 } |
2998 | 3007 |
2999 | 3008 |
3000 #undef __ | 3009 #undef __ |
3001 } // namespace internal | 3010 } // namespace internal |
3002 } // namespace v8 | 3011 } // namespace v8 |
3003 | 3012 |
3004 #endif // V8_TARGET_ARCH_X87 | 3013 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |