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 3579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3590 __ j(equal, &failure); | 3590 __ j(equal, &failure); |
3591 __ cmp(eax, NativeRegExpMacroAssembler::EXCEPTION); | 3591 __ cmp(eax, NativeRegExpMacroAssembler::EXCEPTION); |
3592 // If not exception it can only be retry. Handle that in the runtime system. | 3592 // If not exception it can only be retry. Handle that in the runtime system. |
3593 __ j(not_equal, &runtime); | 3593 __ j(not_equal, &runtime); |
3594 // Result must now be exception. If there is no pending exception already a | 3594 // Result must now be exception. If there is no pending exception already a |
3595 // stack overflow (on the backtrack stack) was detected in RegExp code but | 3595 // stack overflow (on the backtrack stack) was detected in RegExp code but |
3596 // haven't created the exception yet. Handle that in the runtime system. | 3596 // haven't created the exception yet. Handle that in the runtime system. |
3597 // TODO(592): Rerunning the RegExp to get the stack overflow exception. | 3597 // TODO(592): Rerunning the RegExp to get the stack overflow exception. |
3598 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, | 3598 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, |
3599 masm->isolate()); | 3599 masm->isolate()); |
3600 __ mov(edx, | 3600 __ mov(edx, Immediate(masm->isolate()->factory()->the_hole_value())); |
3601 Operand::StaticVariable(ExternalReference::the_hole_value_location( | |
3602 masm->isolate()))); | |
3603 __ mov(eax, Operand::StaticVariable(pending_exception)); | 3601 __ mov(eax, Operand::StaticVariable(pending_exception)); |
3604 __ cmp(edx, eax); | 3602 __ cmp(edx, eax); |
3605 __ j(equal, &runtime); | 3603 __ j(equal, &runtime); |
3606 // For exception, throw the exception again. | 3604 // For exception, throw the exception again. |
3607 | 3605 |
3608 // Clear the pending exception variable. | 3606 // Clear the pending exception variable. |
3609 __ mov(Operand::StaticVariable(pending_exception), edx); | 3607 __ mov(Operand::StaticVariable(pending_exception), edx); |
3610 | 3608 |
3611 // Special handling of termination exceptions which are uncatchable | 3609 // Special handling of termination exceptions which are uncatchable |
3612 // by javascript code. | 3610 // by javascript code. |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4507 __ test(ecx, Immediate(kFailureTagMask)); | 4505 __ test(ecx, Immediate(kFailureTagMask)); |
4508 __ j(zero, &failure_returned); | 4506 __ j(zero, &failure_returned); |
4509 | 4507 |
4510 ExternalReference pending_exception_address( | 4508 ExternalReference pending_exception_address( |
4511 Isolate::kPendingExceptionAddress, masm->isolate()); | 4509 Isolate::kPendingExceptionAddress, masm->isolate()); |
4512 | 4510 |
4513 // Check that there is no pending exception, otherwise we | 4511 // Check that there is no pending exception, otherwise we |
4514 // should have returned some failure value. | 4512 // should have returned some failure value. |
4515 if (FLAG_debug_code) { | 4513 if (FLAG_debug_code) { |
4516 __ push(edx); | 4514 __ push(edx); |
4517 __ mov(edx, Operand::StaticVariable( | 4515 __ mov(edx, Immediate(masm->isolate()->factory()->the_hole_value())); |
4518 ExternalReference::the_hole_value_location(masm->isolate()))); | |
4519 Label okay; | 4516 Label okay; |
4520 __ cmp(edx, Operand::StaticVariable(pending_exception_address)); | 4517 __ cmp(edx, Operand::StaticVariable(pending_exception_address)); |
4521 // Cannot use check here as it attempts to generate call into runtime. | 4518 // Cannot use check here as it attempts to generate call into runtime. |
4522 __ j(equal, &okay, Label::kNear); | 4519 __ j(equal, &okay, Label::kNear); |
4523 __ int3(); | 4520 __ int3(); |
4524 __ bind(&okay); | 4521 __ bind(&okay); |
4525 __ pop(edx); | 4522 __ pop(edx); |
4526 } | 4523 } |
4527 | 4524 |
4528 // Exit the JavaScript to C++ exit frame. | 4525 // Exit the JavaScript to C++ exit frame. |
4529 __ LeaveExitFrame(save_doubles_ == kSaveFPRegs); | 4526 __ LeaveExitFrame(save_doubles_ == kSaveFPRegs); |
4530 __ ret(0); | 4527 __ ret(0); |
4531 | 4528 |
4532 // Handling of failure. | 4529 // Handling of failure. |
4533 __ bind(&failure_returned); | 4530 __ bind(&failure_returned); |
4534 | 4531 |
4535 Label retry; | 4532 Label retry; |
4536 // If the returned exception is RETRY_AFTER_GC continue at retry label | 4533 // If the returned exception is RETRY_AFTER_GC continue at retry label |
4537 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); | 4534 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); |
4538 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); | 4535 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); |
4539 __ j(zero, &retry, Label::kNear); | 4536 __ j(zero, &retry, Label::kNear); |
4540 | 4537 |
4541 // Special handling of out of memory exceptions. | 4538 // Special handling of out of memory exceptions. |
4542 __ cmp(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException())); | 4539 __ cmp(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException())); |
4543 __ j(equal, throw_out_of_memory_exception); | 4540 __ j(equal, throw_out_of_memory_exception); |
4544 | 4541 |
4545 // Retrieve the pending exception and clear the variable. | 4542 // Retrieve the pending exception and clear the variable. |
4546 ExternalReference the_hole_location = | |
4547 ExternalReference::the_hole_value_location(masm->isolate()); | |
4548 __ mov(eax, Operand::StaticVariable(pending_exception_address)); | 4543 __ mov(eax, Operand::StaticVariable(pending_exception_address)); |
4549 __ mov(edx, Operand::StaticVariable(the_hole_location)); | 4544 __ mov(edx, Immediate(masm->isolate()->factory()->the_hole_value())); |
4550 __ mov(Operand::StaticVariable(pending_exception_address), edx); | 4545 __ mov(Operand::StaticVariable(pending_exception_address), edx); |
4551 | 4546 |
4552 // Special handling of termination exceptions which are uncatchable | 4547 // Special handling of termination exceptions which are uncatchable |
4553 // by javascript code. | 4548 // by javascript code. |
4554 __ cmp(eax, masm->isolate()->factory()->termination_exception()); | 4549 __ cmp(eax, masm->isolate()->factory()->termination_exception()); |
4555 __ j(equal, throw_termination_exception); | 4550 __ j(equal, throw_termination_exception); |
4556 | 4551 |
4557 // Handle normal exception. | 4552 // Handle normal exception. |
4558 __ jmp(throw_normal_exception); | 4553 __ jmp(throw_normal_exception); |
4559 | 4554 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4674 masm->isolate()); | 4669 masm->isolate()); |
4675 __ mov(Operand::StaticVariable(pending_exception), eax); | 4670 __ mov(Operand::StaticVariable(pending_exception), eax); |
4676 __ mov(eax, reinterpret_cast<int32_t>(Failure::Exception())); | 4671 __ mov(eax, reinterpret_cast<int32_t>(Failure::Exception())); |
4677 __ jmp(&exit); | 4672 __ jmp(&exit); |
4678 | 4673 |
4679 // Invoke: Link this frame into the handler chain. | 4674 // Invoke: Link this frame into the handler chain. |
4680 __ bind(&invoke); | 4675 __ bind(&invoke); |
4681 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); | 4676 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); |
4682 | 4677 |
4683 // Clear any pending exceptions. | 4678 // Clear any pending exceptions. |
4684 ExternalReference the_hole_location = | 4679 __ mov(edx, Immediate(masm->isolate()->factory()->the_hole_value())); |
4685 ExternalReference::the_hole_value_location(masm->isolate()); | |
4686 __ mov(edx, Operand::StaticVariable(the_hole_location)); | |
4687 __ mov(Operand::StaticVariable(pending_exception), edx); | 4680 __ mov(Operand::StaticVariable(pending_exception), edx); |
4688 | 4681 |
4689 // Fake a receiver (NULL). | 4682 // Fake a receiver (NULL). |
4690 __ push(Immediate(0)); // receiver | 4683 __ push(Immediate(0)); // receiver |
4691 | 4684 |
4692 // Invoke the function by calling through JS entry trampoline | 4685 // Invoke the function by calling through JS entry trampoline |
4693 // builtin and pop the faked function when we return. Notice that we | 4686 // builtin and pop the faked function when we return. Notice that we |
4694 // cannot store a reference to the trampoline code directly in this | 4687 // cannot store a reference to the trampoline code directly in this |
4695 // stub, because the builtin stubs may not have been generated yet. | 4688 // stub, because the builtin stubs may not have been generated yet. |
4696 if (is_construct) { | 4689 if (is_construct) { |
(...skipping 2230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6927 | 6920 |
6928 // Fall through when we need to inform the incremental marker. | 6921 // Fall through when we need to inform the incremental marker. |
6929 } | 6922 } |
6930 | 6923 |
6931 | 6924 |
6932 #undef __ | 6925 #undef __ |
6933 | 6926 |
6934 } } // namespace v8::internal | 6927 } } // namespace v8::internal |
6935 | 6928 |
6936 #endif // V8_TARGET_ARCH_IA32 | 6929 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |