| 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::kZero); | 263 __ Move(r0, Smi::FromInt(0)); |
| 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::kZero); | 291 __ Move(r2, Smi::FromInt(0)); |
| 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::kZero); | 1329 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); |
| 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1836 | 1836 |
| 1837 { | 1837 { |
| 1838 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1838 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 1839 // Pass function as argument. | 1839 // Pass function as argument. |
| 1840 __ push(r0); | 1840 __ push(r0); |
| 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 Label skip; | 1845 Label skip; |
| 1846 __ cmp(r0, Operand(Smi::kZero)); | 1846 __ cmp(r0, Operand(Smi::FromInt(0))); |
| 1847 __ b(ne, &skip); | 1847 __ b(ne, &skip); |
| 1848 __ Ret(); | 1848 __ Ret(); |
| 1849 | 1849 |
| 1850 __ bind(&skip); | 1850 __ bind(&skip); |
| 1851 | 1851 |
| 1852 // Drop any potential handler frame that is be sitting on top of the actual | 1852 // Drop any potential handler frame that is be sitting on top of the actual |
| 1853 // JavaScript frame. This is the case then OSR is triggered from bytecode. | 1853 // JavaScript frame. This is the case then OSR is triggered from bytecode. |
| 1854 if (has_handler_frame) { | 1854 if (has_handler_frame) { |
| 1855 __ LeaveFrame(StackFrame::STUB); | 1855 __ LeaveFrame(StackFrame::STUB); |
| 1856 } | 1856 } |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2750 } | 2750 } |
| 2751 | 2751 |
| 2752 // static | 2752 // static |
| 2753 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { | 2753 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { |
| 2754 // ----------- S t a t e ------------- | 2754 // ----------- S t a t e ------------- |
| 2755 // -- r1 : requested object size (untagged) | 2755 // -- r1 : requested object size (untagged) |
| 2756 // -- lr : return address | 2756 // -- lr : return address |
| 2757 // ----------------------------------- | 2757 // ----------------------------------- |
| 2758 __ SmiTag(r1); | 2758 __ SmiTag(r1); |
| 2759 __ Push(r1); | 2759 __ Push(r1); |
| 2760 __ Move(cp, Smi::kZero); | 2760 __ Move(cp, Smi::FromInt(0)); |
| 2761 __ TailCallRuntime(Runtime::kAllocateInNewSpace); | 2761 __ TailCallRuntime(Runtime::kAllocateInNewSpace); |
| 2762 } | 2762 } |
| 2763 | 2763 |
| 2764 // static | 2764 // static |
| 2765 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { | 2765 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { |
| 2766 // ----------- S t a t e ------------- | 2766 // ----------- S t a t e ------------- |
| 2767 // -- r1 : requested object size (untagged) | 2767 // -- r1 : requested object size (untagged) |
| 2768 // -- lr : return address | 2768 // -- lr : return address |
| 2769 // ----------------------------------- | 2769 // ----------------------------------- |
| 2770 __ SmiTag(r1); | 2770 __ SmiTag(r1); |
| 2771 __ Move(r2, Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); | 2771 __ Move(r2, Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); |
| 2772 __ Push(r1, r2); | 2772 __ Push(r1, r2); |
| 2773 __ Move(cp, Smi::kZero); | 2773 __ Move(cp, Smi::FromInt(0)); |
| 2774 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); | 2774 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); |
| 2775 } | 2775 } |
| 2776 | 2776 |
| 2777 // static | 2777 // static |
| 2778 void Builtins::Generate_Abort(MacroAssembler* masm) { | 2778 void Builtins::Generate_Abort(MacroAssembler* masm) { |
| 2779 // ----------- S t a t e ------------- | 2779 // ----------- S t a t e ------------- |
| 2780 // -- r1 : message_id as Smi | 2780 // -- r1 : message_id as Smi |
| 2781 // -- lr : return address | 2781 // -- lr : return address |
| 2782 // ----------------------------------- | 2782 // ----------------------------------- |
| 2783 __ Push(r1); | 2783 __ Push(r1); |
| 2784 __ Move(cp, Smi::kZero); | 2784 __ Move(cp, Smi::FromInt(0)); |
| 2785 __ TailCallRuntime(Runtime::kAbort); | 2785 __ TailCallRuntime(Runtime::kAbort); |
| 2786 } | 2786 } |
| 2787 | 2787 |
| 2788 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2788 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
| 2789 // ----------- S t a t e ------------- | 2789 // ----------- S t a t e ------------- |
| 2790 // -- r0 : actual number of arguments | 2790 // -- r0 : actual number of arguments |
| 2791 // -- r1 : function (passed through to callee) | 2791 // -- r1 : function (passed through to callee) |
| 2792 // -- r2 : expected number of arguments | 2792 // -- r2 : expected number of arguments |
| 2793 // -- r3 : new target (passed through to callee) | 2793 // -- r3 : new target (passed through to callee) |
| 2794 // ----------------------------------- | 2794 // ----------------------------------- |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2907 __ bkpt(0); | 2907 __ bkpt(0); |
| 2908 } | 2908 } |
| 2909 } | 2909 } |
| 2910 | 2910 |
| 2911 #undef __ | 2911 #undef __ |
| 2912 | 2912 |
| 2913 } // namespace internal | 2913 } // namespace internal |
| 2914 } // namespace v8 | 2914 } // namespace v8 |
| 2915 | 2915 |
| 2916 #endif // V8_TARGET_ARCH_ARM | 2916 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |