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 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 // arguments should be consecutive above this, in the same order as | 1182 // arguments should be consecutive above this, in the same order as |
1183 // they are to be pushed onto the stack. | 1183 // they are to be pushed onto the stack. |
1184 // -- r1 : the target to call (can be any Object). | 1184 // -- r1 : the target to call (can be any Object). |
1185 // ----------------------------------- | 1185 // ----------------------------------- |
1186 | 1186 |
1187 // Find the address of the last argument. | 1187 // Find the address of the last argument. |
1188 __ add(r3, r0, Operand(1)); // Add one for receiver. | 1188 __ add(r3, r0, Operand(1)); // Add one for receiver. |
1189 __ mov(r3, Operand(r3, LSL, kPointerSizeLog2)); | 1189 __ mov(r3, Operand(r3, LSL, kPointerSizeLog2)); |
1190 __ sub(r3, r2, r3); | 1190 __ sub(r3, r2, r3); |
1191 | 1191 |
1192 // TODO(mythria): Add a stack check before pushing arguments. | |
1193 // Push the arguments. | 1192 // Push the arguments. |
1194 Generate_InterpreterPushArgs(masm, r2, r3, r4); | 1193 Generate_InterpreterPushArgs(masm, r2, r3, r4); |
1195 | 1194 |
1196 // Call the target. | 1195 // Call the target. |
1197 if (function_type == CallableType::kJSFunction) { | 1196 if (function_type == CallableType::kJSFunction) { |
1198 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, | 1197 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, |
1199 tail_call_mode), | 1198 tail_call_mode), |
1200 RelocInfo::CODE_TARGET); | 1199 RelocInfo::CODE_TARGET); |
1201 } else { | 1200 } else { |
1202 DCHECK_EQ(function_type, CallableType::kAny); | 1201 DCHECK_EQ(function_type, CallableType::kAny); |
1203 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 1202 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
1204 tail_call_mode), | 1203 tail_call_mode), |
1205 RelocInfo::CODE_TARGET); | 1204 RelocInfo::CODE_TARGET); |
1206 } | 1205 } |
1207 } | 1206 } |
1208 | 1207 |
1209 // static | 1208 // static |
1210 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( | 1209 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
1211 MacroAssembler* masm, CallableType construct_type) { | |
1212 // ----------- S t a t e ------------- | 1210 // ----------- S t a t e ------------- |
1213 // -- r0 : argument count (not including receiver) | 1211 // -- r0 : argument count (not including receiver) |
1214 // -- r3 : new target | 1212 // -- r3 : new target |
1215 // -- r1 : constructor to call | 1213 // -- r1 : constructor to call |
1216 // -- r2 : allocation site feedback if available, undefined otherwise. | 1214 // -- r2 : address of the first argument |
1217 // -- r4 : address of the first argument | |
1218 // ----------------------------------- | 1215 // ----------------------------------- |
1219 | 1216 |
1220 // Find the address of the last argument. | 1217 // Find the address of the last argument. |
1221 __ mov(r5, Operand(r0, LSL, kPointerSizeLog2)); | 1218 __ mov(r4, Operand(r0, LSL, kPointerSizeLog2)); |
1222 __ sub(r5, r4, r5); | 1219 __ sub(r4, r2, r4); |
1223 | 1220 |
1224 // Push a slot for the receiver to be constructed. | 1221 // Push a slot for the receiver to be constructed. |
1225 __ mov(ip, Operand::Zero()); | 1222 __ mov(ip, Operand::Zero()); |
1226 __ push(ip); | 1223 __ push(ip); |
1227 | 1224 |
1228 // TODO(mythria): Add a stack check before pushing arguments. | |
1229 // Push the arguments. | 1225 // Push the arguments. |
1230 Generate_InterpreterPushArgs(masm, r4, r5, r6); | 1226 Generate_InterpreterPushArgs(masm, r2, r4, r5); |
1231 | 1227 |
1232 __ AssertUndefinedOrAllocationSite(r2, r5); | 1228 // Call the constructor with r0, r1, and r3 unmodified. |
1233 if (construct_type == CallableType::kJSFunction) { | 1229 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
1234 __ AssertFunction(r1); | |
1235 | |
1236 // Tail call to the function-specific construct stub (still in the caller | |
1237 // context at this point). | |
1238 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | |
1239 __ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kConstructStubOffset)); | |
1240 // Jump to the construct function. | |
1241 __ add(pc, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
1242 | |
1243 } else { | |
1244 DCHECK_EQ(construct_type, CallableType::kAny); | |
1245 // Call the constructor with r0, r1, and r3 unmodified. | |
1246 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | |
1247 } | |
1248 } | 1230 } |
1249 | 1231 |
1250 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { | 1232 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
1251 // Set the return address to the correct point in the interpreter entry | 1233 // Set the return address to the correct point in the interpreter entry |
1252 // trampoline. | 1234 // trampoline. |
1253 Smi* interpreter_entry_return_pc_offset( | 1235 Smi* interpreter_entry_return_pc_offset( |
1254 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); | 1236 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); |
1255 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); | 1237 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); |
1256 __ Move(r2, masm->isolate()->builtins()->InterpreterEntryTrampoline()); | 1238 __ Move(r2, masm->isolate()->builtins()->InterpreterEntryTrampoline()); |
1257 __ add(lr, r2, Operand(interpreter_entry_return_pc_offset->value() + | 1239 __ add(lr, r2, Operand(interpreter_entry_return_pc_offset->value() + |
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2937 __ bkpt(0); | 2919 __ bkpt(0); |
2938 } | 2920 } |
2939 } | 2921 } |
2940 | 2922 |
2941 #undef __ | 2923 #undef __ |
2942 | 2924 |
2943 } // namespace internal | 2925 } // namespace internal |
2944 } // namespace v8 | 2926 } // namespace v8 |
2945 | 2927 |
2946 #endif // V8_TARGET_ARCH_ARM | 2928 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |