OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3443 __ bind(&throw_termination_exception); | 3443 __ bind(&throw_termination_exception); |
3444 GenerateThrowUncatchable(masm, TERMINATION); | 3444 GenerateThrowUncatchable(masm, TERMINATION); |
3445 | 3445 |
3446 __ bind(&throw_normal_exception); | 3446 __ bind(&throw_normal_exception); |
3447 GenerateThrowTOS(masm); | 3447 GenerateThrowTOS(masm); |
3448 } | 3448 } |
3449 | 3449 |
3450 | 3450 |
3451 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { | 3451 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
3452 Label invoke, exit; | 3452 Label invoke, exit; |
3453 #ifdef ENABLE_LOGGING_AND_PROFILING | |
3454 Label not_outermost_js, not_outermost_js_2; | 3453 Label not_outermost_js, not_outermost_js_2; |
3455 #endif | |
3456 { // NOLINT. Scope block confuses linter. | 3454 { // NOLINT. Scope block confuses linter. |
3457 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm); | 3455 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm); |
3458 // Setup frame. | 3456 // Setup frame. |
3459 __ push(rbp); | 3457 __ push(rbp); |
3460 __ movq(rbp, rsp); | 3458 __ movq(rbp, rsp); |
3461 | 3459 |
3462 // Push the stack frame type marker twice. | 3460 // Push the stack frame type marker twice. |
3463 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; | 3461 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; |
3464 // Scratch register is neither callee-save, nor an argument register on any | 3462 // Scratch register is neither callee-save, nor an argument register on any |
3465 // platform. It's free to use at this point. | 3463 // platform. It's free to use at this point. |
(...skipping 24 matching lines...) Expand all Loading... |
3490 | 3488 |
3491 Isolate* isolate = masm->isolate(); | 3489 Isolate* isolate = masm->isolate(); |
3492 | 3490 |
3493 // Save copies of the top frame descriptor on the stack. | 3491 // Save copies of the top frame descriptor on the stack. |
3494 ExternalReference c_entry_fp(Isolate::k_c_entry_fp_address, isolate); | 3492 ExternalReference c_entry_fp(Isolate::k_c_entry_fp_address, isolate); |
3495 { | 3493 { |
3496 Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); | 3494 Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); |
3497 __ push(c_entry_fp_operand); | 3495 __ push(c_entry_fp_operand); |
3498 } | 3496 } |
3499 | 3497 |
3500 #ifdef ENABLE_LOGGING_AND_PROFILING | |
3501 // If this is the outermost JS call, set js_entry_sp value. | 3498 // If this is the outermost JS call, set js_entry_sp value. |
3502 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, isolate); | 3499 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, isolate); |
3503 __ Load(rax, js_entry_sp); | 3500 __ Load(rax, js_entry_sp); |
3504 __ testq(rax, rax); | 3501 __ testq(rax, rax); |
3505 __ j(not_zero, ¬_outermost_js); | 3502 __ j(not_zero, ¬_outermost_js); |
3506 __ Push(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)); | 3503 __ Push(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)); |
3507 __ movq(rax, rbp); | 3504 __ movq(rax, rbp); |
3508 __ Store(js_entry_sp, rax); | 3505 __ Store(js_entry_sp, rax); |
3509 Label cont; | 3506 Label cont; |
3510 __ jmp(&cont); | 3507 __ jmp(&cont); |
3511 __ bind(¬_outermost_js); | 3508 __ bind(¬_outermost_js); |
3512 __ Push(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME)); | 3509 __ Push(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME)); |
3513 __ bind(&cont); | 3510 __ bind(&cont); |
3514 #endif | |
3515 | 3511 |
3516 // Call a faked try-block that does the invoke. | 3512 // Call a faked try-block that does the invoke. |
3517 __ call(&invoke); | 3513 __ call(&invoke); |
3518 | 3514 |
3519 // Caught exception: Store result (exception) in the pending | 3515 // Caught exception: Store result (exception) in the pending |
3520 // exception field in the JSEnv and return a failure sentinel. | 3516 // exception field in the JSEnv and return a failure sentinel. |
3521 ExternalReference pending_exception(Isolate::k_pending_exception_address, | 3517 ExternalReference pending_exception(Isolate::k_pending_exception_address, |
3522 isolate); | 3518 isolate); |
3523 __ Store(pending_exception, rax); | 3519 __ Store(pending_exception, rax); |
3524 __ movq(rax, Failure::Exception(), RelocInfo::NONE); | 3520 __ movq(rax, Failure::Exception(), RelocInfo::NONE); |
(...skipping 23 matching lines...) Expand all Loading... |
3548 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate); | 3544 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate); |
3549 __ Load(rax, entry); | 3545 __ Load(rax, entry); |
3550 } | 3546 } |
3551 __ lea(kScratchRegister, FieldOperand(rax, Code::kHeaderSize)); | 3547 __ lea(kScratchRegister, FieldOperand(rax, Code::kHeaderSize)); |
3552 __ call(kScratchRegister); | 3548 __ call(kScratchRegister); |
3553 | 3549 |
3554 // Unlink this frame from the handler chain. | 3550 // Unlink this frame from the handler chain. |
3555 __ PopTryHandler(); | 3551 __ PopTryHandler(); |
3556 | 3552 |
3557 __ bind(&exit); | 3553 __ bind(&exit); |
3558 #ifdef ENABLE_LOGGING_AND_PROFILING | |
3559 // Check if the current stack frame is marked as the outermost JS frame. | 3554 // Check if the current stack frame is marked as the outermost JS frame. |
3560 __ pop(rbx); | 3555 __ pop(rbx); |
3561 __ Cmp(rbx, Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)); | 3556 __ Cmp(rbx, Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)); |
3562 __ j(not_equal, ¬_outermost_js_2); | 3557 __ j(not_equal, ¬_outermost_js_2); |
3563 __ movq(kScratchRegister, js_entry_sp); | 3558 __ movq(kScratchRegister, js_entry_sp); |
3564 __ movq(Operand(kScratchRegister, 0), Immediate(0)); | 3559 __ movq(Operand(kScratchRegister, 0), Immediate(0)); |
3565 __ bind(¬_outermost_js_2); | 3560 __ bind(¬_outermost_js_2); |
3566 #endif | |
3567 | 3561 |
3568 // Restore the top frame descriptor from the stack. | 3562 // Restore the top frame descriptor from the stack. |
3569 { Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); | 3563 { Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); |
3570 __ pop(c_entry_fp_operand); | 3564 __ pop(c_entry_fp_operand); |
3571 } | 3565 } |
3572 | 3566 |
3573 // Restore callee-saved registers (X64 conventions). | 3567 // Restore callee-saved registers (X64 conventions). |
3574 __ pop(rbx); | 3568 __ pop(rbx); |
3575 #ifdef _WIN64 | 3569 #ifdef _WIN64 |
3576 // Callee save on in Win64 ABI, arguments/volatile in AMD64 ABI. | 3570 // Callee save on in Win64 ABI, arguments/volatile in AMD64 ABI. |
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5333 __ Drop(1); | 5327 __ Drop(1); |
5334 __ ret(2 * kPointerSize); | 5328 __ ret(2 * kPointerSize); |
5335 } | 5329 } |
5336 | 5330 |
5337 | 5331 |
5338 #undef __ | 5332 #undef __ |
5339 | 5333 |
5340 } } // namespace v8::internal | 5334 } } // namespace v8::internal |
5341 | 5335 |
5342 #endif // V8_TARGET_ARCH_X64 | 5336 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |