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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 // This is the entry point from C++. 5 arguments are provided in x0-x4. | 1249 // This is the entry point from C++. 5 arguments are provided in x0-x4. |
1250 // See use of the CALL_GENERATED_CODE macro for example in src/execution.cc. | 1250 // See use of the CALL_GENERATED_CODE macro for example in src/execution.cc. |
1251 // Input: | 1251 // Input: |
1252 // x0: code entry. | 1252 // x0: code entry. |
1253 // x1: function. | 1253 // x1: function. |
1254 // x2: receiver. | 1254 // x2: receiver. |
1255 // x3: argc. | 1255 // x3: argc. |
1256 // x4: argv. | 1256 // x4: argv. |
1257 // Output: | 1257 // Output: |
1258 // x0: result. | 1258 // x0: result. |
1259 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { | 1259 void JSEntryStub::Generate(MacroAssembler* masm) { |
1260 DCHECK(jssp.Is(__ StackPointer())); | 1260 DCHECK(jssp.Is(__ StackPointer())); |
1261 Register code_entry = x0; | 1261 Register code_entry = x0; |
1262 | 1262 |
1263 // Enable instruction instrumentation. This only works on the simulator, and | 1263 // Enable instruction instrumentation. This only works on the simulator, and |
1264 // will have no effect on the model or real hardware. | 1264 // will have no effect on the model or real hardware. |
1265 __ EnableInstrumentation(); | 1265 __ EnableInstrumentation(); |
1266 | 1266 |
1267 Label invoke, handler_entry, exit; | 1267 Label invoke, handler_entry, exit; |
1268 | 1268 |
1269 // Push callee-saved registers and synchronize the system stack pointer (csp) | 1269 // Push callee-saved registers and synchronize the system stack pointer (csp) |
(...skipping 10 matching lines...) Expand all Loading... |
1280 // according to AAPCS64. However, we only set default-NaN mode and this will | 1280 // according to AAPCS64. However, we only set default-NaN mode and this will |
1281 // be harmless for most C code. Also, it works for ARM. | 1281 // be harmless for most C code. Also, it works for ARM. |
1282 __ ConfigureFPCR(); | 1282 __ ConfigureFPCR(); |
1283 | 1283 |
1284 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 1284 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
1285 | 1285 |
1286 // Set up the reserved register for 0.0. | 1286 // Set up the reserved register for 0.0. |
1287 __ Fmov(fp_zero, 0.0); | 1287 __ Fmov(fp_zero, 0.0); |
1288 | 1288 |
1289 // Build an entry frame (see layout below). | 1289 // Build an entry frame (see layout below). |
1290 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; | 1290 int marker = type(); |
1291 int64_t bad_frame_pointer = -1L; // Bad frame pointer to fail if it is used. | 1291 int64_t bad_frame_pointer = -1L; // Bad frame pointer to fail if it is used. |
1292 __ Mov(x13, bad_frame_pointer); | 1292 __ Mov(x13, bad_frame_pointer); |
1293 __ Mov(x12, Smi::FromInt(marker)); | 1293 __ Mov(x12, Smi::FromInt(marker)); |
1294 __ Mov(x11, ExternalReference(Isolate::kCEntryFPAddress, isolate())); | 1294 __ Mov(x11, ExternalReference(Isolate::kCEntryFPAddress, isolate())); |
1295 __ Ldr(x10, MemOperand(x11)); | 1295 __ Ldr(x10, MemOperand(x11)); |
1296 | 1296 |
1297 __ Push(x13, xzr, x12, x10); | 1297 __ Push(x13, xzr, x12, x10); |
1298 // Set up fp. | 1298 // Set up fp. |
1299 __ Sub(fp, jssp, EntryFrameConstants::kCallerFPOffset); | 1299 __ Sub(fp, jssp, EntryFrameConstants::kCallerFPOffset); |
1300 | 1300 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1365 // Invoke the function by calling through the JS entry trampoline builtin. | 1365 // Invoke the function by calling through the JS entry trampoline builtin. |
1366 // Notice that we cannot store a reference to the trampoline code directly in | 1366 // Notice that we cannot store a reference to the trampoline code directly in |
1367 // this stub, because runtime stubs are not traversed when doing GC. | 1367 // this stub, because runtime stubs are not traversed when doing GC. |
1368 | 1368 |
1369 // Expected registers by Builtins::JSEntryTrampoline | 1369 // Expected registers by Builtins::JSEntryTrampoline |
1370 // x0: code entry. | 1370 // x0: code entry. |
1371 // x1: function. | 1371 // x1: function. |
1372 // x2: receiver. | 1372 // x2: receiver. |
1373 // x3: argc. | 1373 // x3: argc. |
1374 // x4: argv. | 1374 // x4: argv. |
1375 ExternalReference entry(is_construct ? Builtins::kJSConstructEntryTrampoline | 1375 ExternalReference entry(type() == StackFrame::ENTRY_CONSTRUCT |
1376 : Builtins::kJSEntryTrampoline, | 1376 ? Builtins::kJSConstructEntryTrampoline |
| 1377 : Builtins::kJSEntryTrampoline, |
1377 isolate()); | 1378 isolate()); |
1378 __ Mov(x10, entry); | 1379 __ Mov(x10, entry); |
1379 | 1380 |
1380 // Call the JSEntryTrampoline. | 1381 // Call the JSEntryTrampoline. |
1381 __ Ldr(x11, MemOperand(x10)); // Dereference the address. | 1382 __ Ldr(x11, MemOperand(x10)); // Dereference the address. |
1382 __ Add(x12, x11, Code::kHeaderSize - kHeapObjectTag); | 1383 __ Add(x12, x11, Code::kHeaderSize - kHeapObjectTag); |
1383 __ Blr(x12); | 1384 __ Blr(x12); |
1384 | 1385 |
1385 // Unlink this frame from the handler chain. | 1386 // Unlink this frame from the handler chain. |
1386 __ PopTryHandler(); | 1387 __ PopTryHandler(); |
(...skipping 3666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5053 MemOperand(fp, 6 * kPointerSize), | 5054 MemOperand(fp, 6 * kPointerSize), |
5054 NULL); | 5055 NULL); |
5055 } | 5056 } |
5056 | 5057 |
5057 | 5058 |
5058 #undef __ | 5059 #undef __ |
5059 | 5060 |
5060 } } // namespace v8::internal | 5061 } } // namespace v8::internal |
5061 | 5062 |
5062 #endif // V8_TARGET_ARCH_ARM64 | 5063 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |