Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/mips64/code-stubs-mips64.cc

Issue 2415103002: [regexp] Turn last match info into a simple FixedArray (Closed)
Patch Set: Don't check instance type before map check Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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));
1632 // Check that the object has fast elements. 1631 // 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)); 1632 __ ld(a0, FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset));
1636 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); 1633 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex);
1637 __ Branch(&runtime, ne, a0, Operand(at)); 1634 __ Branch(&runtime, ne, a0, Operand(at));
1638 // Check that the last match info has space for the capture registers and the 1635 // Check that the last match info has space for the capture registers and the
1639 // additional information. 1636 // additional information.
1640 __ ld(a0, 1637 __ ld(a0,
1641 FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset)); 1638 FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset));
1642 __ Daddu(a2, a1, Operand(RegExpImpl::kLastMatchOverhead)); 1639 __ Daddu(a2, a1, Operand(RegExpMatchInfo::kLastMatchOverhead));
1643 1640
1644 __ SmiUntag(at, a0); 1641 __ SmiUntag(at, a0);
1645 __ Branch(&runtime, gt, a2, Operand(at)); 1642 __ Branch(&runtime, gt, a2, Operand(at));
1646 1643
1647 // a1: number of capture registers 1644 // a1: number of capture registers
1648 // subject: subject string 1645 // subject: subject string
1649 // Store the capture count. 1646 // Store the capture count.
1650 __ SmiTag(a2, a1); // To smi. 1647 __ SmiTag(a2, a1); // To smi.
1651 __ sd(a2, FieldMemOperand(last_match_info_elements, 1648 __ sd(a2, FieldMemOperand(last_match_info_elements,
1652 RegExpImpl::kLastCaptureCountOffset)); 1649 RegExpMatchInfo::kNumberOfCapturesOffset));
1653 // Store last subject and last input. 1650 // Store last subject and last input.
1654 __ sd(subject, 1651 __ sd(subject, FieldMemOperand(last_match_info_elements,
1655 FieldMemOperand(last_match_info_elements, 1652 RegExpMatchInfo::kLastSubjectOffset));
1656 RegExpImpl::kLastSubjectOffset));
1657 __ mov(a2, subject); 1653 __ mov(a2, subject);
1658 __ RecordWriteField(last_match_info_elements, 1654 __ RecordWriteField(last_match_info_elements,
1659 RegExpImpl::kLastSubjectOffset, 1655 RegExpMatchInfo::kLastSubjectOffset, subject, a7,
1660 subject, 1656 kRAHasNotBeenSaved, kDontSaveFPRegs);
1661 a7,
1662 kRAHasNotBeenSaved,
1663 kDontSaveFPRegs);
1664 __ mov(subject, a2); 1657 __ mov(subject, a2);
1665 __ sd(subject, 1658 __ sd(subject, FieldMemOperand(last_match_info_elements,
1666 FieldMemOperand(last_match_info_elements, 1659 RegExpMatchInfo::kLastInputOffset));
1667 RegExpImpl::kLastInputOffset));
1668 __ RecordWriteField(last_match_info_elements, 1660 __ RecordWriteField(last_match_info_elements,
1669 RegExpImpl::kLastInputOffset, 1661 RegExpMatchInfo::kLastInputOffset, subject, a7,
1670 subject, 1662 kRAHasNotBeenSaved, kDontSaveFPRegs);
1671 a7,
1672 kRAHasNotBeenSaved,
1673 kDontSaveFPRegs);
1674 1663
1675 // Get the static offsets vector filled by the native regexp code. 1664 // Get the static offsets vector filled by the native regexp code.
1676 ExternalReference address_of_static_offsets_vector = 1665 ExternalReference address_of_static_offsets_vector =
1677 ExternalReference::address_of_static_offsets_vector(isolate()); 1666 ExternalReference::address_of_static_offsets_vector(isolate());
1678 __ li(a2, Operand(address_of_static_offsets_vector)); 1667 __ li(a2, Operand(address_of_static_offsets_vector));
1679 1668
1680 // a1: number of capture registers 1669 // a1: number of capture registers
1681 // a2: offsets vector 1670 // a2: offsets vector
1682 Label next_capture, done; 1671 Label next_capture, done;
1683 // Capture register counter starts from number of capture registers and 1672 // Capture register counter starts from number of capture registers and
1684 // counts down until wrapping after zero. 1673 // counts down until wrapping after zero.
1685 __ Daddu(a0, 1674 __ Daddu(a0, last_match_info_elements,
1686 last_match_info_elements, 1675 Operand(RegExpMatchInfo::kFirstCaptureOffset - kHeapObjectTag));
1687 Operand(RegExpImpl::kFirstCaptureOffset - kHeapObjectTag));
1688 __ bind(&next_capture); 1676 __ bind(&next_capture);
1689 __ Dsubu(a1, a1, Operand(1)); 1677 __ Dsubu(a1, a1, Operand(1));
1690 __ Branch(&done, lt, a1, Operand(zero_reg)); 1678 __ Branch(&done, lt, a1, Operand(zero_reg));
1691 // Read the value from the static offsets vector buffer. 1679 // Read the value from the static offsets vector buffer.
1692 __ lw(a3, MemOperand(a2, 0)); 1680 __ lw(a3, MemOperand(a2, 0));
1693 __ daddiu(a2, a2, kIntSize); 1681 __ daddiu(a2, a2, kIntSize);
1694 // Store the smi value in the last match info. 1682 // Store the smi value in the last match info.
1695 __ SmiTag(a3); 1683 __ SmiTag(a3);
1696 __ sd(a3, MemOperand(a0, 0)); 1684 __ sd(a3, MemOperand(a0, 0));
1697 __ Branch(&next_capture, USE_DELAY_SLOT); 1685 __ Branch(&next_capture, USE_DELAY_SLOT);
1698 __ daddiu(a0, a0, kPointerSize); // In branch delay slot. 1686 __ daddiu(a0, a0, kPointerSize); // In branch delay slot.
1699 1687
1700 __ bind(&done); 1688 __ bind(&done);
1701 1689
1702 // Return last match info. 1690 // Return last match info.
1703 __ ld(v0, MemOperand(sp, kLastMatchInfoOffset)); 1691 __ mov(v0, last_match_info_elements);
1704 __ DropAndRet(4); 1692 __ DropAndRet(4);
1705 1693
1706 // Do the runtime call to execute the regexp. 1694 // Do the runtime call to execute the regexp.
1707 __ bind(&runtime); 1695 __ bind(&runtime);
1708 __ TailCallRuntime(Runtime::kRegExpExec); 1696 __ TailCallRuntime(Runtime::kRegExpExec);
1709 1697
1710 // Deferred code for string handling. 1698 // Deferred code for string handling.
1711 // (5) Long external string? If not, go to (7). 1699 // (5) Long external string? If not, go to (7).
1712 __ bind(&not_seq_nor_cons); 1700 __ bind(&not_seq_nor_cons);
1713 // Go to (7). 1701 // Go to (7).
(...skipping 3168 matching lines...) Expand 10 before | Expand all | Expand 10 after
4882 kStackUnwindSpace, kInvalidStackOffset, 4870 kStackUnwindSpace, kInvalidStackOffset,
4883 return_value_operand, NULL); 4871 return_value_operand, NULL);
4884 } 4872 }
4885 4873
4886 #undef __ 4874 #undef __
4887 4875
4888 } // namespace internal 4876 } // namespace internal
4889 } // namespace v8 4877 } // namespace v8
4890 4878
4891 #endif // V8_TARGET_ARCH_MIPS64 4879 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698