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::kZero); | 267 __ Move(v0, Smi::FromInt(0)); |
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::kZero); | 296 __ Move(a0, Smi::FromInt(0)); |
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::kZero); | 1320 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); |
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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 } | 1829 } |
1830 | 1830 |
1831 { | 1831 { |
1832 FrameScope scope(masm, StackFrame::INTERNAL); | 1832 FrameScope scope(masm, StackFrame::INTERNAL); |
1833 // Pass function as argument. | 1833 // Pass function as argument. |
1834 __ push(a0); | 1834 __ push(a0); |
1835 __ CallRuntime(Runtime::kCompileForOnStackReplacement); | 1835 __ CallRuntime(Runtime::kCompileForOnStackReplacement); |
1836 } | 1836 } |
1837 | 1837 |
1838 // If the code object is null, just return to the caller. | 1838 // If the code object is null, just return to the caller. |
1839 __ Ret(eq, v0, Operand(Smi::kZero)); | 1839 __ Ret(eq, v0, Operand(Smi::FromInt(0))); |
1840 | 1840 |
1841 // Drop any potential handler frame that is be sitting on top of the actual | 1841 // Drop any potential handler frame that is be sitting on top of the actual |
1842 // JavaScript frame. This is the case then OSR is triggered from bytecode. | 1842 // JavaScript frame. This is the case then OSR is triggered from bytecode. |
1843 if (has_handler_frame) { | 1843 if (has_handler_frame) { |
1844 __ LeaveFrame(StackFrame::STUB); | 1844 __ LeaveFrame(StackFrame::STUB); |
1845 } | 1845 } |
1846 | 1846 |
1847 // Load deoptimization data from the code object. | 1847 // Load deoptimization data from the code object. |
1848 // <deopt_data> = <code>[#deoptimization_data_offset] | 1848 // <deopt_data> = <code>[#deoptimization_data_offset] |
1849 __ ld(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); | 1849 __ ld(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2810 } | 2810 } |
2811 | 2811 |
2812 // static | 2812 // static |
2813 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { | 2813 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { |
2814 // ----------- S t a t e ------------- | 2814 // ----------- S t a t e ------------- |
2815 // -- a0 : requested object size (untagged) | 2815 // -- a0 : requested object size (untagged) |
2816 // -- ra : return address | 2816 // -- ra : return address |
2817 // ----------------------------------- | 2817 // ----------------------------------- |
2818 __ SmiTag(a0); | 2818 __ SmiTag(a0); |
2819 __ Push(a0); | 2819 __ Push(a0); |
2820 __ Move(cp, Smi::kZero); | 2820 __ Move(cp, Smi::FromInt(0)); |
2821 __ TailCallRuntime(Runtime::kAllocateInNewSpace); | 2821 __ TailCallRuntime(Runtime::kAllocateInNewSpace); |
2822 } | 2822 } |
2823 | 2823 |
2824 // static | 2824 // static |
2825 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { | 2825 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { |
2826 // ----------- S t a t e ------------- | 2826 // ----------- S t a t e ------------- |
2827 // -- a0 : requested object size (untagged) | 2827 // -- a0 : requested object size (untagged) |
2828 // -- ra : return address | 2828 // -- ra : return address |
2829 // ----------------------------------- | 2829 // ----------------------------------- |
2830 __ SmiTag(a0); | 2830 __ SmiTag(a0); |
2831 __ Move(a1, Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); | 2831 __ Move(a1, Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); |
2832 __ Push(a0, a1); | 2832 __ Push(a0, a1); |
2833 __ Move(cp, Smi::kZero); | 2833 __ Move(cp, Smi::FromInt(0)); |
2834 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); | 2834 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); |
2835 } | 2835 } |
2836 | 2836 |
2837 // static | 2837 // static |
2838 void Builtins::Generate_Abort(MacroAssembler* masm) { | 2838 void Builtins::Generate_Abort(MacroAssembler* masm) { |
2839 // ----------- S t a t e ------------- | 2839 // ----------- S t a t e ------------- |
2840 // -- a0 : message_id as Smi | 2840 // -- a0 : message_id as Smi |
2841 // -- ra : return address | 2841 // -- ra : return address |
2842 // ----------------------------------- | 2842 // ----------------------------------- |
2843 __ Push(a0); | 2843 __ Push(a0); |
2844 __ Move(cp, Smi::kZero); | 2844 __ Move(cp, Smi::FromInt(0)); |
2845 __ TailCallRuntime(Runtime::kAbort); | 2845 __ TailCallRuntime(Runtime::kAbort); |
2846 } | 2846 } |
2847 | 2847 |
2848 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2848 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
2849 // State setup as expected by MacroAssembler::InvokePrologue. | 2849 // State setup as expected by MacroAssembler::InvokePrologue. |
2850 // ----------- S t a t e ------------- | 2850 // ----------- S t a t e ------------- |
2851 // -- a0: actual arguments count | 2851 // -- a0: actual arguments count |
2852 // -- a1: function (passed through to callee) | 2852 // -- a1: function (passed through to callee) |
2853 // -- a2: expected arguments count | 2853 // -- a2: expected arguments count |
2854 // -- a3: new target (passed through to callee) | 2854 // -- a3: new target (passed through to callee) |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2976 __ break_(0xCC); | 2976 __ break_(0xCC); |
2977 } | 2977 } |
2978 } | 2978 } |
2979 | 2979 |
2980 #undef __ | 2980 #undef __ |
2981 | 2981 |
2982 } // namespace internal | 2982 } // namespace internal |
2983 } // namespace v8 | 2983 } // namespace v8 |
2984 | 2984 |
2985 #endif // V8_TARGET_ARCH_MIPS64 | 2985 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |