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 2694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2705 // Return last match info. | 2705 // Return last match info. |
2706 __ movq(rax, Operand(rsp, kLastMatchInfoOffset)); | 2706 __ movq(rax, Operand(rsp, kLastMatchInfoOffset)); |
2707 __ ret(4 * kPointerSize); | 2707 __ ret(4 * kPointerSize); |
2708 | 2708 |
2709 __ bind(&exception); | 2709 __ bind(&exception); |
2710 // Result must now be exception. If there is no pending exception already a | 2710 // Result must now be exception. If there is no pending exception already a |
2711 // stack overflow (on the backtrack stack) was detected in RegExp code but | 2711 // stack overflow (on the backtrack stack) was detected in RegExp code but |
2712 // haven't created the exception yet. Handle that in the runtime system. | 2712 // haven't created the exception yet. Handle that in the runtime system. |
2713 // TODO(592): Rerunning the RegExp to get the stack overflow exception. | 2713 // TODO(592): Rerunning the RegExp to get the stack overflow exception. |
2714 ExternalReference pending_exception_address( | 2714 ExternalReference pending_exception_address( |
2715 Isolate::k_pending_exception_address, isolate); | 2715 Isolate::kPendingExceptionAddress, isolate); |
2716 Operand pending_exception_operand = | 2716 Operand pending_exception_operand = |
2717 masm->ExternalOperand(pending_exception_address, rbx); | 2717 masm->ExternalOperand(pending_exception_address, rbx); |
2718 __ movq(rax, pending_exception_operand); | 2718 __ movq(rax, pending_exception_operand); |
2719 __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex); | 2719 __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex); |
2720 __ cmpq(rax, rdx); | 2720 __ cmpq(rax, rdx); |
2721 __ j(equal, &runtime); | 2721 __ j(equal, &runtime); |
2722 __ movq(pending_exception_operand, rdx); | 2722 __ movq(pending_exception_operand, rdx); |
2723 | 2723 |
2724 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex); | 2724 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex); |
2725 Label termination_exception; | 2725 Label termination_exception; |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3421 __ testl(rax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); | 3421 __ testl(rax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); |
3422 __ j(zero, &retry, Label::kNear); | 3422 __ j(zero, &retry, Label::kNear); |
3423 | 3423 |
3424 // Special handling of out of memory exceptions. | 3424 // Special handling of out of memory exceptions. |
3425 __ movq(kScratchRegister, Failure::OutOfMemoryException(), RelocInfo::NONE); | 3425 __ movq(kScratchRegister, Failure::OutOfMemoryException(), RelocInfo::NONE); |
3426 __ cmpq(rax, kScratchRegister); | 3426 __ cmpq(rax, kScratchRegister); |
3427 __ j(equal, throw_out_of_memory_exception); | 3427 __ j(equal, throw_out_of_memory_exception); |
3428 | 3428 |
3429 // Retrieve the pending exception and clear the variable. | 3429 // Retrieve the pending exception and clear the variable. |
3430 ExternalReference pending_exception_address( | 3430 ExternalReference pending_exception_address( |
3431 Isolate::k_pending_exception_address, masm->isolate()); | 3431 Isolate::kPendingExceptionAddress, masm->isolate()); |
3432 Operand pending_exception_operand = | 3432 Operand pending_exception_operand = |
3433 masm->ExternalOperand(pending_exception_address); | 3433 masm->ExternalOperand(pending_exception_address); |
3434 __ movq(rax, pending_exception_operand); | 3434 __ movq(rax, pending_exception_operand); |
3435 __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex); | 3435 __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex); |
3436 __ movq(pending_exception_operand, rdx); | 3436 __ movq(pending_exception_operand, rdx); |
3437 | 3437 |
3438 // Special handling of termination exceptions which are uncatchable | 3438 // Special handling of termination exceptions which are uncatchable |
3439 // by javascript code. | 3439 // by javascript code. |
3440 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex); | 3440 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex); |
3441 __ j(equal, throw_termination_exception); | 3441 __ j(equal, throw_termination_exception); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3561 | 3561 |
3562 // Set up the roots and smi constant registers. | 3562 // Set up the roots and smi constant registers. |
3563 // Needs to be done before any further smi loads. | 3563 // Needs to be done before any further smi loads. |
3564 __ InitializeSmiConstantRegister(); | 3564 __ InitializeSmiConstantRegister(); |
3565 __ InitializeRootRegister(); | 3565 __ InitializeRootRegister(); |
3566 } | 3566 } |
3567 | 3567 |
3568 Isolate* isolate = masm->isolate(); | 3568 Isolate* isolate = masm->isolate(); |
3569 | 3569 |
3570 // Save copies of the top frame descriptor on the stack. | 3570 // Save copies of the top frame descriptor on the stack. |
3571 ExternalReference c_entry_fp(Isolate::k_c_entry_fp_address, isolate); | 3571 ExternalReference c_entry_fp(Isolate::kCEntryFPAddress, isolate); |
3572 { | 3572 { |
3573 Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); | 3573 Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); |
3574 __ push(c_entry_fp_operand); | 3574 __ push(c_entry_fp_operand); |
3575 } | 3575 } |
3576 | 3576 |
3577 // If this is the outermost JS call, set js_entry_sp value. | 3577 // If this is the outermost JS call, set js_entry_sp value. |
3578 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, isolate); | 3578 ExternalReference js_entry_sp(Isolate::kJSEntrySPAddress, isolate); |
3579 __ Load(rax, js_entry_sp); | 3579 __ Load(rax, js_entry_sp); |
3580 __ testq(rax, rax); | 3580 __ testq(rax, rax); |
3581 __ j(not_zero, ¬_outermost_js); | 3581 __ j(not_zero, ¬_outermost_js); |
3582 __ Push(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)); | 3582 __ Push(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)); |
3583 __ movq(rax, rbp); | 3583 __ movq(rax, rbp); |
3584 __ Store(js_entry_sp, rax); | 3584 __ Store(js_entry_sp, rax); |
3585 Label cont; | 3585 Label cont; |
3586 __ jmp(&cont); | 3586 __ jmp(&cont); |
3587 __ bind(¬_outermost_js); | 3587 __ bind(¬_outermost_js); |
3588 __ Push(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME)); | 3588 __ Push(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME)); |
3589 __ bind(&cont); | 3589 __ bind(&cont); |
3590 | 3590 |
3591 // Call a faked try-block that does the invoke. | 3591 // Call a faked try-block that does the invoke. |
3592 __ call(&invoke); | 3592 __ call(&invoke); |
3593 | 3593 |
3594 // Caught exception: Store result (exception) in the pending | 3594 // Caught exception: Store result (exception) in the pending |
3595 // exception field in the JSEnv and return a failure sentinel. | 3595 // exception field in the JSEnv and return a failure sentinel. |
3596 ExternalReference pending_exception(Isolate::k_pending_exception_address, | 3596 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, |
3597 isolate); | 3597 isolate); |
3598 __ Store(pending_exception, rax); | 3598 __ Store(pending_exception, rax); |
3599 __ movq(rax, Failure::Exception(), RelocInfo::NONE); | 3599 __ movq(rax, Failure::Exception(), RelocInfo::NONE); |
3600 __ jmp(&exit); | 3600 __ jmp(&exit); |
3601 | 3601 |
3602 // Invoke: Link this frame into the handler chain. | 3602 // Invoke: Link this frame into the handler chain. |
3603 __ bind(&invoke); | 3603 __ bind(&invoke); |
3604 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); | 3604 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); |
3605 | 3605 |
3606 // Clear any pending exceptions. | 3606 // Clear any pending exceptions. |
(...skipping 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5473 __ Drop(1); | 5473 __ Drop(1); |
5474 __ ret(2 * kPointerSize); | 5474 __ ret(2 * kPointerSize); |
5475 } | 5475 } |
5476 | 5476 |
5477 | 5477 |
5478 #undef __ | 5478 #undef __ |
5479 | 5479 |
5480 } } // namespace v8::internal | 5480 } } // namespace v8::internal |
5481 | 5481 |
5482 #endif // V8_TARGET_ARCH_X64 | 5482 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |