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

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

Issue 1923523002: Version 5.1.281.18 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@5.1
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 | « src/ia32/code-stubs-ia32.cc ('k') | src/mips64/code-stubs-mips64.cc » ('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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 DCHECK(!AreAliased(t0, t1, LoadWithVectorDescriptor::VectorRegister(), 1595 DCHECK(!AreAliased(t0, t1, LoadWithVectorDescriptor::VectorRegister(),
1596 LoadWithVectorDescriptor::SlotRegister())); 1596 LoadWithVectorDescriptor::SlotRegister()));
1597 1597
1598 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, t0, 1598 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, t0,
1599 t1, &miss); 1599 t1, &miss);
1600 __ bind(&miss); 1600 __ bind(&miss);
1601 PropertyAccessCompiler::TailCallBuiltin( 1601 PropertyAccessCompiler::TailCallBuiltin(
1602 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); 1602 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC));
1603 } 1603 }
1604 1604
1605
1606 void RegExpExecStub::Generate(MacroAssembler* masm) { 1605 void RegExpExecStub::Generate(MacroAssembler* masm) {
1607 // Just jump directly to runtime if native RegExp is not selected at compile 1606 // Just jump directly to runtime if native RegExp is not selected at compile
1608 // time or if regexp entry in generated code is turned off runtime switch or 1607 // time or if regexp entry in generated code is turned off runtime switch or
1609 // at compilation. 1608 // at compilation.
1610 #ifdef V8_INTERPRETED_REGEXP 1609 #ifdef V8_INTERPRETED_REGEXP
1611 __ TailCallRuntime(Runtime::kRegExpExec); 1610 __ TailCallRuntime(Runtime::kRegExpExec);
1612 #else // V8_INTERPRETED_REGEXP 1611 #else // V8_INTERPRETED_REGEXP
1613 1612
1614 // Stack frame on entry. 1613 // Stack frame on entry.
1615 // sp[0]: last_match_info (expected JSArray) 1614 // sp[0]: last_match_info (expected JSArray)
(...skipping 12 matching lines...) Expand all
1628 // this code is called using the normal C calling convention. When calling 1627 // this code is called using the normal C calling convention. When calling
1629 // directly from generated code the native RegExp code will not do a GC and 1628 // directly from generated code the native RegExp code will not do a GC and
1630 // therefore the content of these registers are safe to use after the call. 1629 // therefore the content of these registers are safe to use after the call.
1631 // MIPS - using s0..s2, since we are not using CEntry Stub. 1630 // MIPS - using s0..s2, since we are not using CEntry Stub.
1632 Register subject = s0; 1631 Register subject = s0;
1633 Register regexp_data = s1; 1632 Register regexp_data = s1;
1634 Register last_match_info_elements = s2; 1633 Register last_match_info_elements = s2;
1635 1634
1636 // Ensure that a RegExp stack is allocated. 1635 // Ensure that a RegExp stack is allocated.
1637 ExternalReference address_of_regexp_stack_memory_address = 1636 ExternalReference address_of_regexp_stack_memory_address =
1638 ExternalReference::address_of_regexp_stack_memory_address( 1637 ExternalReference::address_of_regexp_stack_memory_address(isolate());
1639 isolate());
1640 ExternalReference address_of_regexp_stack_memory_size = 1638 ExternalReference address_of_regexp_stack_memory_size =
1641 ExternalReference::address_of_regexp_stack_memory_size(isolate()); 1639 ExternalReference::address_of_regexp_stack_memory_size(isolate());
1642 __ li(a0, Operand(address_of_regexp_stack_memory_size)); 1640 __ li(a0, Operand(address_of_regexp_stack_memory_size));
1643 __ lw(a0, MemOperand(a0, 0)); 1641 __ lw(a0, MemOperand(a0, 0));
1644 __ Branch(&runtime, eq, a0, Operand(zero_reg)); 1642 __ Branch(&runtime, eq, a0, Operand(zero_reg));
1645 1643
1646 // Check that the first argument is a JSRegExp object. 1644 // Check that the first argument is a JSRegExp object.
1647 __ lw(a0, MemOperand(sp, kJSRegExpOffset)); 1645 __ lw(a0, MemOperand(sp, kJSRegExpOffset));
1648 STATIC_ASSERT(kSmiTag == 0); 1646 STATIC_ASSERT(kSmiTag == 0);
1649 __ JumpIfSmi(a0, &runtime); 1647 __ JumpIfSmi(a0, &runtime);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 1); 1679 STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 1);
1682 STATIC_ASSERT(Isolate::kJSRegexpStaticOffsetsVectorSize >= 2); 1680 STATIC_ASSERT(Isolate::kJSRegexpStaticOffsetsVectorSize >= 2);
1683 __ Branch( 1681 __ Branch(
1684 &runtime, hi, a2, Operand(Isolate::kJSRegexpStaticOffsetsVectorSize - 2)); 1682 &runtime, hi, a2, Operand(Isolate::kJSRegexpStaticOffsetsVectorSize - 2));
1685 1683
1686 // Reset offset for possibly sliced string. 1684 // Reset offset for possibly sliced string.
1687 __ mov(t0, zero_reg); 1685 __ mov(t0, zero_reg);
1688 __ lw(subject, MemOperand(sp, kSubjectOffset)); 1686 __ lw(subject, MemOperand(sp, kSubjectOffset));
1689 __ JumpIfSmi(subject, &runtime); 1687 __ JumpIfSmi(subject, &runtime);
1690 __ mov(a3, subject); // Make a copy of the original subject string. 1688 __ mov(a3, subject); // Make a copy of the original subject string.
1691 __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
1692 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset));
1693 // subject: subject string 1689 // subject: subject string
1694 // a3: subject string 1690 // a3: subject string
1695 // a0: subject string instance type
1696 // regexp_data: RegExp data (FixedArray) 1691 // regexp_data: RegExp data (FixedArray)
1697 // Handle subject string according to its encoding and representation: 1692 // Handle subject string according to its encoding and representation:
1698 // (1) Sequential string? If yes, go to (5). 1693 // (1) Sequential string? If yes, go to (4).
1699 // (2) Anything but sequential or cons? If yes, go to (6). 1694 // (2) Sequential or cons? If not, go to (5).
1700 // (3) Cons string. If the string is flat, replace subject with first string. 1695 // (3) Cons string. If the string is flat, replace subject with first string
1701 // Otherwise bailout. 1696 // and go to (1). Otherwise bail out to runtime.
1702 // (4) Is subject external? If yes, go to (7). 1697 // (4) Sequential string. Load regexp code according to encoding.
1703 // (5) Sequential string. Load regexp code according to encoding.
1704 // (E) Carry on. 1698 // (E) Carry on.
1705 /// [...] 1699 /// [...]
1706 1700
1707 // Deferred code at the end of the stub: 1701 // Deferred code at the end of the stub:
1708 // (6) Not a long external string? If yes, go to (8). 1702 // (5) Long external string? If not, go to (7).
1709 // (7) External string. Make it, offset-wise, look like a sequential string. 1703 // (6) External string. Make it, offset-wise, look like a sequential string.
1710 // Go to (5). 1704 // Go to (4).
1711 // (8) Short external string or not a string? If yes, bail out to runtime. 1705 // (7) Short external string or not a string? If yes, bail out to runtime.
1712 // (9) Sliced string. Replace subject with parent. Go to (4). 1706 // (8) Sliced string. Replace subject with parent. Go to (1).
1713 1707
1714 Label seq_string /* 5 */, external_string /* 7 */, 1708 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */,
1715 check_underlying /* 4 */, not_seq_nor_cons /* 6 */, 1709 not_seq_nor_cons /* 5 */, not_long_external /* 7 */;
1716 not_long_external /* 8 */;
1717 1710
1718 // (1) Sequential string? If yes, go to (5). 1711 __ bind(&check_underlying);
1712 __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
1713 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset));
1714
1715 // (1) Sequential string? If yes, go to (4).
1719 __ And(a1, 1716 __ And(a1,
1720 a0, 1717 a0,
1721 Operand(kIsNotStringMask | 1718 Operand(kIsNotStringMask |
1722 kStringRepresentationMask | 1719 kStringRepresentationMask |
1723 kShortExternalStringMask)); 1720 kShortExternalStringMask));
1724 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0); 1721 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0);
1725 __ Branch(&seq_string, eq, a1, Operand(zero_reg)); // Go to (5). 1722 __ Branch(&seq_string, eq, a1, Operand(zero_reg)); // Go to (5).
1726 1723
1727 // (2) Anything but sequential or cons? If yes, go to (6). 1724 // (2) Sequential or cons? If not, go to (5).
1728 STATIC_ASSERT(kConsStringTag < kExternalStringTag); 1725 STATIC_ASSERT(kConsStringTag < kExternalStringTag);
1729 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); 1726 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
1730 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); 1727 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag);
1731 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag); 1728 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag);
1732 // Go to (6). 1729 // Go to (5).
1733 __ Branch(&not_seq_nor_cons, ge, a1, Operand(kExternalStringTag)); 1730 __ Branch(&not_seq_nor_cons, ge, a1, Operand(kExternalStringTag));
1734 1731
1735 // (3) Cons string. Check that it's flat. 1732 // (3) Cons string. Check that it's flat.
1736 // Replace subject with first string and reload instance type. 1733 // Replace subject with first string and reload instance type.
1737 __ lw(a0, FieldMemOperand(subject, ConsString::kSecondOffset)); 1734 __ lw(a0, FieldMemOperand(subject, ConsString::kSecondOffset));
1738 __ LoadRoot(a1, Heap::kempty_stringRootIndex); 1735 __ LoadRoot(a1, Heap::kempty_stringRootIndex);
1739 __ Branch(&runtime, ne, a0, Operand(a1)); 1736 __ Branch(&runtime, ne, a0, Operand(a1));
1740 __ lw(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); 1737 __ lw(subject, FieldMemOperand(subject, ConsString::kFirstOffset));
1738 __ jmp(&check_underlying);
1741 1739
1742 // (4) Is subject external? If yes, go to (7). 1740 // (4) Sequential string. Load regexp code according to encoding.
1743 __ bind(&check_underlying);
1744 __ lw(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); 1741 __ bind(&seq_string);
1755 // subject: sequential subject string (or look-alike, external string) 1742 // subject: sequential subject string (or look-alike, external string)
1756 // a3: original subject string 1743 // a3: original subject string
1757 // Load previous index and check range before a3 is overwritten. We have to 1744 // 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 1745 // 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. 1746 // to look like a sequential string when it actually is an external string.
1760 __ lw(a1, MemOperand(sp, kPreviousIndexOffset)); 1747 __ lw(a1, MemOperand(sp, kPreviousIndexOffset));
1761 __ JumpIfNotSmi(a1, &runtime); 1748 __ JumpIfNotSmi(a1, &runtime);
1762 __ lw(a3, FieldMemOperand(a3, String::kLengthOffset)); 1749 __ lw(a3, FieldMemOperand(a3, String::kLengthOffset));
1763 __ Branch(&runtime, ls, a3, Operand(a1)); 1750 __ Branch(&runtime, ls, a3, Operand(a1));
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 1972
1986 // Return last match info. 1973 // Return last match info.
1987 __ lw(v0, MemOperand(sp, kLastMatchInfoOffset)); 1974 __ lw(v0, MemOperand(sp, kLastMatchInfoOffset));
1988 __ DropAndRet(4); 1975 __ DropAndRet(4);
1989 1976
1990 // Do the runtime call to execute the regexp. 1977 // Do the runtime call to execute the regexp.
1991 __ bind(&runtime); 1978 __ bind(&runtime);
1992 __ TailCallRuntime(Runtime::kRegExpExec); 1979 __ TailCallRuntime(Runtime::kRegExpExec);
1993 1980
1994 // Deferred code for string handling. 1981 // Deferred code for string handling.
1995 // (6) Not a long external string? If yes, go to (8). 1982 // (5) Long external string? If not, go to (7).
1996 __ bind(&not_seq_nor_cons); 1983 __ bind(&not_seq_nor_cons);
1997 // Go to (8). 1984 // Go to (7).
1998 __ Branch(&not_long_external, gt, a1, Operand(kExternalStringTag)); 1985 __ Branch(&not_long_external, gt, a1, Operand(kExternalStringTag));
1999 1986
2000 // (7) External string. Make it, offset-wise, look like a sequential string. 1987 // (6) External string. Make it, offset-wise, look like a sequential string.
2001 __ bind(&external_string); 1988 __ bind(&external_string);
2002 __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset)); 1989 __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
2003 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset)); 1990 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset));
2004 if (FLAG_debug_code) { 1991 if (FLAG_debug_code) {
2005 // Assert that we do not have a cons or slice (indirect strings) here. 1992 // Assert that we do not have a cons or slice (indirect strings) here.
2006 // Sequential strings have already been ruled out. 1993 // Sequential strings have already been ruled out.
2007 __ And(at, a0, Operand(kIsIndirectStringMask)); 1994 __ And(at, a0, Operand(kIsIndirectStringMask));
2008 __ Assert(eq, 1995 __ Assert(eq,
2009 kExternalStringExpectedButNotFound, 1996 kExternalStringExpectedButNotFound,
2010 at, 1997 at,
2011 Operand(zero_reg)); 1998 Operand(zero_reg));
2012 } 1999 }
2013 __ lw(subject, 2000 __ lw(subject,
2014 FieldMemOperand(subject, ExternalString::kResourceDataOffset)); 2001 FieldMemOperand(subject, ExternalString::kResourceDataOffset));
2015 // Move the pointer so that offset-wise, it looks like a sequential string. 2002 // Move the pointer so that offset-wise, it looks like a sequential string.
2016 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize); 2003 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize);
2017 __ Subu(subject, 2004 __ Subu(subject,
2018 subject, 2005 subject,
2019 SeqTwoByteString::kHeaderSize - kHeapObjectTag); 2006 SeqTwoByteString::kHeaderSize - kHeapObjectTag);
2020 __ jmp(&seq_string); // Go to (5). 2007 __ jmp(&seq_string); // Go to (5).
2021 2008
2022 // (8) Short external string or not a string? If yes, bail out to runtime. 2009 // (7) Short external string or not a string? If yes, bail out to runtime.
2023 __ bind(&not_long_external); 2010 __ bind(&not_long_external);
2024 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0); 2011 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0);
2025 __ And(at, a1, Operand(kIsNotStringMask | kShortExternalStringMask)); 2012 __ And(at, a1, Operand(kIsNotStringMask | kShortExternalStringMask));
2026 __ Branch(&runtime, ne, at, Operand(zero_reg)); 2013 __ Branch(&runtime, ne, at, Operand(zero_reg));
2027 2014
2028 // (9) Sliced string. Replace subject with parent. Go to (4). 2015 // (8) Sliced string. Replace subject with parent. Go to (4).
2029 // Load offset into t0 and replace subject string with parent. 2016 // Load offset into t0 and replace subject string with parent.
2030 __ lw(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset)); 2017 __ lw(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset));
2031 __ sra(t0, t0, kSmiTagSize); 2018 __ sra(t0, t0, kSmiTagSize);
2032 __ lw(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); 2019 __ lw(subject, FieldMemOperand(subject, SlicedString::kParentOffset));
2033 __ jmp(&check_underlying); // Go to (4). 2020 __ jmp(&check_underlying); // Go to (4).
2034 #endif // V8_INTERPRETED_REGEXP 2021 #endif // V8_INTERPRETED_REGEXP
2035 } 2022 }
2036 2023
2037 2024
2038 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { 2025 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
(...skipping 3688 matching lines...) Expand 10 before | Expand all | Expand 10 after
5727 return_value_operand, NULL); 5714 return_value_operand, NULL);
5728 } 5715 }
5729 5716
5730 5717
5731 #undef __ 5718 #undef __
5732 5719
5733 } // namespace internal 5720 } // namespace internal
5734 } // namespace v8 5721 } // namespace v8
5735 5722
5736 #endif // V8_TARGET_ARCH_MIPS 5723 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698