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_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 2250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2261 save_doubles.GetCode(); | 2261 save_doubles.GetCode(); |
2262 } | 2262 } |
2263 | 2263 |
2264 | 2264 |
2265 void CEntryStub::Generate(MacroAssembler* masm) { | 2265 void CEntryStub::Generate(MacroAssembler* masm) { |
2266 // rax: number of arguments including receiver | 2266 // rax: number of arguments including receiver |
2267 // rbx: pointer to C function (C callee-saved) | 2267 // rbx: pointer to C function (C callee-saved) |
2268 // rbp: frame pointer of calling JS frame (restored after C call) | 2268 // rbp: frame pointer of calling JS frame (restored after C call) |
2269 // rsp: stack pointer (restored after C call) | 2269 // rsp: stack pointer (restored after C call) |
2270 // rsi: current context (restored) | 2270 // rsi: current context (restored) |
| 2271 // |
| 2272 // If argv_in_register(): |
| 2273 // r15: pointer to the first argument |
2271 | 2274 |
2272 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 2275 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
2273 | 2276 |
2274 // Enter the exit frame that transitions from JavaScript to C++. | 2277 // Enter the exit frame that transitions from JavaScript to C++. |
2275 #ifdef _WIN64 | 2278 #ifdef _WIN64 |
2276 int arg_stack_space = (result_size() < 2 ? 2 : 4); | 2279 int arg_stack_space = (result_size() < 2 ? 2 : 4); |
2277 #else // _WIN64 | 2280 #else // _WIN64 |
2278 int arg_stack_space = 0; | 2281 int arg_stack_space = 0; |
2279 #endif // _WIN64 | 2282 #endif // _WIN64 |
2280 __ EnterExitFrame(arg_stack_space, save_doubles()); | 2283 if (argv_in_register()) { |
| 2284 DCHECK(!save_doubles()); |
| 2285 __ EnterApiExitFrame(arg_stack_space); |
| 2286 // Move argc into r14 (argv is already in r15). |
| 2287 __ movp(r14, rax); |
| 2288 } else { |
| 2289 __ EnterExitFrame(arg_stack_space, save_doubles()); |
| 2290 } |
2281 | 2291 |
2282 // rbx: pointer to builtin function (C callee-saved). | 2292 // rbx: pointer to builtin function (C callee-saved). |
2283 // rbp: frame pointer of exit frame (restored after C call). | 2293 // rbp: frame pointer of exit frame (restored after C call). |
2284 // rsp: stack pointer (restored after C call). | 2294 // rsp: stack pointer (restored after C call). |
2285 // r14: number of arguments including receiver (C callee-saved). | 2295 // r14: number of arguments including receiver (C callee-saved). |
2286 // r15: argv pointer (C callee-saved). | 2296 // r15: argv pointer (C callee-saved). |
2287 | 2297 |
2288 // Simple results returned in rax (both AMD64 and Win64 calling conventions). | 2298 // Simple results returned in rax (both AMD64 and Win64 calling conventions). |
2289 // Complex results must be written to address passed as first argument. | 2299 // Complex results must be written to address passed as first argument. |
2290 // AMD64 calling convention: a struct of two pointers in rax+rdx | 2300 // AMD64 calling convention: a struct of two pointers in rax+rdx |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2350 Isolate::kPendingExceptionAddress, isolate()); | 2360 Isolate::kPendingExceptionAddress, isolate()); |
2351 Operand pending_exception_operand = | 2361 Operand pending_exception_operand = |
2352 masm->ExternalOperand(pending_exception_address); | 2362 masm->ExternalOperand(pending_exception_address); |
2353 __ cmpp(r14, pending_exception_operand); | 2363 __ cmpp(r14, pending_exception_operand); |
2354 __ j(equal, &okay, Label::kNear); | 2364 __ j(equal, &okay, Label::kNear); |
2355 __ int3(); | 2365 __ int3(); |
2356 __ bind(&okay); | 2366 __ bind(&okay); |
2357 } | 2367 } |
2358 | 2368 |
2359 // Exit the JavaScript to C++ exit frame. | 2369 // Exit the JavaScript to C++ exit frame. |
2360 __ LeaveExitFrame(save_doubles()); | 2370 __ LeaveExitFrame(save_doubles(), !argv_in_register()); |
2361 __ ret(0); | 2371 __ ret(0); |
2362 | 2372 |
2363 // Handling of exception. | 2373 // Handling of exception. |
2364 __ bind(&exception_returned); | 2374 __ bind(&exception_returned); |
2365 | 2375 |
2366 ExternalReference pending_handler_context_address( | 2376 ExternalReference pending_handler_context_address( |
2367 Isolate::kPendingHandlerContextAddress, isolate()); | 2377 Isolate::kPendingHandlerContextAddress, isolate()); |
2368 ExternalReference pending_handler_code_address( | 2378 ExternalReference pending_handler_code_address( |
2369 Isolate::kPendingHandlerCodeAddress, isolate()); | 2379 Isolate::kPendingHandlerCodeAddress, isolate()); |
2370 ExternalReference pending_handler_offset_address( | 2380 ExternalReference pending_handler_offset_address( |
(...skipping 3195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5566 kStackSpace, nullptr, return_value_operand, NULL); | 5576 kStackSpace, nullptr, return_value_operand, NULL); |
5567 } | 5577 } |
5568 | 5578 |
5569 | 5579 |
5570 #undef __ | 5580 #undef __ |
5571 | 5581 |
5572 } // namespace internal | 5582 } // namespace internal |
5573 } // namespace v8 | 5583 } // namespace v8 |
5574 | 5584 |
5575 #endif // V8_TARGET_ARCH_X64 | 5585 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |