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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.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 2758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2769 | 2769 |
2770 // Check if string has a cached array index. | 2770 // Check if string has a cached array index. |
2771 Label runtime; | 2771 Label runtime; |
2772 __ lw(a2, FieldMemOperand(a0, String::kHashFieldOffset)); | 2772 __ lw(a2, FieldMemOperand(a0, String::kHashFieldOffset)); |
2773 __ And(at, a2, Operand(String::kContainsCachedArrayIndexMask)); | 2773 __ And(at, a2, Operand(String::kContainsCachedArrayIndexMask)); |
2774 __ Branch(&runtime, ne, at, Operand(zero_reg)); | 2774 __ Branch(&runtime, ne, at, Operand(zero_reg)); |
2775 __ IndexFromHash(a2, v0); | 2775 __ IndexFromHash(a2, v0); |
2776 __ Ret(); | 2776 __ Ret(); |
2777 | 2777 |
2778 __ bind(&runtime); | 2778 __ bind(&runtime); |
2779 __ Push(a0); // Push argument. | 2779 { |
2780 __ TailCallRuntime(Runtime::kStringToNumber); | 2780 FrameScope frame(masm, StackFrame::INTERNAL); |
| 2781 // Push argument. |
| 2782 __ Push(a0); |
| 2783 // We cannot use a tail call here because this builtin can also be called |
| 2784 // from wasm. |
| 2785 __ CallRuntime(Runtime::kStringToNumber); |
| 2786 } |
| 2787 __ Ret(); |
2781 } | 2788 } |
2782 | 2789 |
2783 // static | 2790 // static |
2784 void Builtins::Generate_ToNumber(MacroAssembler* masm) { | 2791 void Builtins::Generate_ToNumber(MacroAssembler* masm) { |
2785 // The ToNumber stub takes one argument in a0. | 2792 // The ToNumber stub takes one argument in a0. |
2786 Label not_smi; | 2793 Label not_smi; |
2787 __ JumpIfNotSmi(a0, ¬_smi); | 2794 __ JumpIfNotSmi(a0, ¬_smi); |
2788 __ Ret(USE_DELAY_SLOT); | 2795 __ Ret(USE_DELAY_SLOT); |
2789 __ mov(v0, a0); | 2796 __ mov(v0, a0); |
2790 __ bind(¬_smi); | 2797 __ bind(¬_smi); |
(...skipping 23 matching lines...) Expand all Loading... |
2814 __ Branch(¬_string, hs, a1, Operand(FIRST_NONSTRING_TYPE)); | 2821 __ Branch(¬_string, hs, a1, Operand(FIRST_NONSTRING_TYPE)); |
2815 __ Jump(masm->isolate()->builtins()->StringToNumber(), | 2822 __ Jump(masm->isolate()->builtins()->StringToNumber(), |
2816 RelocInfo::CODE_TARGET); | 2823 RelocInfo::CODE_TARGET); |
2817 __ bind(¬_string); | 2824 __ bind(¬_string); |
2818 | 2825 |
2819 Label not_oddball; | 2826 Label not_oddball; |
2820 __ Branch(¬_oddball, ne, a1, Operand(ODDBALL_TYPE)); | 2827 __ Branch(¬_oddball, ne, a1, Operand(ODDBALL_TYPE)); |
2821 __ Ret(USE_DELAY_SLOT); | 2828 __ Ret(USE_DELAY_SLOT); |
2822 __ lw(v0, FieldMemOperand(a0, Oddball::kToNumberOffset)); // In delay slot. | 2829 __ lw(v0, FieldMemOperand(a0, Oddball::kToNumberOffset)); // In delay slot. |
2823 __ bind(¬_oddball); | 2830 __ bind(¬_oddball); |
2824 | 2831 { |
2825 __ Push(a0); // Push argument. | 2832 FrameScope frame(masm, StackFrame::INTERNAL); |
2826 __ TailCallRuntime(Runtime::kToNumber); | 2833 // Push argument. |
| 2834 __ Push(a0); |
| 2835 // We cannot use a tail call here because this builtin can also be called |
| 2836 // from wasm. |
| 2837 __ CallRuntime(Runtime::kToNumber); |
| 2838 } |
| 2839 __ Ret(); |
2827 } | 2840 } |
2828 | 2841 |
2829 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2842 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
2830 // State setup as expected by MacroAssembler::InvokePrologue. | 2843 // State setup as expected by MacroAssembler::InvokePrologue. |
2831 // ----------- S t a t e ------------- | 2844 // ----------- S t a t e ------------- |
2832 // -- a0: actual arguments count | 2845 // -- a0: actual arguments count |
2833 // -- a1: function (passed through to callee) | 2846 // -- a1: function (passed through to callee) |
2834 // -- a2: expected arguments count | 2847 // -- a2: expected arguments count |
2835 // -- a3: new target (passed through to callee) | 2848 // -- a3: new target (passed through to callee) |
2836 // ----------------------------------- | 2849 // ----------------------------------- |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2957 } | 2970 } |
2958 } | 2971 } |
2959 | 2972 |
2960 | 2973 |
2961 #undef __ | 2974 #undef __ |
2962 | 2975 |
2963 } // namespace internal | 2976 } // namespace internal |
2964 } // namespace v8 | 2977 } // namespace v8 |
2965 | 2978 |
2966 #endif // V8_TARGET_ARCH_MIPS | 2979 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |