OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #if V8_TARGET_ARCH_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 | 1618 |
1619 // Process the result from the native regexp code. | 1619 // Process the result from the native regexp code. |
1620 __ bind(&success); | 1620 __ bind(&success); |
1621 | 1621 |
1622 __ lw(a1, UntagSmiFieldMemOperand( | 1622 __ lw(a1, UntagSmiFieldMemOperand( |
1623 regexp_data, JSRegExp::kIrregexpCaptureCountOffset)); | 1623 regexp_data, JSRegExp::kIrregexpCaptureCountOffset)); |
1624 // Calculate number of capture registers (number_of_captures + 1) * 2. | 1624 // Calculate number of capture registers (number_of_captures + 1) * 2. |
1625 __ Daddu(a1, a1, Operand(1)); | 1625 __ Daddu(a1, a1, Operand(1)); |
1626 __ dsll(a1, a1, 1); // Multiply by 2. | 1626 __ dsll(a1, a1, 1); // Multiply by 2. |
1627 | 1627 |
1628 __ ld(a0, MemOperand(sp, kLastMatchInfoOffset)); | 1628 // Check that the last match info is a FixedArray. |
1629 __ JumpIfSmi(a0, &runtime); | 1629 __ ld(last_match_info_elements, MemOperand(sp, kLastMatchInfoOffset)); |
1630 __ GetObjectType(a0, a2, a2); | 1630 __ JumpIfSmi(last_match_info_elements, &runtime); |
1631 __ Branch(&runtime, ne, a2, Operand(JS_OBJECT_TYPE)); | 1631 __ GetObjectType(last_match_info_elements, a2, a2); |
| 1632 __ Branch(&runtime, ne, a2, Operand(FIXED_ARRAY_TYPE)); |
1632 // Check that the object has fast elements. | 1633 // Check that the object has fast elements. |
1633 __ ld(last_match_info_elements, | |
1634 FieldMemOperand(a0, JSArray::kElementsOffset)); | |
1635 __ ld(a0, FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset)); | 1634 __ ld(a0, FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset)); |
1636 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); | 1635 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); |
1637 __ Branch(&runtime, ne, a0, Operand(at)); | 1636 __ Branch(&runtime, ne, a0, Operand(at)); |
1638 // Check that the last match info has space for the capture registers and the | 1637 // Check that the last match info has space for the capture registers and the |
1639 // additional information. | 1638 // additional information. |
1640 __ ld(a0, | 1639 __ ld(a0, |
1641 FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset)); | 1640 FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset)); |
1642 __ Daddu(a2, a1, Operand(RegExpImpl::kLastMatchOverhead)); | 1641 __ Daddu(a2, a1, Operand(RegExpMatchInfo::kLastMatchOverhead)); |
1643 | 1642 |
1644 __ SmiUntag(at, a0); | 1643 __ SmiUntag(at, a0); |
1645 __ Branch(&runtime, gt, a2, Operand(at)); | 1644 __ Branch(&runtime, gt, a2, Operand(at)); |
1646 | 1645 |
1647 // a1: number of capture registers | 1646 // a1: number of capture registers |
1648 // subject: subject string | 1647 // subject: subject string |
1649 // Store the capture count. | 1648 // Store the capture count. |
1650 __ SmiTag(a2, a1); // To smi. | 1649 __ SmiTag(a2, a1); // To smi. |
1651 __ sd(a2, FieldMemOperand(last_match_info_elements, | 1650 __ sd(a2, FieldMemOperand(last_match_info_elements, |
1652 RegExpImpl::kLastCaptureCountOffset)); | 1651 RegExpMatchInfo::kNumberOfCapturesOffset)); |
1653 // Store last subject and last input. | 1652 // Store last subject and last input. |
1654 __ sd(subject, | 1653 __ sd(subject, FieldMemOperand(last_match_info_elements, |
1655 FieldMemOperand(last_match_info_elements, | 1654 RegExpMatchInfo::kLastSubjectOffset)); |
1656 RegExpImpl::kLastSubjectOffset)); | |
1657 __ mov(a2, subject); | 1655 __ mov(a2, subject); |
1658 __ RecordWriteField(last_match_info_elements, | 1656 __ RecordWriteField(last_match_info_elements, |
1659 RegExpImpl::kLastSubjectOffset, | 1657 RegExpMatchInfo::kLastSubjectOffset, subject, a7, |
1660 subject, | 1658 kRAHasNotBeenSaved, kDontSaveFPRegs); |
1661 a7, | |
1662 kRAHasNotBeenSaved, | |
1663 kDontSaveFPRegs); | |
1664 __ mov(subject, a2); | 1659 __ mov(subject, a2); |
1665 __ sd(subject, | 1660 __ sd(subject, FieldMemOperand(last_match_info_elements, |
1666 FieldMemOperand(last_match_info_elements, | 1661 RegExpMatchInfo::kLastInputOffset)); |
1667 RegExpImpl::kLastInputOffset)); | |
1668 __ RecordWriteField(last_match_info_elements, | 1662 __ RecordWriteField(last_match_info_elements, |
1669 RegExpImpl::kLastInputOffset, | 1663 RegExpMatchInfo::kLastInputOffset, subject, a7, |
1670 subject, | 1664 kRAHasNotBeenSaved, kDontSaveFPRegs); |
1671 a7, | |
1672 kRAHasNotBeenSaved, | |
1673 kDontSaveFPRegs); | |
1674 | 1665 |
1675 // Get the static offsets vector filled by the native regexp code. | 1666 // Get the static offsets vector filled by the native regexp code. |
1676 ExternalReference address_of_static_offsets_vector = | 1667 ExternalReference address_of_static_offsets_vector = |
1677 ExternalReference::address_of_static_offsets_vector(isolate()); | 1668 ExternalReference::address_of_static_offsets_vector(isolate()); |
1678 __ li(a2, Operand(address_of_static_offsets_vector)); | 1669 __ li(a2, Operand(address_of_static_offsets_vector)); |
1679 | 1670 |
1680 // a1: number of capture registers | 1671 // a1: number of capture registers |
1681 // a2: offsets vector | 1672 // a2: offsets vector |
1682 Label next_capture, done; | 1673 Label next_capture, done; |
1683 // Capture register counter starts from number of capture registers and | 1674 // Capture register counter starts from number of capture registers and |
1684 // counts down until wrapping after zero. | 1675 // counts down until wrapping after zero. |
1685 __ Daddu(a0, | 1676 __ Daddu(a0, last_match_info_elements, |
1686 last_match_info_elements, | 1677 Operand(RegExpMatchInfo::kFirstCaptureOffset - kHeapObjectTag)); |
1687 Operand(RegExpImpl::kFirstCaptureOffset - kHeapObjectTag)); | |
1688 __ bind(&next_capture); | 1678 __ bind(&next_capture); |
1689 __ Dsubu(a1, a1, Operand(1)); | 1679 __ Dsubu(a1, a1, Operand(1)); |
1690 __ Branch(&done, lt, a1, Operand(zero_reg)); | 1680 __ Branch(&done, lt, a1, Operand(zero_reg)); |
1691 // Read the value from the static offsets vector buffer. | 1681 // Read the value from the static offsets vector buffer. |
1692 __ lw(a3, MemOperand(a2, 0)); | 1682 __ lw(a3, MemOperand(a2, 0)); |
1693 __ daddiu(a2, a2, kIntSize); | 1683 __ daddiu(a2, a2, kIntSize); |
1694 // Store the smi value in the last match info. | 1684 // Store the smi value in the last match info. |
1695 __ SmiTag(a3); | 1685 __ SmiTag(a3); |
1696 __ sd(a3, MemOperand(a0, 0)); | 1686 __ sd(a3, MemOperand(a0, 0)); |
1697 __ Branch(&next_capture, USE_DELAY_SLOT); | 1687 __ Branch(&next_capture, USE_DELAY_SLOT); |
1698 __ daddiu(a0, a0, kPointerSize); // In branch delay slot. | 1688 __ daddiu(a0, a0, kPointerSize); // In branch delay slot. |
1699 | 1689 |
1700 __ bind(&done); | 1690 __ bind(&done); |
1701 | 1691 |
1702 // Return last match info. | 1692 // Return last match info. |
1703 __ ld(v0, MemOperand(sp, kLastMatchInfoOffset)); | 1693 __ ld(v0, last_match_info_elements); |
1704 __ DropAndRet(4); | 1694 __ DropAndRet(4); |
1705 | 1695 |
1706 // Do the runtime call to execute the regexp. | 1696 // Do the runtime call to execute the regexp. |
1707 __ bind(&runtime); | 1697 __ bind(&runtime); |
1708 __ TailCallRuntime(Runtime::kRegExpExec); | 1698 __ TailCallRuntime(Runtime::kRegExpExec); |
1709 | 1699 |
1710 // Deferred code for string handling. | 1700 // Deferred code for string handling. |
1711 // (5) Long external string? If not, go to (7). | 1701 // (5) Long external string? If not, go to (7). |
1712 __ bind(¬_seq_nor_cons); | 1702 __ bind(¬_seq_nor_cons); |
1713 // Go to (7). | 1703 // Go to (7). |
(...skipping 3168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4882 kStackUnwindSpace, kInvalidStackOffset, | 4872 kStackUnwindSpace, kInvalidStackOffset, |
4883 return_value_operand, NULL); | 4873 return_value_operand, NULL); |
4884 } | 4874 } |
4885 | 4875 |
4886 #undef __ | 4876 #undef __ |
4887 | 4877 |
4888 } // namespace internal | 4878 } // namespace internal |
4889 } // namespace v8 | 4879 } // namespace v8 |
4890 | 4880 |
4891 #endif // V8_TARGET_ARCH_MIPS64 | 4881 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |