| 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 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 RelocInfo::CODE_TARGET); | 1206 RelocInfo::CODE_TARGET); |
| 1207 } else { | 1207 } else { |
| 1208 DCHECK_EQ(function_type, CallableType::kAny); | 1208 DCHECK_EQ(function_type, CallableType::kAny); |
| 1209 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 1209 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
| 1210 tail_call_mode), | 1210 tail_call_mode), |
| 1211 RelocInfo::CODE_TARGET); | 1211 RelocInfo::CODE_TARGET); |
| 1212 } | 1212 } |
| 1213 } | 1213 } |
| 1214 | 1214 |
| 1215 // static | 1215 // static |
| 1216 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 1216 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( |
| 1217 MacroAssembler* masm, CallableType construct_type) { |
| 1217 // ----------- S t a t e ------------- | 1218 // ----------- S t a t e ------------- |
| 1218 // -- x0 : argument count (not including receiver) | 1219 // -- x0 : argument count (not including receiver) |
| 1219 // -- x3 : new target | 1220 // -- x3 : new target |
| 1220 // -- x1 : constructor to call | 1221 // -- x1 : constructor to call |
| 1221 // -- x2 : address of the first argument | 1222 // -- x2 : allocation site feedback if available, undefined otherwise |
| 1223 // -- x4 : address of the first argument |
| 1222 // ----------------------------------- | 1224 // ----------------------------------- |
| 1223 | 1225 |
| 1224 // Find the address of the last argument. | 1226 // Find the address of the last argument. |
| 1225 __ add(x5, x0, Operand(1)); // Add one for receiver (to be constructed). | 1227 __ add(x5, x0, Operand(1)); // Add one for receiver (to be constructed). |
| 1226 __ lsl(x5, x5, kPointerSizeLog2); | 1228 __ lsl(x5, x5, kPointerSizeLog2); |
| 1227 | 1229 |
| 1228 // Set stack pointer and where to stop. | 1230 // Set stack pointer and where to stop. |
| 1229 __ Mov(x6, jssp); | 1231 __ Mov(x6, jssp); |
| 1230 __ Claim(x5, 1); | 1232 __ Claim(x5, 1); |
| 1231 __ sub(x4, x6, x5); | 1233 __ sub(x7, x6, x5); |
| 1232 | 1234 |
| 1233 // Push a slot for the receiver. | 1235 // Push a slot for the receiver. |
| 1234 __ Str(xzr, MemOperand(x6, -kPointerSize, PreIndex)); | 1236 __ Str(xzr, MemOperand(x6, -kPointerSize, PreIndex)); |
| 1235 | 1237 |
| 1236 Label loop_header, loop_check; | 1238 Label loop_header, loop_check; |
| 1237 // Push the arguments. | 1239 // Push the arguments. |
| 1238 __ B(&loop_check); | 1240 __ B(&loop_check); |
| 1239 __ Bind(&loop_header); | 1241 __ Bind(&loop_header); |
| 1240 // TODO(rmcilroy): Push two at a time once we ensure we keep stack aligned. | 1242 // TODO(rmcilroy): Push two at a time once we ensure we keep stack aligned. |
| 1241 __ Ldr(x5, MemOperand(x2, -kPointerSize, PostIndex)); | 1243 __ Ldr(x5, MemOperand(x4, -kPointerSize, PostIndex)); |
| 1242 __ Str(x5, MemOperand(x6, -kPointerSize, PreIndex)); | 1244 __ Str(x5, MemOperand(x6, -kPointerSize, PreIndex)); |
| 1243 __ Bind(&loop_check); | 1245 __ Bind(&loop_check); |
| 1244 __ Cmp(x6, x4); | 1246 __ Cmp(x6, x7); |
| 1245 __ B(gt, &loop_header); | 1247 __ B(gt, &loop_header); |
| 1246 | 1248 |
| 1247 // Call the constructor with x0, x1, and x3 unmodified. | 1249 __ AssertUndefinedOrAllocationSite(x2, x6); |
| 1248 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 1250 if (construct_type == CallableType::kJSFunction) { |
| 1251 __ AssertFunction(x1); |
| 1252 |
| 1253 // Tail call to the function-specific construct stub (still in the caller |
| 1254 // context at this point). |
| 1255 __ Ldr(x4, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); |
| 1256 __ Ldr(x4, FieldMemOperand(x4, SharedFunctionInfo::kConstructStubOffset)); |
| 1257 __ Add(x4, x4, Code::kHeaderSize - kHeapObjectTag); |
| 1258 __ Br(x4); |
| 1259 } else { |
| 1260 DCHECK_EQ(construct_type, CallableType::kAny); |
| 1261 // Call the constructor with x0, x1, and x3 unmodified. |
| 1262 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
| 1263 } |
| 1249 } | 1264 } |
| 1250 | 1265 |
| 1251 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { | 1266 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
| 1252 // Set the return address to the correct point in the interpreter entry | 1267 // Set the return address to the correct point in the interpreter entry |
| 1253 // trampoline. | 1268 // trampoline. |
| 1254 Smi* interpreter_entry_return_pc_offset( | 1269 Smi* interpreter_entry_return_pc_offset( |
| 1255 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); | 1270 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); |
| 1256 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); | 1271 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); |
| 1257 __ LoadObject(x1, masm->isolate()->builtins()->InterpreterEntryTrampoline()); | 1272 __ LoadObject(x1, masm->isolate()->builtins()->InterpreterEntryTrampoline()); |
| 1258 __ Add(lr, x1, Operand(interpreter_entry_return_pc_offset->value() + | 1273 __ Add(lr, x1, Operand(interpreter_entry_return_pc_offset->value() + |
| (...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3033 __ Unreachable(); | 3048 __ Unreachable(); |
| 3034 } | 3049 } |
| 3035 } | 3050 } |
| 3036 | 3051 |
| 3037 #undef __ | 3052 #undef __ |
| 3038 | 3053 |
| 3039 } // namespace internal | 3054 } // namespace internal |
| 3040 } // namespace v8 | 3055 } // namespace v8 |
| 3041 | 3056 |
| 3042 #endif // V8_TARGET_ARCH_ARM | 3057 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |