| 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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 { | 163 { |
| 164 // Check if all parameters done. | 164 // Check if all parameters done. |
| 165 __ Dsubu(a0, a0, Operand(1)); | 165 __ Dsubu(a0, a0, Operand(1)); |
| 166 __ Branch(&done_loop, lt, a0, Operand(zero_reg)); | 166 __ Branch(&done_loop, lt, a0, Operand(zero_reg)); |
| 167 | 167 |
| 168 // Load the next parameter tagged value into a2. | 168 // Load the next parameter tagged value into a2. |
| 169 __ Dlsa(at, sp, a0, kPointerSizeLog2); | 169 __ Dlsa(at, sp, a0, kPointerSizeLog2); |
| 170 __ ld(a2, MemOperand(at)); | 170 __ ld(a2, MemOperand(at)); |
| 171 | 171 |
| 172 // Load the double value of the parameter into f2, maybe converting the | 172 // Load the double value of the parameter into f2, maybe converting the |
| 173 // parameter to a number first using the ToNumberStub if necessary. | 173 // parameter to a number first using the ToNumber builtin if necessary. |
| 174 Label convert, convert_smi, convert_number, done_convert; | 174 Label convert, convert_smi, convert_number, done_convert; |
| 175 __ bind(&convert); | 175 __ bind(&convert); |
| 176 __ JumpIfSmi(a2, &convert_smi); | 176 __ JumpIfSmi(a2, &convert_smi); |
| 177 __ ld(a4, FieldMemOperand(a2, HeapObject::kMapOffset)); | 177 __ ld(a4, FieldMemOperand(a2, HeapObject::kMapOffset)); |
| 178 __ JumpIfRoot(a4, Heap::kHeapNumberMapRootIndex, &convert_number); | 178 __ JumpIfRoot(a4, Heap::kHeapNumberMapRootIndex, &convert_number); |
| 179 { | 179 { |
| 180 // Parameter is not a Number, use the ToNumberStub to convert it. | 180 // Parameter is not a Number, use the ToNumber builtin to convert it. |
| 181 FrameScope scope(masm, StackFrame::INTERNAL); | 181 FrameScope scope(masm, StackFrame::INTERNAL); |
| 182 __ SmiTag(a0); | 182 __ SmiTag(a0); |
| 183 __ SmiTag(a3); | 183 __ SmiTag(a3); |
| 184 __ Push(a0, a1, a3); | 184 __ Push(a0, a1, a3); |
| 185 __ mov(a0, a2); | 185 __ mov(a0, a2); |
| 186 ToNumberStub stub(masm->isolate()); | 186 __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET); |
| 187 __ CallStub(&stub); | |
| 188 __ mov(a2, v0); | 187 __ mov(a2, v0); |
| 189 __ Pop(a0, a1, a3); | 188 __ Pop(a0, a1, a3); |
| 190 { | 189 { |
| 191 // Restore the double accumulator value (f0). | 190 // Restore the double accumulator value (f0). |
| 192 Label restore_smi, done_restore; | 191 Label restore_smi, done_restore; |
| 193 __ JumpIfSmi(a1, &restore_smi); | 192 __ JumpIfSmi(a1, &restore_smi); |
| 194 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); | 193 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); |
| 195 __ jmp(&done_restore); | 194 __ jmp(&done_restore); |
| 196 __ bind(&restore_smi); | 195 __ bind(&restore_smi); |
| 197 __ SmiToDoubleFPURegister(a1, f0, a4); | 196 __ SmiToDoubleFPURegister(a1, f0, a4); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 Label no_arguments; | 253 Label no_arguments; |
| 255 { | 254 { |
| 256 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); | 255 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); |
| 257 __ Dsubu(a0, a0, Operand(1)); | 256 __ Dsubu(a0, a0, Operand(1)); |
| 258 __ Dlsa(sp, sp, a0, kPointerSizeLog2); | 257 __ Dlsa(sp, sp, a0, kPointerSizeLog2); |
| 259 __ ld(a0, MemOperand(sp)); | 258 __ ld(a0, MemOperand(sp)); |
| 260 __ Drop(2); | 259 __ Drop(2); |
| 261 } | 260 } |
| 262 | 261 |
| 263 // 2a. Convert first argument to number. | 262 // 2a. Convert first argument to number. |
| 264 ToNumberStub stub(masm->isolate()); | 263 __ Jump(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET); |
| 265 __ TailCallStub(&stub); | |
| 266 | 264 |
| 267 // 2b. No arguments, return +0. | 265 // 2b. No arguments, return +0. |
| 268 __ bind(&no_arguments); | 266 __ bind(&no_arguments); |
| 269 __ Move(v0, Smi::FromInt(0)); | 267 __ Move(v0, Smi::FromInt(0)); |
| 270 __ DropAndRet(1); | 268 __ DropAndRet(1); |
| 271 } | 269 } |
| 272 | 270 |
| 273 | 271 |
| 274 void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) { | 272 void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) { |
| 275 // ----------- S t a t e ------------- | 273 // ----------- S t a t e ------------- |
| (...skipping 26 matching lines...) Expand all Loading... |
| 302 | 300 |
| 303 // 3. Make sure a0 is a number. | 301 // 3. Make sure a0 is a number. |
| 304 { | 302 { |
| 305 Label done_convert; | 303 Label done_convert; |
| 306 __ JumpIfSmi(a0, &done_convert); | 304 __ JumpIfSmi(a0, &done_convert); |
| 307 __ GetObjectType(a0, a2, a2); | 305 __ GetObjectType(a0, a2, a2); |
| 308 __ Branch(&done_convert, eq, t0, Operand(HEAP_NUMBER_TYPE)); | 306 __ Branch(&done_convert, eq, t0, Operand(HEAP_NUMBER_TYPE)); |
| 309 { | 307 { |
| 310 FrameScope scope(masm, StackFrame::INTERNAL); | 308 FrameScope scope(masm, StackFrame::INTERNAL); |
| 311 __ Push(a1, a3); | 309 __ Push(a1, a3); |
| 312 ToNumberStub stub(masm->isolate()); | 310 __ Call(masm->isolate()->builtins()->ToNumber(), RelocInfo::CODE_TARGET); |
| 313 __ CallStub(&stub); | |
| 314 __ Move(a0, v0); | 311 __ Move(a0, v0); |
| 315 __ Pop(a1, a3); | 312 __ Pop(a1, a3); |
| 316 } | 313 } |
| 317 __ bind(&done_convert); | 314 __ bind(&done_convert); |
| 318 } | 315 } |
| 319 | 316 |
| 320 // 4. Check if new target and constructor differ. | 317 // 4. Check if new target and constructor differ. |
| 321 Label new_object; | 318 Label new_object; |
| 322 __ Branch(&new_object, ne, a1, Operand(a3)); | 319 __ Branch(&new_object, ne, a1, Operand(a3)); |
| 323 | 320 |
| (...skipping 2438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2762 __ And(at, a2, Operand(String::kContainsCachedArrayIndexMask)); | 2759 __ And(at, a2, Operand(String::kContainsCachedArrayIndexMask)); |
| 2763 __ Branch(&runtime, ne, at, Operand(zero_reg)); | 2760 __ Branch(&runtime, ne, at, Operand(zero_reg)); |
| 2764 __ IndexFromHash(a2, v0); | 2761 __ IndexFromHash(a2, v0); |
| 2765 __ Ret(); | 2762 __ Ret(); |
| 2766 | 2763 |
| 2767 __ bind(&runtime); | 2764 __ bind(&runtime); |
| 2768 __ Push(a0); // Push argument. | 2765 __ Push(a0); // Push argument. |
| 2769 __ TailCallRuntime(Runtime::kStringToNumber); | 2766 __ TailCallRuntime(Runtime::kStringToNumber); |
| 2770 } | 2767 } |
| 2771 | 2768 |
| 2769 // static |
| 2770 void Builtins::Generate_ToNumber(MacroAssembler* masm) { |
| 2771 // The ToNumber stub takes one argument in a0. |
| 2772 Label not_smi; |
| 2773 __ JumpIfNotSmi(a0, ¬_smi); |
| 2774 __ Ret(USE_DELAY_SLOT); |
| 2775 __ mov(v0, a0); |
| 2776 __ bind(¬_smi); |
| 2777 |
| 2778 Label not_heap_number; |
| 2779 __ GetObjectType(a0, a1, a1); |
| 2780 // a0: receiver |
| 2781 // a1: receiver instance type |
| 2782 __ Branch(¬_heap_number, ne, a1, Operand(HEAP_NUMBER_TYPE)); |
| 2783 __ Ret(USE_DELAY_SLOT); |
| 2784 __ mov(v0, a0); |
| 2785 __ bind(¬_heap_number); |
| 2786 |
| 2787 __ Jump(masm->isolate()->builtins()->NonNumberToNumber(), |
| 2788 RelocInfo::CODE_TARGET); |
| 2789 } |
| 2790 |
| 2791 // static |
| 2792 void Builtins::Generate_NonNumberToNumber(MacroAssembler* masm) { |
| 2793 // The NonNumberToNumber stub takes on argument in a0. |
| 2794 __ AssertNotNumber(a0); |
| 2795 |
| 2796 Label not_string; |
| 2797 __ GetObjectType(a0, a1, a1); |
| 2798 // a0: receiver |
| 2799 // a1: receiver instance type |
| 2800 __ Branch(¬_string, hs, a1, Operand(FIRST_NONSTRING_TYPE)); |
| 2801 __ Jump(masm->isolate()->builtins()->StringToNumber(), |
| 2802 RelocInfo::CODE_TARGET); |
| 2803 __ bind(¬_string); |
| 2804 |
| 2805 Label not_oddball; |
| 2806 __ Branch(¬_oddball, ne, a1, Operand(ODDBALL_TYPE)); |
| 2807 __ Ret(USE_DELAY_SLOT); |
| 2808 __ ld(v0, FieldMemOperand(a0, Oddball::kToNumberOffset)); // In delay slot. |
| 2809 __ bind(¬_oddball); |
| 2810 |
| 2811 __ Push(a0); // Push argument. |
| 2812 __ TailCallRuntime(Runtime::kToNumber); |
| 2813 } |
| 2814 |
| 2772 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2815 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
| 2773 // State setup as expected by MacroAssembler::InvokePrologue. | 2816 // State setup as expected by MacroAssembler::InvokePrologue. |
| 2774 // ----------- S t a t e ------------- | 2817 // ----------- S t a t e ------------- |
| 2775 // -- a0: actual arguments count | 2818 // -- a0: actual arguments count |
| 2776 // -- a1: function (passed through to callee) | 2819 // -- a1: function (passed through to callee) |
| 2777 // -- a2: expected arguments count | 2820 // -- a2: expected arguments count |
| 2778 // -- a3: new target (passed through to callee) | 2821 // -- a3: new target (passed through to callee) |
| 2779 // ----------------------------------- | 2822 // ----------------------------------- |
| 2780 | 2823 |
| 2781 Label invoke, dont_adapt_arguments, stack_overflow; | 2824 Label invoke, dont_adapt_arguments, stack_overflow; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2902 } | 2945 } |
| 2903 } | 2946 } |
| 2904 | 2947 |
| 2905 | 2948 |
| 2906 #undef __ | 2949 #undef __ |
| 2907 | 2950 |
| 2908 } // namespace internal | 2951 } // namespace internal |
| 2909 } // namespace v8 | 2952 } // namespace v8 |
| 2910 | 2953 |
| 2911 #endif // V8_TARGET_ARCH_MIPS64 | 2954 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |