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