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

Side by Side Diff: src/ppc/code-stubs-ppc.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/objects.h ('k') | src/s390/code-stubs-s390.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 5 #if V8_TARGET_ARCH_PPC
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 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 __ SmiToShortArrayOffset(r5, r5); 1632 __ SmiToShortArrayOffset(r5, r5);
1633 STATIC_ASSERT(Isolate::kJSRegexpStaticOffsetsVectorSize >= 2); 1633 STATIC_ASSERT(Isolate::kJSRegexpStaticOffsetsVectorSize >= 2);
1634 __ cmpli(r5, Operand(Isolate::kJSRegexpStaticOffsetsVectorSize - 2)); 1634 __ cmpli(r5, Operand(Isolate::kJSRegexpStaticOffsetsVectorSize - 2));
1635 __ bgt(&runtime); 1635 __ bgt(&runtime);
1636 1636
1637 // Reset offset for possibly sliced string. 1637 // Reset offset for possibly sliced string.
1638 __ li(r11, Operand::Zero()); 1638 __ li(r11, Operand::Zero());
1639 __ LoadP(subject, MemOperand(sp, kSubjectOffset)); 1639 __ LoadP(subject, MemOperand(sp, kSubjectOffset));
1640 __ JumpIfSmi(subject, &runtime); 1640 __ JumpIfSmi(subject, &runtime);
1641 __ mr(r6, subject); // Make a copy of the original subject string. 1641 __ mr(r6, subject); // Make a copy of the original subject string.
1642 __ LoadP(r3, FieldMemOperand(subject, HeapObject::kMapOffset));
1643 __ lbz(r3, FieldMemOperand(r3, Map::kInstanceTypeOffset));
1644 // subject: subject string 1642 // subject: subject string
1645 // r6: subject string 1643 // r6: subject string
1646 // r3: subject string instance type
1647 // regexp_data: RegExp data (FixedArray) 1644 // regexp_data: RegExp data (FixedArray)
1648 // Handle subject string according to its encoding and representation: 1645 // Handle subject string according to its encoding and representation:
1649 // (1) Sequential string? If yes, go to (5). 1646 // (1) Sequential string? If yes, go to (4).
1650 // (2) Anything but sequential or cons? If yes, go to (6). 1647 // (2) Sequential or cons? If not, go to (5).
1651 // (3) Cons string. If the string is flat, replace subject with first string. 1648 // (3) Cons string. If the string is flat, replace subject with first string
1652 // Otherwise bailout. 1649 // and go to (1). Otherwise bail out to runtime.
1653 // (4) Is subject external? If yes, go to (7). 1650 // (4) Sequential string. Load regexp code according to encoding.
1654 // (5) Sequential string. Load regexp code according to encoding.
1655 // (E) Carry on. 1651 // (E) Carry on.
1656 /// [...] 1652 /// [...]
1657 1653
1658 // Deferred code at the end of the stub: 1654 // Deferred code at the end of the stub:
1659 // (6) Not a long external string? If yes, go to (8). 1655 // (5) Long external string? If not, go to (7).
1660 // (7) External string. Make it, offset-wise, look like a sequential string. 1656 // (6) External string. Make it, offset-wise, look like a sequential string.
1661 // Go to (5). 1657 // Go to (4).
1662 // (8) Short external string or not a string? If yes, bail out to runtime. 1658 // (7) Short external string or not a string? If yes, bail out to runtime.
1663 // (9) Sliced string. Replace subject with parent. Go to (4). 1659 // (8) Sliced string. Replace subject with parent. Go to (1).
1664 1660
1665 Label seq_string /* 5 */, external_string /* 7 */, check_underlying /* 4 */, 1661 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */,
1666 not_seq_nor_cons /* 6 */, not_long_external /* 8 */; 1662 not_seq_nor_cons /* 5 */, not_long_external /* 7 */;
1667 1663
1668 // (1) Sequential string? If yes, go to (5). 1664 __ bind(&check_underlying);
1665 __ LoadP(r3, FieldMemOperand(subject, HeapObject::kMapOffset));
1666 __ lbz(r3, FieldMemOperand(r3, Map::kInstanceTypeOffset));
1667
1668 // (1) Sequential string? If yes, go to (4).
1669
1669 STATIC_ASSERT((kIsNotStringMask | kStringRepresentationMask | 1670 STATIC_ASSERT((kIsNotStringMask | kStringRepresentationMask |
1670 kShortExternalStringMask) == 0x93); 1671 kShortExternalStringMask) == 0x93);
1671 __ andi(r4, r3, Operand(kIsNotStringMask | kStringRepresentationMask | 1672 __ andi(r4, r3, Operand(kIsNotStringMask | kStringRepresentationMask |
1672 kShortExternalStringMask)); 1673 kShortExternalStringMask));
1673 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0); 1674 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0);
1674 __ beq(&seq_string, cr0); // Go to (5). 1675 __ beq(&seq_string, cr0); // Go to (4).
1675 1676
1676 // (2) Anything but sequential or cons? If yes, go to (6). 1677 // (2) Sequential or cons? If not, go to (5).
1677 STATIC_ASSERT(kConsStringTag < kExternalStringTag); 1678 STATIC_ASSERT(kConsStringTag < kExternalStringTag);
1678 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); 1679 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
1679 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); 1680 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag);
1680 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag); 1681 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag);
1681 STATIC_ASSERT(kExternalStringTag < 0xffffu); 1682 STATIC_ASSERT(kExternalStringTag < 0xffffu);
1682 __ cmpi(r4, Operand(kExternalStringTag)); 1683 __ cmpi(r4, Operand(kExternalStringTag));
1683 __ bge(&not_seq_nor_cons); // Go to (6). 1684 __ bge(&not_seq_nor_cons); // Go to (5).
1684 1685
1685 // (3) Cons string. Check that it's flat. 1686 // (3) Cons string. Check that it's flat.
1686 // Replace subject with first string and reload instance type. 1687 // Replace subject with first string and reload instance type.
1687 __ LoadP(r3, FieldMemOperand(subject, ConsString::kSecondOffset)); 1688 __ LoadP(r3, FieldMemOperand(subject, ConsString::kSecondOffset));
1688 __ CompareRoot(r3, Heap::kempty_stringRootIndex); 1689 __ CompareRoot(r3, Heap::kempty_stringRootIndex);
1689 __ bne(&runtime); 1690 __ bne(&runtime);
1690 __ LoadP(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); 1691 __ LoadP(subject, FieldMemOperand(subject, ConsString::kFirstOffset));
1692 __ b(&check_underlying);
1691 1693
1692 // (4) Is subject external? If yes, go to (7). 1694 // (4) Sequential string. Load regexp code according to encoding.
1693 __ bind(&check_underlying);
1694 __ LoadP(r3, FieldMemOperand(subject, HeapObject::kMapOffset));
1695 __ lbz(r3, FieldMemOperand(r3, Map::kInstanceTypeOffset));
1696 STATIC_ASSERT(kSeqStringTag == 0);
1697 STATIC_ASSERT(kStringRepresentationMask == 3);
1698 __ andi(r0, r3, Operand(kStringRepresentationMask));
1699 // The underlying external string is never a short external string.
1700 STATIC_ASSERT(ExternalString::kMaxShortLength < ConsString::kMinLength);
1701 STATIC_ASSERT(ExternalString::kMaxShortLength < SlicedString::kMinLength);
1702 __ bne(&external_string, cr0); // Go to (7).
1703
1704 // (5) Sequential string. Load regexp code according to encoding.
1705 __ bind(&seq_string); 1695 __ bind(&seq_string);
1706 // subject: sequential subject string (or look-alike, external string) 1696 // subject: sequential subject string (or look-alike, external string)
1707 // r6: original subject string 1697 // r6: original subject string
1708 // Load previous index and check range before r6 is overwritten. We have to 1698 // Load previous index and check range before r6 is overwritten. We have to
1709 // use r6 instead of subject here because subject might have been only made 1699 // use r6 instead of subject here because subject might have been only made
1710 // to look like a sequential string when it actually is an external string. 1700 // to look like a sequential string when it actually is an external string.
1711 __ LoadP(r4, MemOperand(sp, kPreviousIndexOffset)); 1701 __ LoadP(r4, MemOperand(sp, kPreviousIndexOffset));
1712 __ JumpIfNotSmi(r4, &runtime); 1702 __ JumpIfNotSmi(r4, &runtime);
1713 __ LoadP(r6, FieldMemOperand(r6, String::kLengthOffset)); 1703 __ LoadP(r6, FieldMemOperand(r6, String::kLengthOffset));
1714 __ cmpl(r6, r4); 1704 __ cmpl(r6, r4);
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 // Return last match info. 1917 // Return last match info.
1928 __ LoadP(r3, MemOperand(sp, kLastMatchInfoOffset)); 1918 __ LoadP(r3, MemOperand(sp, kLastMatchInfoOffset));
1929 __ addi(sp, sp, Operand(4 * kPointerSize)); 1919 __ addi(sp, sp, Operand(4 * kPointerSize));
1930 __ Ret(); 1920 __ Ret();
1931 1921
1932 // Do the runtime call to execute the regexp. 1922 // Do the runtime call to execute the regexp.
1933 __ bind(&runtime); 1923 __ bind(&runtime);
1934 __ TailCallRuntime(Runtime::kRegExpExec); 1924 __ TailCallRuntime(Runtime::kRegExpExec);
1935 1925
1936 // Deferred code for string handling. 1926 // Deferred code for string handling.
1937 // (6) Not a long external string? If yes, go to (8). 1927 // (5) Long external string? If not, go to (7).
1938 __ bind(&not_seq_nor_cons); 1928 __ bind(&not_seq_nor_cons);
1939 // Compare flags are still set. 1929 // Compare flags are still set.
1940 __ bgt(&not_long_external); // Go to (8). 1930 __ bgt(&not_long_external); // Go to (7).
1941 1931
1942 // (7) External string. Make it, offset-wise, look like a sequential string. 1932 // (6) External string. Make it, offset-wise, look like a sequential string.
1943 __ bind(&external_string); 1933 __ bind(&external_string);
1944 __ LoadP(r3, FieldMemOperand(subject, HeapObject::kMapOffset)); 1934 __ LoadP(r3, FieldMemOperand(subject, HeapObject::kMapOffset));
1945 __ lbz(r3, FieldMemOperand(r3, Map::kInstanceTypeOffset)); 1935 __ lbz(r3, FieldMemOperand(r3, Map::kInstanceTypeOffset));
1946 if (FLAG_debug_code) { 1936 if (FLAG_debug_code) {
1947 // Assert that we do not have a cons or slice (indirect strings) here. 1937 // Assert that we do not have a cons or slice (indirect strings) here.
1948 // Sequential strings have already been ruled out. 1938 // Sequential strings have already been ruled out.
1949 STATIC_ASSERT(kIsIndirectStringMask == 1); 1939 STATIC_ASSERT(kIsIndirectStringMask == 1);
1950 __ andi(r0, r3, Operand(kIsIndirectStringMask)); 1940 __ andi(r0, r3, Operand(kIsIndirectStringMask));
1951 __ Assert(eq, kExternalStringExpectedButNotFound, cr0); 1941 __ Assert(eq, kExternalStringExpectedButNotFound, cr0);
1952 } 1942 }
1953 __ LoadP(subject, 1943 __ LoadP(subject,
1954 FieldMemOperand(subject, ExternalString::kResourceDataOffset)); 1944 FieldMemOperand(subject, ExternalString::kResourceDataOffset));
1955 // Move the pointer so that offset-wise, it looks like a sequential string. 1945 // Move the pointer so that offset-wise, it looks like a sequential string.
1956 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize); 1946 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize);
1957 __ subi(subject, subject, 1947 __ subi(subject, subject,
1958 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); 1948 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag));
1959 __ b(&seq_string); // Go to (5). 1949 __ b(&seq_string); // Go to (4).
1960 1950
1961 // (8) Short external string or not a string? If yes, bail out to runtime. 1951 // (7) Short external string or not a string? If yes, bail out to runtime.
1962 __ bind(&not_long_external); 1952 __ bind(&not_long_external);
1963 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag != 0); 1953 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag != 0);
1964 __ andi(r0, r4, Operand(kIsNotStringMask | kShortExternalStringMask)); 1954 __ andi(r0, r4, Operand(kIsNotStringMask | kShortExternalStringMask));
1965 __ bne(&runtime, cr0); 1955 __ bne(&runtime, cr0);
1966 1956
1967 // (9) Sliced string. Replace subject with parent. Go to (4). 1957 // (8) Sliced string. Replace subject with parent. Go to (4).
1968 // Load offset into r11 and replace subject string with parent. 1958 // Load offset into r11 and replace subject string with parent.
1969 __ LoadP(r11, FieldMemOperand(subject, SlicedString::kOffsetOffset)); 1959 __ LoadP(r11, FieldMemOperand(subject, SlicedString::kOffsetOffset));
1970 __ SmiUntag(r11); 1960 __ SmiUntag(r11);
1971 __ LoadP(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); 1961 __ LoadP(subject, FieldMemOperand(subject, SlicedString::kParentOffset));
1972 __ b(&check_underlying); // Go to (4). 1962 __ b(&check_underlying); // Go to (4).
1973 #endif // V8_INTERPRETED_REGEXP 1963 #endif // V8_INTERPRETED_REGEXP
1974 } 1964 }
1975 1965
1976 1966
1977 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { 1967 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
(...skipping 3809 matching lines...) Expand 10 before | Expand all | Expand 10 after
5787 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5777 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5788 kStackUnwindSpace, NULL, return_value_operand, NULL); 5778 kStackUnwindSpace, NULL, return_value_operand, NULL);
5789 } 5779 }
5790 5780
5791 5781
5792 #undef __ 5782 #undef __
5793 } // namespace internal 5783 } // namespace internal
5794 } // namespace v8 5784 } // namespace v8
5795 5785
5796 #endif // V8_TARGET_ARCH_PPC 5786 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/s390/code-stubs-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698