OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2094 | 2094 |
2095 // Prepare for tail call only if the debugger is not active. | 2095 // Prepare for tail call only if the debugger is not active. |
2096 Label done; | 2096 Label done; |
2097 ExternalReference debug_is_active = | 2097 ExternalReference debug_is_active = |
2098 ExternalReference::debug_is_active_address(masm->isolate()); | 2098 ExternalReference::debug_is_active_address(masm->isolate()); |
2099 __ Mov(scratch1, Operand(debug_is_active)); | 2099 __ Mov(scratch1, Operand(debug_is_active)); |
2100 __ Ldrb(scratch1, MemOperand(scratch1)); | 2100 __ Ldrb(scratch1, MemOperand(scratch1)); |
2101 __ Cmp(scratch1, Operand(0)); | 2101 __ Cmp(scratch1, Operand(0)); |
2102 __ B(ne, &done); | 2102 __ B(ne, &done); |
2103 | 2103 |
| 2104 // Drop possible interpreter handler/stub frame. |
| 2105 { |
| 2106 Label no_interpreter_frame; |
| 2107 __ Ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); |
| 2108 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); |
| 2109 __ B(ne, &no_interpreter_frame); |
| 2110 __ Ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 2111 __ bind(&no_interpreter_frame); |
| 2112 } |
| 2113 |
2104 // Check if next frame is an arguments adaptor frame. | 2114 // Check if next frame is an arguments adaptor frame. |
2105 Label no_arguments_adaptor, formal_parameter_count_loaded; | 2115 Label no_arguments_adaptor, formal_parameter_count_loaded; |
2106 __ Ldr(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 2116 __ Ldr(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
2107 __ Ldr(scratch3, | 2117 __ Ldr(scratch3, |
2108 MemOperand(scratch2, StandardFrameConstants::kContextOffset)); | 2118 MemOperand(scratch2, StandardFrameConstants::kContextOffset)); |
2109 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 2119 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
2110 __ B(ne, &no_arguments_adaptor); | 2120 __ B(ne, &no_arguments_adaptor); |
2111 | 2121 |
2112 // Drop arguments adaptor frame and load arguments count. | 2122 // Drop arguments adaptor frame and load arguments count. |
2113 __ mov(fp, scratch2); | 2123 __ mov(fp, scratch2); |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2569 | 2579 |
2570 // Called Construct on an Object that doesn't have a [[Construct]] internal | 2580 // Called Construct on an Object that doesn't have a [[Construct]] internal |
2571 // method. | 2581 // method. |
2572 __ bind(&non_constructor); | 2582 __ bind(&non_constructor); |
2573 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), | 2583 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), |
2574 RelocInfo::CODE_TARGET); | 2584 RelocInfo::CODE_TARGET); |
2575 } | 2585 } |
2576 | 2586 |
2577 | 2587 |
2578 // static | 2588 // static |
2579 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { | 2589 void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
| 2590 MacroAssembler* masm, TailCallMode tail_call_mode) { |
2580 // ----------- S t a t e ------------- | 2591 // ----------- S t a t e ------------- |
2581 // -- x0 : the number of arguments (not including the receiver) | 2592 // -- x0 : the number of arguments (not including the receiver) |
2582 // -- x2 : the address of the first argument to be pushed. Subsequent | 2593 // -- x2 : the address of the first argument to be pushed. Subsequent |
2583 // arguments should be consecutive above this, in the same order as | 2594 // arguments should be consecutive above this, in the same order as |
2584 // they are to be pushed onto the stack. | 2595 // they are to be pushed onto the stack. |
2585 // -- x1 : the target to call (can be any Object). | 2596 // -- x1 : the target to call (can be any Object). |
2586 // ----------------------------------- | 2597 // ----------------------------------- |
2587 | 2598 |
2588 // Find the address of the last argument. | 2599 // Find the address of the last argument. |
2589 __ add(x3, x0, Operand(1)); // Add one for receiver. | 2600 __ add(x3, x0, Operand(1)); // Add one for receiver. |
2590 __ lsl(x3, x3, kPointerSizeLog2); | 2601 __ lsl(x3, x3, kPointerSizeLog2); |
2591 __ sub(x4, x2, x3); | 2602 __ sub(x4, x2, x3); |
2592 | 2603 |
2593 // Push the arguments. | 2604 // Push the arguments. |
2594 Label loop_header, loop_check; | 2605 Label loop_header, loop_check; |
2595 __ Mov(x5, jssp); | 2606 __ Mov(x5, jssp); |
2596 __ Claim(x3, 1); | 2607 __ Claim(x3, 1); |
2597 __ B(&loop_check); | 2608 __ B(&loop_check); |
2598 __ Bind(&loop_header); | 2609 __ Bind(&loop_header); |
2599 // TODO(rmcilroy): Push two at a time once we ensure we keep stack aligned. | 2610 // TODO(rmcilroy): Push two at a time once we ensure we keep stack aligned. |
2600 __ Ldr(x3, MemOperand(x2, -kPointerSize, PostIndex)); | 2611 __ Ldr(x3, MemOperand(x2, -kPointerSize, PostIndex)); |
2601 __ Str(x3, MemOperand(x5, -kPointerSize, PreIndex)); | 2612 __ Str(x3, MemOperand(x5, -kPointerSize, PreIndex)); |
2602 __ Bind(&loop_check); | 2613 __ Bind(&loop_check); |
2603 __ Cmp(x2, x4); | 2614 __ Cmp(x2, x4); |
2604 __ B(gt, &loop_header); | 2615 __ B(gt, &loop_header); |
2605 | 2616 |
2606 // Call the target. | 2617 // Call the target. |
2607 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 2618 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
| 2619 tail_call_mode), |
| 2620 RelocInfo::CODE_TARGET); |
2608 } | 2621 } |
2609 | 2622 |
2610 | 2623 |
2611 // static | 2624 // static |
2612 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 2625 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
2613 // ----------- S t a t e ------------- | 2626 // ----------- S t a t e ------------- |
2614 // -- x0 : argument count (not including receiver) | 2627 // -- x0 : argument count (not including receiver) |
2615 // -- x3 : new target | 2628 // -- x3 : new target |
2616 // -- x1 : constructor to call | 2629 // -- x1 : constructor to call |
2617 // -- x2 : address of the first argument | 2630 // -- x2 : address of the first argument |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2814 } | 2827 } |
2815 } | 2828 } |
2816 | 2829 |
2817 | 2830 |
2818 #undef __ | 2831 #undef __ |
2819 | 2832 |
2820 } // namespace internal | 2833 } // namespace internal |
2821 } // namespace v8 | 2834 } // namespace v8 |
2822 | 2835 |
2823 #endif // V8_TARGET_ARCH_ARM | 2836 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |