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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 2648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2659 // Check if string has a cached array index. | 2659 // Check if string has a cached array index. |
2660 Label runtime; | 2660 Label runtime; |
2661 __ test(FieldOperand(eax, String::kHashFieldOffset), | 2661 __ test(FieldOperand(eax, String::kHashFieldOffset), |
2662 Immediate(String::kContainsCachedArrayIndexMask)); | 2662 Immediate(String::kContainsCachedArrayIndexMask)); |
2663 __ j(not_zero, &runtime, Label::kNear); | 2663 __ j(not_zero, &runtime, Label::kNear); |
2664 __ mov(eax, FieldOperand(eax, String::kHashFieldOffset)); | 2664 __ mov(eax, FieldOperand(eax, String::kHashFieldOffset)); |
2665 __ IndexFromHash(eax, eax); | 2665 __ IndexFromHash(eax, eax); |
2666 __ Ret(); | 2666 __ Ret(); |
2667 | 2667 |
2668 __ bind(&runtime); | 2668 __ bind(&runtime); |
2669 __ PopReturnAddressTo(ecx); // Pop return address. | 2669 { |
2670 __ Push(eax); // Push argument. | 2670 FrameScope frame(masm, StackFrame::INTERNAL); |
2671 __ PushReturnAddressFrom(ecx); // Push return address. | 2671 // Push argument. |
2672 __ TailCallRuntime(Runtime::kStringToNumber); | 2672 __ push(eax); |
| 2673 // We cannot use a tail call here because this builtin can also be called |
| 2674 // from wasm. |
| 2675 __ CallRuntime(Runtime::kStringToNumber); |
| 2676 } |
| 2677 __ Ret(); |
2673 } | 2678 } |
2674 | 2679 |
2675 // static | 2680 // static |
2676 void Builtins::Generate_ToNumber(MacroAssembler* masm) { | 2681 void Builtins::Generate_ToNumber(MacroAssembler* masm) { |
2677 // The ToNumber stub takes one argument in eax. | 2682 // The ToNumber stub takes one argument in eax. |
2678 Label not_smi; | 2683 Label not_smi; |
2679 __ JumpIfNotSmi(eax, ¬_smi, Label::kNear); | 2684 __ JumpIfNotSmi(eax, ¬_smi, Label::kNear); |
2680 __ Ret(); | 2685 __ Ret(); |
2681 __ bind(¬_smi); | 2686 __ bind(¬_smi); |
2682 | 2687 |
(...skipping 20 matching lines...) Expand all Loading... |
2703 __ Jump(masm->isolate()->builtins()->StringToNumber(), | 2708 __ Jump(masm->isolate()->builtins()->StringToNumber(), |
2704 RelocInfo::CODE_TARGET); | 2709 RelocInfo::CODE_TARGET); |
2705 __ bind(¬_string); | 2710 __ bind(¬_string); |
2706 | 2711 |
2707 Label not_oddball; | 2712 Label not_oddball; |
2708 __ CmpInstanceType(edi, ODDBALL_TYPE); | 2713 __ CmpInstanceType(edi, ODDBALL_TYPE); |
2709 __ j(not_equal, ¬_oddball, Label::kNear); | 2714 __ j(not_equal, ¬_oddball, Label::kNear); |
2710 __ mov(eax, FieldOperand(eax, Oddball::kToNumberOffset)); | 2715 __ mov(eax, FieldOperand(eax, Oddball::kToNumberOffset)); |
2711 __ Ret(); | 2716 __ Ret(); |
2712 __ bind(¬_oddball); | 2717 __ bind(¬_oddball); |
2713 | 2718 { |
2714 __ pop(ecx); // Pop return address. | 2719 FrameScope frame(masm, StackFrame::INTERNAL); |
2715 __ push(eax); // Push argument. | 2720 // Push argument. |
2716 __ push(ecx); // Push return address. | 2721 __ push(eax); |
2717 __ TailCallRuntime(Runtime::kToNumber); | 2722 // We cannot use a tail call here because this builtin can also be called |
| 2723 // from wasm. |
| 2724 __ CallRuntime(Runtime::kToNumber); |
| 2725 } |
| 2726 __ Ret(); |
2718 } | 2727 } |
2719 | 2728 |
2720 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2729 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
2721 // ----------- S t a t e ------------- | 2730 // ----------- S t a t e ------------- |
2722 // -- eax : actual number of arguments | 2731 // -- eax : actual number of arguments |
2723 // -- ebx : expected number of arguments | 2732 // -- ebx : expected number of arguments |
2724 // -- edx : new target (passed through to callee) | 2733 // -- edx : new target (passed through to callee) |
2725 // -- edi : function (passed through to callee) | 2734 // -- edi : function (passed through to callee) |
2726 // ----------------------------------- | 2735 // ----------------------------------- |
2727 | 2736 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2968 // And "return" to the OSR entry point of the function. | 2977 // And "return" to the OSR entry point of the function. |
2969 __ ret(0); | 2978 __ ret(0); |
2970 } | 2979 } |
2971 | 2980 |
2972 | 2981 |
2973 #undef __ | 2982 #undef __ |
2974 } // namespace internal | 2983 } // namespace internal |
2975 } // namespace v8 | 2984 } // namespace v8 |
2976 | 2985 |
2977 #endif // V8_TARGET_ARCH_IA32 | 2986 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |