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 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 RegExpImpl::kFirstCaptureOffset), | 1567 RegExpImpl::kFirstCaptureOffset), |
1568 rdi); | 1568 rdi); |
1569 __ jmp(&next_capture); | 1569 __ jmp(&next_capture); |
1570 __ bind(&done); | 1570 __ bind(&done); |
1571 | 1571 |
1572 // Return last match info. | 1572 // Return last match info. |
1573 __ movp(rax, r15); | 1573 __ movp(rax, r15); |
1574 __ ret(REG_EXP_EXEC_ARGUMENT_COUNT * kPointerSize); | 1574 __ ret(REG_EXP_EXEC_ARGUMENT_COUNT * kPointerSize); |
1575 | 1575 |
1576 __ bind(&exception); | 1576 __ bind(&exception); |
1577 // Result must now be exception. | 1577 // Result must now be exception. If there is no pending exception already a |
| 1578 // stack overflow (on the backtrack stack) was detected in RegExp code but |
| 1579 // haven't created the exception yet. Handle that in the runtime system. |
| 1580 // TODO(592): Rerunning the RegExp to get the stack overflow exception. |
1578 ExternalReference pending_exception_address( | 1581 ExternalReference pending_exception_address( |
1579 Isolate::kPendingExceptionAddress, isolate()); | 1582 Isolate::kPendingExceptionAddress, isolate()); |
1580 Operand pending_exception_operand = | 1583 Operand pending_exception_operand = |
1581 masm->ExternalOperand(pending_exception_address, rbx); | 1584 masm->ExternalOperand(pending_exception_address, rbx); |
| 1585 __ movp(rax, pending_exception_operand); |
1582 __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex); | 1586 __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex); |
1583 __ movp(rax, pending_exception_operand); | 1587 __ cmpp(rax, rdx); |
1584 __ movp(pending_exception_operand, rdx); // Clear pending exception. | 1588 __ j(equal, &runtime); |
| 1589 __ movp(pending_exception_operand, rdx); |
1585 | 1590 |
1586 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex); | 1591 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex); |
1587 Label termination_exception; | 1592 Label termination_exception; |
1588 __ j(equal, &termination_exception, Label::kNear); | 1593 __ j(equal, &termination_exception, Label::kNear); |
1589 __ Throw(rax); | 1594 __ Throw(rax); |
1590 | 1595 |
1591 __ bind(&termination_exception); | 1596 __ bind(&termination_exception); |
1592 __ ThrowUncatchable(rax); | 1597 __ ThrowUncatchable(rax); |
1593 | 1598 |
1594 // Do the runtime call to execute the regexp. | 1599 // Do the runtime call to execute the regexp. |
(...skipping 3341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4936 return_value_operand, | 4941 return_value_operand, |
4937 NULL); | 4942 NULL); |
4938 } | 4943 } |
4939 | 4944 |
4940 | 4945 |
4941 #undef __ | 4946 #undef __ |
4942 | 4947 |
4943 } } // namespace v8::internal | 4948 } } // namespace v8::internal |
4944 | 4949 |
4945 #endif // V8_TARGET_ARCH_X64 | 4950 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |