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

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

Issue 1902393004: MIPS64: [regexp] do not assume short external strings have a minimum size. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | test/cctest/cctest.status » ('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 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 int temp = Isolate::kJSRegexpStaticOffsetsVectorSize / 2 - 1; 1678 int temp = Isolate::kJSRegexpStaticOffsetsVectorSize / 2 - 1;
1679 __ Branch(&runtime, hi, a2, Operand(Smi::FromInt(temp))); 1679 __ Branch(&runtime, hi, a2, Operand(Smi::FromInt(temp)));
1680 1680
1681 // Reset offset for possibly sliced string. 1681 // Reset offset for possibly sliced string.
1682 __ mov(t0, zero_reg); 1682 __ mov(t0, zero_reg);
1683 __ ld(subject, MemOperand(sp, kSubjectOffset)); 1683 __ ld(subject, MemOperand(sp, kSubjectOffset));
1684 __ JumpIfSmi(subject, &runtime); 1684 __ JumpIfSmi(subject, &runtime);
1685 __ mov(a3, subject); // Make a copy of the original subject string. 1685 __ mov(a3, subject); // Make a copy of the original subject string.
1686 __ ld(a0, FieldMemOperand(subject, HeapObject::kMapOffset)); 1686 __ ld(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
1687 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset)); 1687 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset));
1688
1688 // subject: subject string 1689 // subject: subject string
1690 // a0: subject string instance type
1689 // a3: subject string 1691 // a3: subject string
1690 // a0: subject string instance type
1691 // regexp_data: RegExp data (FixedArray) 1692 // regexp_data: RegExp data (FixedArray)
1692 // Handle subject string according to its encoding and representation: 1693 // Handle subject string according to its encoding and representation:
1693 // (1) Sequential string? If yes, go to (5). 1694 // (1) Sequential string? If yes, go to (4).
1694 // (2) Anything but sequential or cons? If yes, go to (6). 1695 // (2) Sequential or cons? If not, go to (5).
1695 // (3) Cons string. If the string is flat, replace subject with first string. 1696 // (3) Cons string. If the string is flat, replace subject with first string
1696 // Otherwise bailout. 1697 // and go to (1). Otherwise bail out to runtime.
1697 // (4) Is subject external? If yes, go to (7). 1698 // (4) Sequential string. Load regexp code according to encoding.
1698 // (5) Sequential string. Load regexp code according to encoding.
1699 // (E) Carry on. 1699 // (E) Carry on.
1700 /// [...] 1700 /// [...]
1701 1701
1702 // Deferred code at the end of the stub: 1702 // Deferred code at the end of the stub:
1703 // (6) Not a long external string? If yes, go to (8). 1703 // (5) Long external string? If not, go to (7).
1704 // (7) External string. Make it, offset-wise, look like a sequential string. 1704 // (6) External string. Make it, offset-wise, look like a sequential string.
1705 // Go to (5). 1705 // Go to (4).
1706 // (8) Short external string or not a string? If yes, bail out to runtime. 1706 // (7) Short external string or not a string? If yes, bail out to runtime.
1707 // (9) Sliced string. Replace subject with parent. Go to (4). 1707 // (8) Sliced string. Replace subject with parent. Go to (1).
1708 1708
1709 Label check_underlying; // (4) 1709 Label check_underlying; // (1)
1710 Label seq_string; // (5) 1710 Label seq_string; // (4)
1711 Label not_seq_nor_cons; // (6) 1711 Label not_seq_nor_cons; // (5)
1712 Label external_string; // (7) 1712 Label external_string; // (6)
1713 Label not_long_external; // (8) 1713 Label not_long_external; // (7)
1714 1714
1715 // (1) Sequential string? If yes, go to (5). 1715 __ bind(&check_underlying);
1716 __ ld(a2, FieldMemOperand(subject, HeapObject::kMapOffset));
1717 __ Daddu(a0, a2, Map::kInstanceTypeOffset);
1718 __ lbu(a0, MemOperand(a0));
1719
1720 // (1) Sequential string? If yes, go to (4).
1716 __ And(a1, 1721 __ And(a1,
1717 a0, 1722 a0,
1718 Operand(kIsNotStringMask | 1723 Operand(kIsNotStringMask |
1719 kStringRepresentationMask | 1724 kStringRepresentationMask |
1720 kShortExternalStringMask)); 1725 kShortExternalStringMask));
1721 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0); 1726 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0);
1722 __ Branch(&seq_string, eq, a1, Operand(zero_reg)); // Go to (5). 1727 __ Branch(&seq_string, eq, a1, Operand(zero_reg)); // Go to (4).
1723 1728
1724 // (2) Anything but sequential or cons? If yes, go to (6). 1729 // (2) Sequential or cons? If not, go to (5).
1725 STATIC_ASSERT(kConsStringTag < kExternalStringTag); 1730 STATIC_ASSERT(kConsStringTag < kExternalStringTag);
1726 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); 1731 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
1727 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); 1732 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag);
1728 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag); 1733 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag);
1729 // Go to (6). 1734 // Go to (5).
1730 __ Branch(&not_seq_nor_cons, ge, a1, Operand(kExternalStringTag)); 1735 __ Branch(&not_seq_nor_cons, ge, a1, Operand(kExternalStringTag));
1731 1736
1732 // (3) Cons string. Check that it's flat. 1737 // (3) Cons string. Check that it's flat.
1733 // Replace subject with first string and reload instance type. 1738 // Replace subject with first string and reload instance type.
1734 __ ld(a0, FieldMemOperand(subject, ConsString::kSecondOffset)); 1739 __ ld(a0, FieldMemOperand(subject, ConsString::kSecondOffset));
1735 __ LoadRoot(a1, Heap::kempty_stringRootIndex); 1740 __ LoadRoot(a1, Heap::kempty_stringRootIndex);
1736 __ Branch(&runtime, ne, a0, Operand(a1)); 1741 __ Branch(&runtime, ne, a0, Operand(a1));
1737 __ ld(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); 1742 __ ld(subject, FieldMemOperand(subject, ConsString::kFirstOffset));
1743 __ jmp(&check_underlying);
1738 1744
1739 // (4) Is subject external? If yes, go to (7). 1745 // (4) Sequential string. Load regexp code according to encoding.
1740 __ bind(&check_underlying);
1741 __ ld(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
1742 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset));
1743 STATIC_ASSERT(kSeqStringTag == 0);
1744 __ And(at, a0, Operand(kStringRepresentationMask));
1745 __ Branch(&external_string, ne, at, Operand(zero_reg)); // Go to (7).
1746
1747 // (5) Sequential string. Load regexp code according to encoding.
1748 __ bind(&seq_string); 1746 __ bind(&seq_string);
1749 // subject: sequential subject string (or look-alike, external string) 1747 // subject: sequential subject string (or look-alike, external string)
1750 // a3: original subject string 1748 // a3: original subject string
1751 // Load previous index and check range before a3 is overwritten. We have to 1749 // Load previous index and check range before a3 is overwritten. We have to
1752 // use a3 instead of subject here because subject might have been only made 1750 // use a3 instead of subject here because subject might have been only made
1753 // to look like a sequential string when it actually is an external string. 1751 // to look like a sequential string when it actually is an external string.
1754 __ ld(a1, MemOperand(sp, kPreviousIndexOffset)); 1752 __ ld(a1, MemOperand(sp, kPreviousIndexOffset));
1755 __ JumpIfNotSmi(a1, &runtime); 1753 __ JumpIfNotSmi(a1, &runtime);
1756 __ ld(a3, FieldMemOperand(a3, String::kLengthOffset)); 1754 __ ld(a3, FieldMemOperand(a3, String::kLengthOffset));
1757 __ Branch(&runtime, ls, a3, Operand(a1)); 1755 __ Branch(&runtime, ls, a3, Operand(a1));
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1980 1978
1981 // Return last match info. 1979 // Return last match info.
1982 __ ld(v0, MemOperand(sp, kLastMatchInfoOffset)); 1980 __ ld(v0, MemOperand(sp, kLastMatchInfoOffset));
1983 __ DropAndRet(4); 1981 __ DropAndRet(4);
1984 1982
1985 // Do the runtime call to execute the regexp. 1983 // Do the runtime call to execute the regexp.
1986 __ bind(&runtime); 1984 __ bind(&runtime);
1987 __ TailCallRuntime(Runtime::kRegExpExec); 1985 __ TailCallRuntime(Runtime::kRegExpExec);
1988 1986
1989 // Deferred code for string handling. 1987 // Deferred code for string handling.
1990 // (6) Not a long external string? If yes, go to (8). 1988 // (5) Long external string? If not, go to (7).
1991 __ bind(&not_seq_nor_cons); 1989 __ bind(&not_seq_nor_cons);
1992 // Go to (8). 1990 // Go to (7).
1993 __ Branch(&not_long_external, gt, a1, Operand(kExternalStringTag)); 1991 __ Branch(&not_long_external, gt, a1, Operand(kExternalStringTag));
1994 1992
1995 // (7) External string. Make it, offset-wise, look like a sequential string. 1993 // (6) External string. Make it, offset-wise, look like a sequential string.
1996 __ bind(&external_string); 1994 __ bind(&external_string);
1997 __ ld(a0, FieldMemOperand(subject, HeapObject::kMapOffset)); 1995 __ ld(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
1998 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset)); 1996 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset));
1999 if (FLAG_debug_code) { 1997 if (FLAG_debug_code) {
2000 // Assert that we do not have a cons or slice (indirect strings) here. 1998 // Assert that we do not have a cons or slice (indirect strings) here.
2001 // Sequential strings have already been ruled out. 1999 // Sequential strings have already been ruled out.
2002 __ And(at, a0, Operand(kIsIndirectStringMask)); 2000 __ And(at, a0, Operand(kIsIndirectStringMask));
2003 __ Assert(eq, 2001 __ Assert(eq,
2004 kExternalStringExpectedButNotFound, 2002 kExternalStringExpectedButNotFound,
2005 at, 2003 at,
2006 Operand(zero_reg)); 2004 Operand(zero_reg));
2007 } 2005 }
2008 __ ld(subject, 2006 __ ld(subject,
2009 FieldMemOperand(subject, ExternalString::kResourceDataOffset)); 2007 FieldMemOperand(subject, ExternalString::kResourceDataOffset));
2010 // Move the pointer so that offset-wise, it looks like a sequential string. 2008 // Move the pointer so that offset-wise, it looks like a sequential string.
2011 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize); 2009 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize);
2012 __ Dsubu(subject, 2010 __ Dsubu(subject,
2013 subject, 2011 subject,
2014 SeqTwoByteString::kHeaderSize - kHeapObjectTag); 2012 SeqTwoByteString::kHeaderSize - kHeapObjectTag);
2015 __ jmp(&seq_string); // Go to (5). 2013 __ jmp(&seq_string); // Go to (4).
2016 2014
2017 // (8) Short external string or not a string? If yes, bail out to runtime. 2015 // (7) Short external string or not a string? If yes, bail out to runtime.
2018 __ bind(&not_long_external); 2016 __ bind(&not_long_external);
2019 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0); 2017 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0);
2020 __ And(at, a1, Operand(kIsNotStringMask | kShortExternalStringMask)); 2018 __ And(at, a1, Operand(kIsNotStringMask | kShortExternalStringMask));
2021 __ Branch(&runtime, ne, at, Operand(zero_reg)); 2019 __ Branch(&runtime, ne, at, Operand(zero_reg));
2022 2020
2023 // (9) Sliced string. Replace subject with parent. Go to (4). 2021 // (8) Sliced string. Replace subject with parent. Go to (4).
2024 // Load offset into t0 and replace subject string with parent. 2022 // Load offset into t0 and replace subject string with parent.
2025 __ ld(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset)); 2023 __ ld(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset));
2026 __ SmiUntag(t0); 2024 __ SmiUntag(t0);
2027 __ ld(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); 2025 __ ld(subject, FieldMemOperand(subject, SlicedString::kParentOffset));
2028 __ jmp(&check_underlying); // Go to (4). 2026 __ jmp(&check_underlying); // Go to (1).
2029 #endif // V8_INTERPRETED_REGEXP 2027 #endif // V8_INTERPRETED_REGEXP
2030 } 2028 }
2031 2029
2032 2030
2033 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { 2031 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
2034 // a0 : number of arguments to the construct function 2032 // a0 : number of arguments to the construct function
2035 // a2 : feedback vector 2033 // a2 : feedback vector
2036 // a3 : slot in feedback vector (Smi) 2034 // a3 : slot in feedback vector (Smi)
2037 // a1 : the function to call 2035 // a1 : the function to call
2038 FrameScope scope(masm, StackFrame::INTERNAL); 2036 FrameScope scope(masm, StackFrame::INTERNAL);
(...skipping 3736 matching lines...) Expand 10 before | Expand all | Expand 10 after
5775 kStackUnwindSpace, kInvalidStackOffset, 5773 kStackUnwindSpace, kInvalidStackOffset,
5776 return_value_operand, NULL); 5774 return_value_operand, NULL);
5777 } 5775 }
5778 5776
5779 #undef __ 5777 #undef __
5780 5778
5781 } // namespace internal 5779 } // namespace internal
5782 } // namespace v8 5780 } // namespace v8
5783 5781
5784 #endif // V8_TARGET_ARCH_MIPS64 5782 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « no previous file | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698