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

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

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