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