| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 } | 257 } |
| 258 | 258 |
| 259 { | 259 { |
| 260 // Drop all arguments including the receiver. | 260 // Drop all arguments including the receiver. |
| 261 __ Dlsa(sp, sp, t0, kPointerSizeLog2); | 261 __ Dlsa(sp, sp, t0, kPointerSizeLog2); |
| 262 __ DropAndRet(1); | 262 __ DropAndRet(1); |
| 263 } | 263 } |
| 264 | 264 |
| 265 // 2b. No arguments, return +0. | 265 // 2b. No arguments, return +0. |
| 266 __ bind(&no_arguments); | 266 __ bind(&no_arguments); |
| 267 __ Move(v0, Smi::FromInt(0)); | 267 __ Move(v0, Smi::kZero); |
| 268 __ DropAndRet(1); | 268 __ DropAndRet(1); |
| 269 } | 269 } |
| 270 | 270 |
| 271 void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) { | 271 void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) { |
| 272 // ----------- S t a t e ------------- | 272 // ----------- S t a t e ------------- |
| 273 // -- a0 : number of arguments | 273 // -- a0 : number of arguments |
| 274 // -- a1 : constructor function | 274 // -- a1 : constructor function |
| 275 // -- a3 : new target | 275 // -- a3 : new target |
| 276 // -- cp : context | 276 // -- cp : context |
| 277 // -- ra : return address | 277 // -- ra : return address |
| 278 // -- sp[(argc - n - 1) * 8] : arg[n] (zero based) | 278 // -- sp[(argc - n - 1) * 8] : arg[n] (zero based) |
| 279 // -- sp[argc * 8] : receiver | 279 // -- sp[argc * 8] : receiver |
| 280 // ----------------------------------- | 280 // ----------------------------------- |
| 281 | 281 |
| 282 // 1. Make sure we operate in the context of the called function. | 282 // 1. Make sure we operate in the context of the called function. |
| 283 __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 283 __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
| 284 | 284 |
| 285 // 2. Load the first argument into a0 and get rid of the rest (including the | 285 // 2. Load the first argument into a0 and get rid of the rest (including the |
| 286 // receiver). | 286 // receiver). |
| 287 { | 287 { |
| 288 Label no_arguments, done; | 288 Label no_arguments, done; |
| 289 __ mov(t0, a0); // Store argc in t0. | 289 __ mov(t0, a0); // Store argc in t0. |
| 290 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); | 290 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); |
| 291 __ Dsubu(a0, a0, Operand(1)); // In delay slot. | 291 __ Dsubu(a0, a0, Operand(1)); // In delay slot. |
| 292 __ Dlsa(at, sp, a0, kPointerSizeLog2); | 292 __ Dlsa(at, sp, a0, kPointerSizeLog2); |
| 293 __ ld(a0, MemOperand(at)); | 293 __ ld(a0, MemOperand(at)); |
| 294 __ jmp(&done); | 294 __ jmp(&done); |
| 295 __ bind(&no_arguments); | 295 __ bind(&no_arguments); |
| 296 __ Move(a0, Smi::FromInt(0)); | 296 __ Move(a0, Smi::kZero); |
| 297 __ bind(&done); | 297 __ bind(&done); |
| 298 } | 298 } |
| 299 | 299 |
| 300 // 3. Make sure a0 is a number. | 300 // 3. Make sure a0 is a number. |
| 301 { | 301 { |
| 302 Label done_convert; | 302 Label done_convert; |
| 303 __ JumpIfSmi(a0, &done_convert); | 303 __ JumpIfSmi(a0, &done_convert); |
| 304 __ GetObjectType(a0, a2, a2); | 304 __ GetObjectType(a0, a2, a2); |
| 305 __ Branch(&done_convert, eq, a2, Operand(HEAP_NUMBER_TYPE)); | 305 __ Branch(&done_convert, eq, a2, Operand(HEAP_NUMBER_TYPE)); |
| 306 { | 306 { |
| (...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 // Unreachable code. | 1310 // Unreachable code. |
| 1311 __ break_(0xCC); | 1311 __ break_(0xCC); |
| 1312 } | 1312 } |
| 1313 } | 1313 } |
| 1314 | 1314 |
| 1315 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { | 1315 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
| 1316 // Set the return address to the correct point in the interpreter entry | 1316 // Set the return address to the correct point in the interpreter entry |
| 1317 // trampoline. | 1317 // trampoline. |
| 1318 Smi* interpreter_entry_return_pc_offset( | 1318 Smi* interpreter_entry_return_pc_offset( |
| 1319 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); | 1319 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); |
| 1320 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); | 1320 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::kZero); |
| 1321 __ li(t0, Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); | 1321 __ li(t0, Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); |
| 1322 __ Daddu(ra, t0, Operand(interpreter_entry_return_pc_offset->value() + | 1322 __ Daddu(ra, t0, Operand(interpreter_entry_return_pc_offset->value() + |
| 1323 Code::kHeaderSize - kHeapObjectTag)); | 1323 Code::kHeaderSize - kHeapObjectTag)); |
| 1324 | 1324 |
| 1325 // Initialize the dispatch table register. | 1325 // Initialize the dispatch table register. |
| 1326 __ li(kInterpreterDispatchTableRegister, | 1326 __ li(kInterpreterDispatchTableRegister, |
| 1327 Operand(ExternalReference::interpreter_dispatch_table_address( | 1327 Operand(ExternalReference::interpreter_dispatch_table_address( |
| 1328 masm->isolate()))); | 1328 masm->isolate()))); |
| 1329 | 1329 |
| 1330 // Get the bytecode array pointer from the frame. | 1330 // Get the bytecode array pointer from the frame. |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1845 } | 1845 } |
| 1846 | 1846 |
| 1847 { | 1847 { |
| 1848 FrameScope scope(masm, StackFrame::INTERNAL); | 1848 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1849 // Pass function as argument. | 1849 // Pass function as argument. |
| 1850 __ push(a0); | 1850 __ push(a0); |
| 1851 __ CallRuntime(Runtime::kCompileForOnStackReplacement); | 1851 __ CallRuntime(Runtime::kCompileForOnStackReplacement); |
| 1852 } | 1852 } |
| 1853 | 1853 |
| 1854 // If the code object is null, just return to the caller. | 1854 // If the code object is null, just return to the caller. |
| 1855 __ Ret(eq, v0, Operand(Smi::FromInt(0))); | 1855 __ Ret(eq, v0, Operand(Smi::kZero)); |
| 1856 | 1856 |
| 1857 // Drop any potential handler frame that is be sitting on top of the actual | 1857 // Drop any potential handler frame that is be sitting on top of the actual |
| 1858 // JavaScript frame. This is the case then OSR is triggered from bytecode. | 1858 // JavaScript frame. This is the case then OSR is triggered from bytecode. |
| 1859 if (has_handler_frame) { | 1859 if (has_handler_frame) { |
| 1860 __ LeaveFrame(StackFrame::STUB); | 1860 __ LeaveFrame(StackFrame::STUB); |
| 1861 } | 1861 } |
| 1862 | 1862 |
| 1863 // Load deoptimization data from the code object. | 1863 // Load deoptimization data from the code object. |
| 1864 // <deopt_data> = <code>[#deoptimization_data_offset] | 1864 // <deopt_data> = <code>[#deoptimization_data_offset] |
| 1865 __ ld(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); | 1865 __ ld(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2826 } | 2826 } |
| 2827 | 2827 |
| 2828 // static | 2828 // static |
| 2829 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { | 2829 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { |
| 2830 // ----------- S t a t e ------------- | 2830 // ----------- S t a t e ------------- |
| 2831 // -- a0 : requested object size (untagged) | 2831 // -- a0 : requested object size (untagged) |
| 2832 // -- ra : return address | 2832 // -- ra : return address |
| 2833 // ----------------------------------- | 2833 // ----------------------------------- |
| 2834 __ SmiTag(a0); | 2834 __ SmiTag(a0); |
| 2835 __ Push(a0); | 2835 __ Push(a0); |
| 2836 __ Move(cp, Smi::FromInt(0)); | 2836 __ Move(cp, Smi::kZero); |
| 2837 __ TailCallRuntime(Runtime::kAllocateInNewSpace); | 2837 __ TailCallRuntime(Runtime::kAllocateInNewSpace); |
| 2838 } | 2838 } |
| 2839 | 2839 |
| 2840 // static | 2840 // static |
| 2841 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { | 2841 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { |
| 2842 // ----------- S t a t e ------------- | 2842 // ----------- S t a t e ------------- |
| 2843 // -- a0 : requested object size (untagged) | 2843 // -- a0 : requested object size (untagged) |
| 2844 // -- ra : return address | 2844 // -- ra : return address |
| 2845 // ----------------------------------- | 2845 // ----------------------------------- |
| 2846 __ SmiTag(a0); | 2846 __ SmiTag(a0); |
| 2847 __ Move(a1, Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); | 2847 __ Move(a1, Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); |
| 2848 __ Push(a0, a1); | 2848 __ Push(a0, a1); |
| 2849 __ Move(cp, Smi::FromInt(0)); | 2849 __ Move(cp, Smi::kZero); |
| 2850 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); | 2850 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); |
| 2851 } | 2851 } |
| 2852 | 2852 |
| 2853 // static | 2853 // static |
| 2854 void Builtins::Generate_Abort(MacroAssembler* masm) { | 2854 void Builtins::Generate_Abort(MacroAssembler* masm) { |
| 2855 // ----------- S t a t e ------------- | 2855 // ----------- S t a t e ------------- |
| 2856 // -- a0 : message_id as Smi | 2856 // -- a0 : message_id as Smi |
| 2857 // -- ra : return address | 2857 // -- ra : return address |
| 2858 // ----------------------------------- | 2858 // ----------------------------------- |
| 2859 __ Push(a0); | 2859 __ Push(a0); |
| 2860 __ Move(cp, Smi::FromInt(0)); | 2860 __ Move(cp, Smi::kZero); |
| 2861 __ TailCallRuntime(Runtime::kAbort); | 2861 __ TailCallRuntime(Runtime::kAbort); |
| 2862 } | 2862 } |
| 2863 | 2863 |
| 2864 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2864 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
| 2865 // State setup as expected by MacroAssembler::InvokePrologue. | 2865 // State setup as expected by MacroAssembler::InvokePrologue. |
| 2866 // ----------- S t a t e ------------- | 2866 // ----------- S t a t e ------------- |
| 2867 // -- a0: actual arguments count | 2867 // -- a0: actual arguments count |
| 2868 // -- a1: function (passed through to callee) | 2868 // -- a1: function (passed through to callee) |
| 2869 // -- a2: expected arguments count | 2869 // -- a2: expected arguments count |
| 2870 // -- a3: new target (passed through to callee) | 2870 // -- a3: new target (passed through to callee) |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2992 __ break_(0xCC); | 2992 __ break_(0xCC); |
| 2993 } | 2993 } |
| 2994 } | 2994 } |
| 2995 | 2995 |
| 2996 #undef __ | 2996 #undef __ |
| 2997 | 2997 |
| 2998 } // namespace internal | 2998 } // namespace internal |
| 2999 } // namespace v8 | 2999 } // namespace v8 |
| 3000 | 3000 |
| 3001 #endif // V8_TARGET_ARCH_MIPS64 | 3001 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |