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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2301 __ j(equal, &throw_termination_exception); | 2301 __ j(equal, &throw_termination_exception); |
2302 | 2302 |
2303 // Handle normal exception. | 2303 // Handle normal exception. |
2304 __ Throw(rax); | 2304 __ Throw(rax); |
2305 | 2305 |
2306 __ bind(&throw_termination_exception); | 2306 __ bind(&throw_termination_exception); |
2307 __ ThrowUncatchable(rax); | 2307 __ ThrowUncatchable(rax); |
2308 } | 2308 } |
2309 | 2309 |
2310 | 2310 |
2311 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { | 2311 void JSEntryStub::GenerateBody(MacroAssembler* masm) { |
2312 Label invoke, handler_entry, exit; | 2312 Label invoke, handler_entry, exit; |
2313 Label not_outermost_js, not_outermost_js_2; | 2313 Label not_outermost_js, not_outermost_js_2; |
2314 | 2314 |
2315 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 2315 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
2316 | 2316 |
2317 { // NOLINT. Scope block confuses linter. | 2317 { // NOLINT. Scope block confuses linter. |
2318 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm); | 2318 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm); |
2319 // Set up frame. | 2319 // Set up frame. |
2320 __ pushq(rbp); | 2320 __ pushq(rbp); |
2321 __ movp(rbp, rsp); | 2321 __ movp(rbp, rsp); |
2322 | 2322 |
2323 // Push the stack frame type marker twice. | 2323 // Push the stack frame type marker twice. |
2324 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; | 2324 int marker = type_(); |
2325 // Scratch register is neither callee-save, nor an argument register on any | 2325 // Scratch register is neither callee-save, nor an argument register on any |
2326 // platform. It's free to use at this point. | 2326 // platform. It's free to use at this point. |
2327 // Cannot use smi-register for loading yet. | 2327 // Cannot use smi-register for loading yet. |
2328 __ Move(kScratchRegister, Smi::FromInt(marker), Assembler::RelocInfoNone()); | 2328 __ Move(kScratchRegister, Smi::FromInt(marker), Assembler::RelocInfoNone()); |
2329 __ Push(kScratchRegister); // context slot | 2329 __ Push(kScratchRegister); // context slot |
2330 __ Push(kScratchRegister); // function slot | 2330 __ Push(kScratchRegister); // function slot |
2331 // Save callee-saved registers (X64/X32/Win64 calling conventions). | 2331 // Save callee-saved registers (X64/X32/Win64 calling conventions). |
2332 __ pushq(r12); | 2332 __ pushq(r12); |
2333 __ pushq(r13); | 2333 __ pushq(r13); |
2334 __ pushq(r14); | 2334 __ pushq(r14); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2404 __ Store(pending_exception, rax); | 2404 __ Store(pending_exception, rax); |
2405 | 2405 |
2406 // Fake a receiver (NULL). | 2406 // Fake a receiver (NULL). |
2407 __ Push(Immediate(0)); // receiver | 2407 __ Push(Immediate(0)); // receiver |
2408 | 2408 |
2409 // Invoke the function by calling through JS entry trampoline builtin and | 2409 // Invoke the function by calling through JS entry trampoline builtin and |
2410 // pop the faked function when we return. We load the address from an | 2410 // pop the faked function when we return. We load the address from an |
2411 // external reference instead of inlining the call target address directly | 2411 // external reference instead of inlining the call target address directly |
2412 // in the code, because the builtin stubs may not have been generated yet | 2412 // in the code, because the builtin stubs may not have been generated yet |
2413 // at the time this code is generated. | 2413 // at the time this code is generated. |
2414 if (is_construct) { | 2414 if (type() == StackFrame::ENTRY_CONSTRUCT) { |
2415 ExternalReference construct_entry(Builtins::kJSConstructEntryTrampoline, | 2415 ExternalReference construct_entry(Builtins::kJSConstructEntryTrampoline, |
2416 isolate()); | 2416 isolate()); |
2417 __ Load(rax, construct_entry); | 2417 __ Load(rax, construct_entry); |
2418 } else { | 2418 } else { |
2419 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate()); | 2419 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate()); |
2420 __ Load(rax, entry); | 2420 __ Load(rax, entry); |
2421 } | 2421 } |
2422 __ leap(kScratchRegister, FieldOperand(rax, Code::kHeaderSize)); | 2422 __ leap(kScratchRegister, FieldOperand(rax, Code::kHeaderSize)); |
2423 __ call(kScratchRegister); | 2423 __ call(kScratchRegister); |
2424 | 2424 |
(...skipping 2223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4648 return_value_operand, | 4648 return_value_operand, |
4649 NULL); | 4649 NULL); |
4650 } | 4650 } |
4651 | 4651 |
4652 | 4652 |
4653 #undef __ | 4653 #undef __ |
4654 | 4654 |
4655 } } // namespace v8::internal | 4655 } } // namespace v8::internal |
4656 | 4656 |
4657 #endif // V8_TARGET_ARCH_X64 | 4657 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |