| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 } | 259 } |
| 260 | 260 |
| 261 { | 261 { |
| 262 // Drop all arguments including the receiver. | 262 // Drop all arguments including the receiver. |
| 263 __ Lsa(sp, sp, t0, kPointerSizeLog2); | 263 __ Lsa(sp, sp, t0, kPointerSizeLog2); |
| 264 __ DropAndRet(1); | 264 __ DropAndRet(1); |
| 265 } | 265 } |
| 266 | 266 |
| 267 // 2b. No arguments, return +0. | 267 // 2b. No arguments, return +0. |
| 268 __ bind(&no_arguments); | 268 __ bind(&no_arguments); |
| 269 __ Move(v0, Smi::kZero); | 269 __ Move(v0, Smi::FromInt(0)); |
| 270 __ DropAndRet(1); | 270 __ DropAndRet(1); |
| 271 } | 271 } |
| 272 | 272 |
| 273 // static | 273 // static |
| 274 void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) { | 274 void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) { |
| 275 // ----------- S t a t e ------------- | 275 // ----------- S t a t e ------------- |
| 276 // -- a0 : number of arguments | 276 // -- a0 : number of arguments |
| 277 // -- a1 : constructor function | 277 // -- a1 : constructor function |
| 278 // -- a3 : new target | 278 // -- a3 : new target |
| 279 // -- cp : context | 279 // -- cp : context |
| 280 // -- ra : return address | 280 // -- ra : return address |
| 281 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) | 281 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) |
| 282 // -- sp[argc * 4] : receiver | 282 // -- sp[argc * 4] : receiver |
| 283 // ----------------------------------- | 283 // ----------------------------------- |
| 284 | 284 |
| 285 // 1. Make sure we operate in the context of the called function. | 285 // 1. Make sure we operate in the context of the called function. |
| 286 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 286 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
| 287 | 287 |
| 288 // 2. Load the first argument into a0. | 288 // 2. Load the first argument into a0. |
| 289 { | 289 { |
| 290 Label no_arguments, done; | 290 Label no_arguments, done; |
| 291 __ mov(t0, a0); // Store argc in t0. | 291 __ mov(t0, a0); // Store argc in t0. |
| 292 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); | 292 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); |
| 293 __ Subu(t1, a0, Operand(1)); // In delay slot. | 293 __ Subu(t1, a0, Operand(1)); // In delay slot. |
| 294 __ Lsa(at, sp, t1, kPointerSizeLog2); | 294 __ Lsa(at, sp, t1, kPointerSizeLog2); |
| 295 __ lw(a0, MemOperand(at)); | 295 __ lw(a0, MemOperand(at)); |
| 296 __ jmp(&done); | 296 __ jmp(&done); |
| 297 __ bind(&no_arguments); | 297 __ bind(&no_arguments); |
| 298 __ Move(a0, Smi::kZero); | 298 __ Move(a0, Smi::FromInt(0)); |
| 299 __ bind(&done); | 299 __ bind(&done); |
| 300 } | 300 } |
| 301 | 301 |
| 302 // 3. Make sure a0 is a number. | 302 // 3. Make sure a0 is a number. |
| 303 { | 303 { |
| 304 Label done_convert; | 304 Label done_convert; |
| 305 __ JumpIfSmi(a0, &done_convert); | 305 __ JumpIfSmi(a0, &done_convert); |
| 306 __ GetObjectType(a0, a2, a2); | 306 __ GetObjectType(a0, a2, a2); |
| 307 __ Branch(&done_convert, eq, a2, Operand(HEAP_NUMBER_TYPE)); | 307 __ Branch(&done_convert, eq, a2, Operand(HEAP_NUMBER_TYPE)); |
| 308 { | 308 { |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1318 // Unreachable code. | 1318 // Unreachable code. |
| 1319 __ break_(0xCC); | 1319 __ break_(0xCC); |
| 1320 } | 1320 } |
| 1321 } | 1321 } |
| 1322 | 1322 |
| 1323 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { | 1323 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
| 1324 // Set the return address to the correct point in the interpreter entry | 1324 // Set the return address to the correct point in the interpreter entry |
| 1325 // trampoline. | 1325 // trampoline. |
| 1326 Smi* interpreter_entry_return_pc_offset( | 1326 Smi* interpreter_entry_return_pc_offset( |
| 1327 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); | 1327 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); |
| 1328 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::kZero); | 1328 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); |
| 1329 __ li(t0, Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); | 1329 __ li(t0, Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); |
| 1330 __ Addu(ra, t0, Operand(interpreter_entry_return_pc_offset->value() + | 1330 __ Addu(ra, t0, Operand(interpreter_entry_return_pc_offset->value() + |
| 1331 Code::kHeaderSize - kHeapObjectTag)); | 1331 Code::kHeaderSize - kHeapObjectTag)); |
| 1332 | 1332 |
| 1333 // Initialize the dispatch table register. | 1333 // Initialize the dispatch table register. |
| 1334 __ li(kInterpreterDispatchTableRegister, | 1334 __ li(kInterpreterDispatchTableRegister, |
| 1335 Operand(ExternalReference::interpreter_dispatch_table_address( | 1335 Operand(ExternalReference::interpreter_dispatch_table_address( |
| 1336 masm->isolate()))); | 1336 masm->isolate()))); |
| 1337 | 1337 |
| 1338 // Get the bytecode array pointer from the frame. | 1338 // Get the bytecode array pointer from the frame. |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1835 } | 1835 } |
| 1836 | 1836 |
| 1837 { | 1837 { |
| 1838 FrameScope scope(masm, StackFrame::INTERNAL); | 1838 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1839 // Pass function as argument. | 1839 // Pass function as argument. |
| 1840 __ push(a0); | 1840 __ push(a0); |
| 1841 __ CallRuntime(Runtime::kCompileForOnStackReplacement); | 1841 __ CallRuntime(Runtime::kCompileForOnStackReplacement); |
| 1842 } | 1842 } |
| 1843 | 1843 |
| 1844 // If the code object is null, just return to the caller. | 1844 // If the code object is null, just return to the caller. |
| 1845 __ Ret(eq, v0, Operand(Smi::kZero)); | 1845 __ Ret(eq, v0, Operand(Smi::FromInt(0))); |
| 1846 | 1846 |
| 1847 // Drop any potential handler frame that is be sitting on top of the actual | 1847 // Drop any potential handler frame that is be sitting on top of the actual |
| 1848 // JavaScript frame. This is the case then OSR is triggered from bytecode. | 1848 // JavaScript frame. This is the case then OSR is triggered from bytecode. |
| 1849 if (has_handler_frame) { | 1849 if (has_handler_frame) { |
| 1850 __ LeaveFrame(StackFrame::STUB); | 1850 __ LeaveFrame(StackFrame::STUB); |
| 1851 } | 1851 } |
| 1852 | 1852 |
| 1853 // Load deoptimization data from the code object. | 1853 // Load deoptimization data from the code object. |
| 1854 // <deopt_data> = <code>[#deoptimization_data_offset] | 1854 // <deopt_data> = <code>[#deoptimization_data_offset] |
| 1855 __ lw(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); | 1855 __ lw(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); |
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2817 } | 2817 } |
| 2818 | 2818 |
| 2819 // static | 2819 // static |
| 2820 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { | 2820 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { |
| 2821 // ----------- S t a t e ------------- | 2821 // ----------- S t a t e ------------- |
| 2822 // -- a0 : requested object size (untagged) | 2822 // -- a0 : requested object size (untagged) |
| 2823 // -- ra : return address | 2823 // -- ra : return address |
| 2824 // ----------------------------------- | 2824 // ----------------------------------- |
| 2825 __ SmiTag(a0); | 2825 __ SmiTag(a0); |
| 2826 __ Push(a0); | 2826 __ Push(a0); |
| 2827 __ Move(cp, Smi::kZero); | 2827 __ Move(cp, Smi::FromInt(0)); |
| 2828 __ TailCallRuntime(Runtime::kAllocateInNewSpace); | 2828 __ TailCallRuntime(Runtime::kAllocateInNewSpace); |
| 2829 } | 2829 } |
| 2830 | 2830 |
| 2831 // static | 2831 // static |
| 2832 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { | 2832 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { |
| 2833 // ----------- S t a t e ------------- | 2833 // ----------- S t a t e ------------- |
| 2834 // -- a0 : requested object size (untagged) | 2834 // -- a0 : requested object size (untagged) |
| 2835 // -- ra : return address | 2835 // -- ra : return address |
| 2836 // ----------------------------------- | 2836 // ----------------------------------- |
| 2837 __ SmiTag(a0); | 2837 __ SmiTag(a0); |
| 2838 __ Move(a1, Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); | 2838 __ Move(a1, Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); |
| 2839 __ Push(a0, a1); | 2839 __ Push(a0, a1); |
| 2840 __ Move(cp, Smi::kZero); | 2840 __ Move(cp, Smi::FromInt(0)); |
| 2841 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); | 2841 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); |
| 2842 } | 2842 } |
| 2843 | 2843 |
| 2844 // static | 2844 // static |
| 2845 void Builtins::Generate_Abort(MacroAssembler* masm) { | 2845 void Builtins::Generate_Abort(MacroAssembler* masm) { |
| 2846 // ----------- S t a t e ------------- | 2846 // ----------- S t a t e ------------- |
| 2847 // -- a0 : message_id as Smi | 2847 // -- a0 : message_id as Smi |
| 2848 // -- ra : return address | 2848 // -- ra : return address |
| 2849 // ----------------------------------- | 2849 // ----------------------------------- |
| 2850 __ Push(a0); | 2850 __ Push(a0); |
| 2851 __ Move(cp, Smi::kZero); | 2851 __ Move(cp, Smi::FromInt(0)); |
| 2852 __ TailCallRuntime(Runtime::kAbort); | 2852 __ TailCallRuntime(Runtime::kAbort); |
| 2853 } | 2853 } |
| 2854 | 2854 |
| 2855 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2855 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
| 2856 // State setup as expected by MacroAssembler::InvokePrologue. | 2856 // State setup as expected by MacroAssembler::InvokePrologue. |
| 2857 // ----------- S t a t e ------------- | 2857 // ----------- S t a t e ------------- |
| 2858 // -- a0: actual arguments count | 2858 // -- a0: actual arguments count |
| 2859 // -- a1: function (passed through to callee) | 2859 // -- a1: function (passed through to callee) |
| 2860 // -- a2: expected arguments count | 2860 // -- a2: expected arguments count |
| 2861 // -- a3: new target (passed through to callee) | 2861 // -- a3: new target (passed through to callee) |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2981 __ break_(0xCC); | 2981 __ break_(0xCC); |
| 2982 } | 2982 } |
| 2983 } | 2983 } |
| 2984 | 2984 |
| 2985 #undef __ | 2985 #undef __ |
| 2986 | 2986 |
| 2987 } // namespace internal | 2987 } // namespace internal |
| 2988 } // namespace v8 | 2988 } // namespace v8 |
| 2989 | 2989 |
| 2990 #endif // V8_TARGET_ARCH_MIPS | 2990 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |