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 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 __ bind(&loop_header); | 1097 __ bind(&loop_header); |
1098 __ ldr(scratch, MemOperand(index, -kPointerSize, PostIndex)); | 1098 __ ldr(scratch, MemOperand(index, -kPointerSize, PostIndex)); |
1099 __ push(scratch); | 1099 __ push(scratch); |
1100 __ bind(&loop_check); | 1100 __ bind(&loop_check); |
1101 __ cmp(index, limit); | 1101 __ cmp(index, limit); |
1102 __ b(gt, &loop_header); | 1102 __ b(gt, &loop_header); |
1103 } | 1103 } |
1104 | 1104 |
1105 | 1105 |
1106 // static | 1106 // static |
1107 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { | 1107 void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
| 1108 MacroAssembler* masm, TailCallMode tail_call_mode) { |
1108 // ----------- S t a t e ------------- | 1109 // ----------- S t a t e ------------- |
1109 // -- r0 : the number of arguments (not including the receiver) | 1110 // -- r0 : the number of arguments (not including the receiver) |
1110 // -- r2 : the address of the first argument to be pushed. Subsequent | 1111 // -- r2 : the address of the first argument to be pushed. Subsequent |
1111 // arguments should be consecutive above this, in the same order as | 1112 // arguments should be consecutive above this, in the same order as |
1112 // they are to be pushed onto the stack. | 1113 // they are to be pushed onto the stack. |
1113 // -- r1 : the target to call (can be any Object). | 1114 // -- r1 : the target to call (can be any Object). |
1114 // ----------------------------------- | 1115 // ----------------------------------- |
1115 | 1116 |
1116 // Find the address of the last argument. | 1117 // Find the address of the last argument. |
1117 __ add(r3, r0, Operand(1)); // Add one for receiver. | 1118 __ add(r3, r0, Operand(1)); // Add one for receiver. |
1118 __ mov(r3, Operand(r3, LSL, kPointerSizeLog2)); | 1119 __ mov(r3, Operand(r3, LSL, kPointerSizeLog2)); |
1119 __ sub(r3, r2, r3); | 1120 __ sub(r3, r2, r3); |
1120 | 1121 |
1121 // Push the arguments. | 1122 // Push the arguments. |
1122 Generate_InterpreterPushArgs(masm, r2, r3, r4); | 1123 Generate_InterpreterPushArgs(masm, r2, r3, r4); |
1123 | 1124 |
1124 // Call the target. | 1125 // Call the target. |
1125 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1126 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
| 1127 tail_call_mode), |
| 1128 RelocInfo::CODE_TARGET); |
1126 } | 1129 } |
1127 | 1130 |
1128 | 1131 |
1129 // static | 1132 // static |
1130 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 1133 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
1131 // ----------- S t a t e ------------- | 1134 // ----------- S t a t e ------------- |
1132 // -- r0 : argument count (not including receiver) | 1135 // -- r0 : argument count (not including receiver) |
1133 // -- r3 : new target | 1136 // -- r3 : new target |
1134 // -- r1 : constructor to call | 1137 // -- r1 : constructor to call |
1135 // -- r2 : address of the first argument | 1138 // -- r2 : address of the first argument |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2061 | 2064 |
2062 // Prepare for tail call only if the debugger is not active. | 2065 // Prepare for tail call only if the debugger is not active. |
2063 Label done; | 2066 Label done; |
2064 ExternalReference debug_is_active = | 2067 ExternalReference debug_is_active = |
2065 ExternalReference::debug_is_active_address(masm->isolate()); | 2068 ExternalReference::debug_is_active_address(masm->isolate()); |
2066 __ mov(scratch1, Operand(debug_is_active)); | 2069 __ mov(scratch1, Operand(debug_is_active)); |
2067 __ ldrb(scratch1, MemOperand(scratch1)); | 2070 __ ldrb(scratch1, MemOperand(scratch1)); |
2068 __ cmp(scratch1, Operand(0)); | 2071 __ cmp(scratch1, Operand(0)); |
2069 __ b(ne, &done); | 2072 __ b(ne, &done); |
2070 | 2073 |
| 2074 // Drop possible interpreter handler/stub frame. |
| 2075 { |
| 2076 Label no_interpreter_frame; |
| 2077 __ ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); |
| 2078 __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); |
| 2079 __ b(ne, &no_interpreter_frame); |
| 2080 __ ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 2081 __ bind(&no_interpreter_frame); |
| 2082 } |
| 2083 |
2071 // Check if next frame is an arguments adaptor frame. | 2084 // Check if next frame is an arguments adaptor frame. |
2072 Label no_arguments_adaptor, formal_parameter_count_loaded; | 2085 Label no_arguments_adaptor, formal_parameter_count_loaded; |
2073 __ ldr(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 2086 __ ldr(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
2074 __ ldr(scratch3, | 2087 __ ldr(scratch3, |
2075 MemOperand(scratch2, StandardFrameConstants::kContextOffset)); | 2088 MemOperand(scratch2, StandardFrameConstants::kContextOffset)); |
2076 __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 2089 __ cmp(scratch3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
2077 __ b(ne, &no_arguments_adaptor); | 2090 __ b(ne, &no_arguments_adaptor); |
2078 | 2091 |
2079 // Drop arguments adaptor frame and load arguments count. | 2092 // Drop arguments adaptor frame and load arguments count. |
2080 __ mov(fp, scratch2); | 2093 __ mov(fp, scratch2); |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2681 } | 2694 } |
2682 } | 2695 } |
2683 | 2696 |
2684 | 2697 |
2685 #undef __ | 2698 #undef __ |
2686 | 2699 |
2687 } // namespace internal | 2700 } // namespace internal |
2688 } // namespace v8 | 2701 } // namespace v8 |
2689 | 2702 |
2690 #endif // V8_TARGET_ARCH_ARM | 2703 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |