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

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

Issue 1911633002: S390: [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 | no next file » | 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_S390 5 #if V8_TARGET_ARCH_S390
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 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 __ SmiToShortArrayOffset(r4, r4); 1624 __ SmiToShortArrayOffset(r4, r4);
1625 STATIC_ASSERT(Isolate::kJSRegexpStaticOffsetsVectorSize >= 2); 1625 STATIC_ASSERT(Isolate::kJSRegexpStaticOffsetsVectorSize >= 2);
1626 __ CmpLogicalP(r4, Operand(Isolate::kJSRegexpStaticOffsetsVectorSize - 2)); 1626 __ CmpLogicalP(r4, Operand(Isolate::kJSRegexpStaticOffsetsVectorSize - 2));
1627 __ bgt(&runtime); 1627 __ bgt(&runtime);
1628 1628
1629 // Reset offset for possibly sliced string. 1629 // Reset offset for possibly sliced string.
1630 __ LoadImmP(ip, Operand::Zero()); 1630 __ LoadImmP(ip, Operand::Zero());
1631 __ LoadP(subject, MemOperand(sp, kSubjectOffset)); 1631 __ LoadP(subject, MemOperand(sp, kSubjectOffset));
1632 __ JumpIfSmi(subject, &runtime); 1632 __ JumpIfSmi(subject, &runtime);
1633 __ LoadRR(r5, subject); // Make a copy of the original subject string. 1633 __ LoadRR(r5, subject); // Make a copy of the original subject string.
1634 __ LoadP(r2, FieldMemOperand(subject, HeapObject::kMapOffset));
1635 __ LoadlB(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset));
1636 // subject: subject string 1634 // subject: subject string
1637 // r5: subject string 1635 // r5: subject string
1638 // r2: subject string instance type
1639 // regexp_data: RegExp data (FixedArray) 1636 // regexp_data: RegExp data (FixedArray)
1640 // Handle subject string according to its encoding and representation: 1637 // Handle subject string according to its encoding and representation:
1641 // (1) Sequential string? If yes, go to (5). 1638 // (1) Sequential string? If yes, go to (4).
1642 // (2) Anything but sequential or cons? If yes, go to (6). 1639 // (2) Sequential or cons? If not, go to (5).
1643 // (3) Cons string. If the string is flat, replace subject with first string. 1640 // (3) Cons string. If the string is flat, replace subject with first string
1644 // Otherwise bailout. 1641 // and go to (1). Otherwise bail out to runtime.
1645 // (4) Is subject external? If yes, go to (7). 1642 // (4) Sequential string. Load regexp code according to encoding.
1646 // (5) Sequential string. Load regexp code according to encoding.
1647 // (E) Carry on. 1643 // (E) Carry on.
1648 /// [...] 1644 /// [...]
1649 1645
1650 // Deferred code at the end of the stub: 1646 // Deferred code at the end of the stub:
1651 // (6) Not a long external string? If yes, go to (8). 1647 // (5) Long external string? If not, go to (7).
1652 // (7) External string. Make it, offset-wise, look like a sequential string. 1648 // (6) External string. Make it, offset-wise, look like a sequential string.
1653 // Go to (5). 1649 // Go to (4).
1654 // (8) Short external string or not a string? If yes, bail out to runtime. 1650 // (7) Short external string or not a string? If yes, bail out to runtime.
1655 // (9) Sliced string. Replace subject with parent. Go to (4). 1651 // (8) Sliced string. Replace subject with parent. Go to (1).
1656 1652
1657 Label seq_string /* 5 */, external_string /* 7 */, check_underlying /* 4 */, 1653 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */,
1658 not_seq_nor_cons /* 6 */, not_long_external /* 8 */; 1654 not_seq_nor_cons /* 5 */, not_long_external /* 7 */;
1659 1655
1660 // (1) Sequential string? If yes, go to (5). 1656 __ bind(&check_underlying);
1657 __ LoadP(r2, FieldMemOperand(subject, HeapObject::kMapOffset));
1658 __ LoadlB(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset));
1659
1660 // (1) Sequential string? If yes, go to (4).
1661
1661 STATIC_ASSERT((kIsNotStringMask | kStringRepresentationMask | 1662 STATIC_ASSERT((kIsNotStringMask | kStringRepresentationMask |
1662 kShortExternalStringMask) == 0x93); 1663 kShortExternalStringMask) == 0x93);
1663 __ mov(r3, Operand(kIsNotStringMask | kStringRepresentationMask | 1664 __ mov(r3, Operand(kIsNotStringMask | kStringRepresentationMask |
1664 kShortExternalStringMask)); 1665 kShortExternalStringMask));
1665 __ AndP(r3, r2); 1666 __ AndP(r3, r2);
1666 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0); 1667 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0);
1667 __ beq(&seq_string); // Go to (5). 1668 __ beq(&seq_string, Label::kNear); // Go to (4).
1668 1669
1669 // (2) Anything but sequential or cons? If yes, go to (6). 1670 // (2) Sequential or cons? If not, go to (5).
1670 STATIC_ASSERT(kConsStringTag < kExternalStringTag); 1671 STATIC_ASSERT(kConsStringTag < kExternalStringTag);
1671 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); 1672 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
1672 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); 1673 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag);
1673 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag); 1674 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag);
1674 STATIC_ASSERT(kExternalStringTag < 0xffffu); 1675 STATIC_ASSERT(kExternalStringTag < 0xffffu);
1675 __ CmpP(r3, Operand(kExternalStringTag)); 1676 __ CmpP(r3, Operand(kExternalStringTag));
1676 __ bge(&not_seq_nor_cons); // Go to (6). 1677 __ bge(&not_seq_nor_cons); // Go to (5).
1677 1678
1678 // (3) Cons string. Check that it's flat. 1679 // (3) Cons string. Check that it's flat.
1679 // Replace subject with first string and reload instance type. 1680 // Replace subject with first string and reload instance type.
1680 __ LoadP(r2, FieldMemOperand(subject, ConsString::kSecondOffset)); 1681 __ LoadP(r2, FieldMemOperand(subject, ConsString::kSecondOffset));
1681 __ CompareRoot(r2, Heap::kempty_stringRootIndex); 1682 __ CompareRoot(r2, Heap::kempty_stringRootIndex);
1682 __ bne(&runtime); 1683 __ bne(&runtime);
1683 __ LoadP(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); 1684 __ LoadP(subject, FieldMemOperand(subject, ConsString::kFirstOffset));
1685 __ b(&check_underlying);
1684 1686
1685 // (4) Is subject external? If yes, go to (7). 1687 // (4) Sequential string. Load regexp code according to encoding.
1686 __ bind(&check_underlying);
1687 __ LoadP(r2, FieldMemOperand(subject, HeapObject::kMapOffset));
1688 __ LoadlB(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset));
1689 STATIC_ASSERT(kSeqStringTag == 0);
1690 STATIC_ASSERT(kStringRepresentationMask == 3);
1691 __ tmll(r2, Operand(kStringRepresentationMask));
1692 // The underlying external string is never a short external string.
1693 STATIC_ASSERT(ExternalString::kMaxShortLength < ConsString::kMinLength);
1694 STATIC_ASSERT(ExternalString::kMaxShortLength < SlicedString::kMinLength);
1695 __ bne(&external_string); // Go to (7).
1696
1697 // (5) Sequential string. Load regexp code according to encoding.
1698 __ bind(&seq_string); 1688 __ bind(&seq_string);
1699 // subject: sequential subject string (or look-alike, external string) 1689 // subject: sequential subject string (or look-alike, external string)
1700 // r5: original subject string 1690 // r5: original subject string
1701 // Load previous index and check range before r5 is overwritten. We have to 1691 // Load previous index and check range before r5 is overwritten. We have to
1702 // use r5 instead of subject here because subject might have been only made 1692 // use r5 instead of subject here because subject might have been only made
1703 // to look like a sequential string when it actually is an external string. 1693 // to look like a sequential string when it actually is an external string.
1704 __ LoadP(r3, MemOperand(sp, kPreviousIndexOffset)); 1694 __ LoadP(r3, MemOperand(sp, kPreviousIndexOffset));
1705 __ JumpIfNotSmi(r3, &runtime); 1695 __ JumpIfNotSmi(r3, &runtime);
1706 __ LoadP(r5, FieldMemOperand(r5, String::kLengthOffset)); 1696 __ LoadP(r5, FieldMemOperand(r5, String::kLengthOffset));
1707 __ CmpLogicalP(r5, r3); 1697 __ CmpLogicalP(r5, r3);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1930 // Return last match info. 1920 // Return last match info.
1931 __ LoadP(r2, MemOperand(sp, kLastMatchInfoOffset)); 1921 __ LoadP(r2, MemOperand(sp, kLastMatchInfoOffset));
1932 __ la(sp, MemOperand(sp, (4 * kPointerSize))); 1922 __ la(sp, MemOperand(sp, (4 * kPointerSize)));
1933 __ Ret(); 1923 __ Ret();
1934 1924
1935 // Do the runtime call to execute the regexp. 1925 // Do the runtime call to execute the regexp.
1936 __ bind(&runtime); 1926 __ bind(&runtime);
1937 __ TailCallRuntime(Runtime::kRegExpExec); 1927 __ TailCallRuntime(Runtime::kRegExpExec);
1938 1928
1939 // Deferred code for string handling. 1929 // Deferred code for string handling.
1940 // (6) Not a long external string? If yes, go to (8). 1930 // (5) Long external string? If not, go to (7).
1941 __ bind(&not_seq_nor_cons); 1931 __ bind(&not_seq_nor_cons);
1942 // Compare flags are still set. 1932 // Compare flags are still set.
1943 __ bgt(&not_long_external); // Go to (8). 1933 __ bgt(&not_long_external, Label::kNear); // Go to (7).
1944 1934
1945 // (7) External string. Make it, offset-wise, look like a sequential string. 1935 // (6) External string. Make it, offset-wise, look like a sequential string.
1946 __ bind(&external_string); 1936 __ bind(&external_string);
1947 __ LoadP(r2, FieldMemOperand(subject, HeapObject::kMapOffset)); 1937 __ LoadP(r2, FieldMemOperand(subject, HeapObject::kMapOffset));
1948 __ LoadlB(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); 1938 __ LoadlB(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset));
1949 if (FLAG_debug_code) { 1939 if (FLAG_debug_code) {
1950 // Assert that we do not have a cons or slice (indirect strings) here. 1940 // Assert that we do not have a cons or slice (indirect strings) here.
1951 // Sequential strings have already been ruled out. 1941 // Sequential strings have already been ruled out.
1952 STATIC_ASSERT(kIsIndirectStringMask == 1); 1942 STATIC_ASSERT(kIsIndirectStringMask == 1);
1953 __ tmll(r2, Operand(kIsIndirectStringMask)); 1943 __ tmll(r2, Operand(kIsIndirectStringMask));
1954 __ Assert(eq, kExternalStringExpectedButNotFound, cr0); 1944 __ Assert(eq, kExternalStringExpectedButNotFound, cr0);
1955 } 1945 }
1956 __ LoadP(subject, 1946 __ LoadP(subject,
1957 FieldMemOperand(subject, ExternalString::kResourceDataOffset)); 1947 FieldMemOperand(subject, ExternalString::kResourceDataOffset));
1958 // Move the pointer so that offset-wise, it looks like a sequential string. 1948 // Move the pointer so that offset-wise, it looks like a sequential string.
1959 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize); 1949 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize);
1960 __ SubP(subject, subject, 1950 __ SubP(subject, subject,
1961 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); 1951 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag));
1962 __ b(&seq_string); // Go to (5). 1952 __ b(&seq_string); // Go to (4).
1963 1953
1964 // (8) Short external string or not a string? If yes, bail out to runtime. 1954 // (7) Short external string or not a string? If yes, bail out to runtime.
1965 __ bind(&not_long_external); 1955 __ bind(&not_long_external);
1966 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag != 0); 1956 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag != 0);
1967 __ mov(r0, Operand(kIsNotStringMask | kShortExternalStringMask)); 1957 __ mov(r0, Operand(kIsNotStringMask | kShortExternalStringMask));
1968 __ AndP(r0, r3); 1958 __ AndP(r0, r3);
1969 __ bne(&runtime); 1959 __ bne(&runtime);
1970 1960
1971 // (9) Sliced string. Replace subject with parent. Go to (4). 1961 // (8) Sliced string. Replace subject with parent. Go to (4).
1972 // Load offset into ip and replace subject string with parent. 1962 // Load offset into ip and replace subject string with parent.
1973 __ LoadP(ip, FieldMemOperand(subject, SlicedString::kOffsetOffset)); 1963 __ LoadP(ip, FieldMemOperand(subject, SlicedString::kOffsetOffset));
1974 __ SmiUntag(ip); 1964 __ SmiUntag(ip);
1975 __ LoadP(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); 1965 __ LoadP(subject, FieldMemOperand(subject, SlicedString::kParentOffset));
1976 __ b(&check_underlying); // Go to (4). 1966 __ b(&check_underlying); // Go to (4).
1977 #endif // V8_INTERPRETED_REGEXP 1967 #endif // V8_INTERPRETED_REGEXP
1978 } 1968 }
1979 1969
1980 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { 1970 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
1981 // r2 : number of arguments to the construct function 1971 // r2 : number of arguments to the construct function
(...skipping 3740 matching lines...) Expand 10 before | Expand all | Expand 10 after
5722 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5712 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5723 kStackUnwindSpace, NULL, return_value_operand, NULL); 5713 kStackUnwindSpace, NULL, return_value_operand, NULL);
5724 } 5714 }
5725 5715
5726 #undef __ 5716 #undef __
5727 5717
5728 } // namespace internal 5718 } // namespace internal
5729 } // namespace v8 5719 } // namespace v8
5730 5720
5731 #endif // V8_TARGET_ARCH_S390 5721 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698