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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 253 } |
254 | 254 |
255 { | 255 { |
256 // Drop all arguments including the receiver. | 256 // Drop all arguments including the receiver. |
257 __ Drop(r2); | 257 __ Drop(r2); |
258 __ Ret(1); | 258 __ Ret(1); |
259 } | 259 } |
260 | 260 |
261 // 2b. No arguments, return +0. | 261 // 2b. No arguments, return +0. |
262 __ bind(&no_arguments); | 262 __ bind(&no_arguments); |
263 __ Move(r0, Smi::FromInt(0)); | 263 __ Move(r0, Smi::kZero); |
264 __ Ret(1); | 264 __ Ret(1); |
265 } | 265 } |
266 | 266 |
267 // static | 267 // static |
268 void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) { | 268 void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) { |
269 // ----------- S t a t e ------------- | 269 // ----------- S t a t e ------------- |
270 // -- r0 : number of arguments | 270 // -- r0 : number of arguments |
271 // -- r1 : constructor function | 271 // -- r1 : constructor function |
272 // -- r3 : new target | 272 // -- r3 : new target |
273 // -- cp : context | 273 // -- cp : context |
274 // -- lr : return address | 274 // -- lr : return address |
275 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) | 275 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) |
276 // -- sp[argc * 4] : receiver | 276 // -- sp[argc * 4] : receiver |
277 // ----------------------------------- | 277 // ----------------------------------- |
278 | 278 |
279 // 1. Make sure we operate in the context of the called function. | 279 // 1. Make sure we operate in the context of the called function. |
280 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 280 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
281 | 281 |
282 // 2. Load the first argument into r2. | 282 // 2. Load the first argument into r2. |
283 { | 283 { |
284 Label no_arguments, done; | 284 Label no_arguments, done; |
285 __ mov(r6, r0); // Store argc in r6. | 285 __ mov(r6, r0); // Store argc in r6. |
286 __ sub(r0, r0, Operand(1), SetCC); | 286 __ sub(r0, r0, Operand(1), SetCC); |
287 __ b(lo, &no_arguments); | 287 __ b(lo, &no_arguments); |
288 __ ldr(r2, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 288 __ ldr(r2, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
289 __ b(&done); | 289 __ b(&done); |
290 __ bind(&no_arguments); | 290 __ bind(&no_arguments); |
291 __ Move(r2, Smi::FromInt(0)); | 291 __ Move(r2, Smi::kZero); |
292 __ bind(&done); | 292 __ bind(&done); |
293 } | 293 } |
294 | 294 |
295 // 3. Make sure r2 is a number. | 295 // 3. Make sure r2 is a number. |
296 { | 296 { |
297 Label done_convert; | 297 Label done_convert; |
298 __ JumpIfSmi(r2, &done_convert); | 298 __ JumpIfSmi(r2, &done_convert); |
299 __ CompareObjectType(r2, r4, r4, HEAP_NUMBER_TYPE); | 299 __ CompareObjectType(r2, r4, r4, HEAP_NUMBER_TYPE); |
300 __ b(eq, &done_convert); | 300 __ b(eq, &done_convert); |
301 { | 301 { |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 // Unreachable code. | 1319 // Unreachable code. |
1320 __ bkpt(0); | 1320 __ bkpt(0); |
1321 } | 1321 } |
1322 } | 1322 } |
1323 | 1323 |
1324 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { | 1324 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
1325 // Set the return address to the correct point in the interpreter entry | 1325 // Set the return address to the correct point in the interpreter entry |
1326 // trampoline. | 1326 // trampoline. |
1327 Smi* interpreter_entry_return_pc_offset( | 1327 Smi* interpreter_entry_return_pc_offset( |
1328 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); | 1328 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); |
1329 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); | 1329 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::kZero); |
1330 __ Move(r2, masm->isolate()->builtins()->InterpreterEntryTrampoline()); | 1330 __ Move(r2, masm->isolate()->builtins()->InterpreterEntryTrampoline()); |
1331 __ add(lr, r2, Operand(interpreter_entry_return_pc_offset->value() + | 1331 __ add(lr, r2, Operand(interpreter_entry_return_pc_offset->value() + |
1332 Code::kHeaderSize - kHeapObjectTag)); | 1332 Code::kHeaderSize - kHeapObjectTag)); |
1333 | 1333 |
1334 // Initialize the dispatch table register. | 1334 // Initialize the dispatch table register. |
1335 __ mov(kInterpreterDispatchTableRegister, | 1335 __ mov(kInterpreterDispatchTableRegister, |
1336 Operand(ExternalReference::interpreter_dispatch_table_address( | 1336 Operand(ExternalReference::interpreter_dispatch_table_address( |
1337 masm->isolate()))); | 1337 masm->isolate()))); |
1338 | 1338 |
1339 // Get the bytecode array pointer from the frame. | 1339 // Get the bytecode array pointer from the frame. |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 | 1852 |
1853 { | 1853 { |
1854 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1854 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
1855 // Pass function as argument. | 1855 // Pass function as argument. |
1856 __ push(r0); | 1856 __ push(r0); |
1857 __ CallRuntime(Runtime::kCompileForOnStackReplacement); | 1857 __ CallRuntime(Runtime::kCompileForOnStackReplacement); |
1858 } | 1858 } |
1859 | 1859 |
1860 // If the code object is null, just return to the caller. | 1860 // If the code object is null, just return to the caller. |
1861 Label skip; | 1861 Label skip; |
1862 __ cmp(r0, Operand(Smi::FromInt(0))); | 1862 __ cmp(r0, Operand(Smi::kZero)); |
1863 __ b(ne, &skip); | 1863 __ b(ne, &skip); |
1864 __ Ret(); | 1864 __ Ret(); |
1865 | 1865 |
1866 __ bind(&skip); | 1866 __ bind(&skip); |
1867 | 1867 |
1868 // Drop any potential handler frame that is be sitting on top of the actual | 1868 // Drop any potential handler frame that is be sitting on top of the actual |
1869 // JavaScript frame. This is the case then OSR is triggered from bytecode. | 1869 // JavaScript frame. This is the case then OSR is triggered from bytecode. |
1870 if (has_handler_frame) { | 1870 if (has_handler_frame) { |
1871 __ LeaveFrame(StackFrame::STUB); | 1871 __ LeaveFrame(StackFrame::STUB); |
1872 } | 1872 } |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2766 } | 2766 } |
2767 | 2767 |
2768 // static | 2768 // static |
2769 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { | 2769 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { |
2770 // ----------- S t a t e ------------- | 2770 // ----------- S t a t e ------------- |
2771 // -- r1 : requested object size (untagged) | 2771 // -- r1 : requested object size (untagged) |
2772 // -- lr : return address | 2772 // -- lr : return address |
2773 // ----------------------------------- | 2773 // ----------------------------------- |
2774 __ SmiTag(r1); | 2774 __ SmiTag(r1); |
2775 __ Push(r1); | 2775 __ Push(r1); |
2776 __ Move(cp, Smi::FromInt(0)); | 2776 __ Move(cp, Smi::kZero); |
2777 __ TailCallRuntime(Runtime::kAllocateInNewSpace); | 2777 __ TailCallRuntime(Runtime::kAllocateInNewSpace); |
2778 } | 2778 } |
2779 | 2779 |
2780 // static | 2780 // static |
2781 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { | 2781 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { |
2782 // ----------- S t a t e ------------- | 2782 // ----------- S t a t e ------------- |
2783 // -- r1 : requested object size (untagged) | 2783 // -- r1 : requested object size (untagged) |
2784 // -- lr : return address | 2784 // -- lr : return address |
2785 // ----------------------------------- | 2785 // ----------------------------------- |
2786 __ SmiTag(r1); | 2786 __ SmiTag(r1); |
2787 __ Move(r2, Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); | 2787 __ Move(r2, Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); |
2788 __ Push(r1, r2); | 2788 __ Push(r1, r2); |
2789 __ Move(cp, Smi::FromInt(0)); | 2789 __ Move(cp, Smi::kZero); |
2790 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); | 2790 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); |
2791 } | 2791 } |
2792 | 2792 |
2793 // static | 2793 // static |
2794 void Builtins::Generate_Abort(MacroAssembler* masm) { | 2794 void Builtins::Generate_Abort(MacroAssembler* masm) { |
2795 // ----------- S t a t e ------------- | 2795 // ----------- S t a t e ------------- |
2796 // -- r1 : message_id as Smi | 2796 // -- r1 : message_id as Smi |
2797 // -- lr : return address | 2797 // -- lr : return address |
2798 // ----------------------------------- | 2798 // ----------------------------------- |
2799 __ Push(r1); | 2799 __ Push(r1); |
2800 __ Move(cp, Smi::FromInt(0)); | 2800 __ Move(cp, Smi::kZero); |
2801 __ TailCallRuntime(Runtime::kAbort); | 2801 __ TailCallRuntime(Runtime::kAbort); |
2802 } | 2802 } |
2803 | 2803 |
2804 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2804 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
2805 // ----------- S t a t e ------------- | 2805 // ----------- S t a t e ------------- |
2806 // -- r0 : actual number of arguments | 2806 // -- r0 : actual number of arguments |
2807 // -- r1 : function (passed through to callee) | 2807 // -- r1 : function (passed through to callee) |
2808 // -- r2 : expected number of arguments | 2808 // -- r2 : expected number of arguments |
2809 // -- r3 : new target (passed through to callee) | 2809 // -- r3 : new target (passed through to callee) |
2810 // ----------------------------------- | 2810 // ----------------------------------- |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2923 __ bkpt(0); | 2923 __ bkpt(0); |
2924 } | 2924 } |
2925 } | 2925 } |
2926 | 2926 |
2927 #undef __ | 2927 #undef __ |
2928 | 2928 |
2929 } // namespace internal | 2929 } // namespace internal |
2930 } // namespace v8 | 2930 } // namespace v8 |
2931 | 2931 |
2932 #endif // V8_TARGET_ARCH_ARM | 2932 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |