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

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

Issue 2415103002: [regexp] Turn last match info into a simple FixedArray (Closed)
Patch Set: Don't check instance type before map check Created 4 years, 2 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/runtime/runtime-strings.cc ('k') | src/x64/code-stubs-x64.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_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 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 // Process the result from the native regexp code. 1579 // Process the result from the native regexp code.
1580 __ bind(&success); 1580 __ bind(&success);
1581 __ LoadP(r3, 1581 __ LoadP(r3,
1582 FieldMemOperand(regexp_data, JSRegExp::kIrregexpCaptureCountOffset)); 1582 FieldMemOperand(regexp_data, JSRegExp::kIrregexpCaptureCountOffset));
1583 // Calculate number of capture registers (number_of_captures + 1) * 2. 1583 // Calculate number of capture registers (number_of_captures + 1) * 2.
1584 // SmiToShortArrayOffset accomplishes the multiplication by 2 and 1584 // SmiToShortArrayOffset accomplishes the multiplication by 2 and
1585 // SmiUntag (which is a nop for 32-bit). 1585 // SmiUntag (which is a nop for 32-bit).
1586 __ SmiToShortArrayOffset(r3, r3); 1586 __ SmiToShortArrayOffset(r3, r3);
1587 __ AddP(r3, Operand(2)); 1587 __ AddP(r3, Operand(2));
1588 1588
1589 __ LoadP(r2, MemOperand(sp, kLastMatchInfoOffset)); 1589 // Check that the last match info is a FixedArray.
1590 __ JumpIfSmi(r2, &runtime); 1590 __ LoadP(last_match_info_elements, MemOperand(sp, kLastMatchInfoOffset));
1591 __ CompareObjectType(r2, r4, r4, JS_OBJECT_TYPE); 1591 __ JumpIfSmi(last_match_info_elements, &runtime);
1592 __ bne(&runtime);
1593 // Check that the object has fast elements. 1592 // Check that the object has fast elements.
1594 __ LoadP(last_match_info_elements,
1595 FieldMemOperand(r2, JSArray::kElementsOffset));
1596 __ LoadP(r2, 1593 __ LoadP(r2,
1597 FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset)); 1594 FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset));
1598 __ CompareRoot(r2, Heap::kFixedArrayMapRootIndex); 1595 __ CompareRoot(r2, Heap::kFixedArrayMapRootIndex);
1599 __ bne(&runtime); 1596 __ bne(&runtime);
1600 // Check that the last match info has space for the capture registers and the 1597 // Check that the last match info has space for the capture registers and the
1601 // additional information. 1598 // additional information.
1602 __ LoadP( 1599 __ LoadP(
1603 r2, FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset)); 1600 r2, FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset));
1604 __ AddP(r4, r3, Operand(RegExpImpl::kLastMatchOverhead)); 1601 __ AddP(r4, r3, Operand(RegExpMatchInfo::kLastMatchOverhead));
1605 __ SmiUntag(r0, r2); 1602 __ SmiUntag(r0, r2);
1606 __ CmpP(r4, r0); 1603 __ CmpP(r4, r0);
1607 __ bgt(&runtime); 1604 __ bgt(&runtime);
1608 1605
1609 // r3: number of capture registers 1606 // r3: number of capture registers
1610 // subject: subject string 1607 // subject: subject string
1611 // Store the capture count. 1608 // Store the capture count.
1612 __ SmiTag(r4, r3); 1609 __ SmiTag(r4, r3);
1613 __ StoreP(r4, FieldMemOperand(last_match_info_elements, 1610 __ StoreP(r4, FieldMemOperand(last_match_info_elements,
1614 RegExpImpl::kLastCaptureCountOffset)); 1611 RegExpMatchInfo::kNumberOfCapturesOffset));
1615 // Store last subject and last input. 1612 // Store last subject and last input.
1616 __ StoreP(subject, FieldMemOperand(last_match_info_elements, 1613 __ StoreP(subject, FieldMemOperand(last_match_info_elements,
1617 RegExpImpl::kLastSubjectOffset)); 1614 RegExpMatchInfo::kLastSubjectOffset));
1618 __ LoadRR(r4, subject); 1615 __ LoadRR(r4, subject);
1619 __ RecordWriteField(last_match_info_elements, RegExpImpl::kLastSubjectOffset, 1616 __ RecordWriteField(last_match_info_elements,
1620 subject, r9, kLRHasNotBeenSaved, kDontSaveFPRegs); 1617 RegExpMatchInfo::kLastSubjectOffset, subject, r9,
1618 kLRHasNotBeenSaved, kDontSaveFPRegs);
1621 __ LoadRR(subject, r4); 1619 __ LoadRR(subject, r4);
1622 __ StoreP(subject, FieldMemOperand(last_match_info_elements, 1620 __ StoreP(subject, FieldMemOperand(last_match_info_elements,
1623 RegExpImpl::kLastInputOffset)); 1621 RegExpMatchInfo::kLastInputOffset));
1624 __ RecordWriteField(last_match_info_elements, RegExpImpl::kLastInputOffset, 1622 __ RecordWriteField(last_match_info_elements,
1625 subject, r9, kLRHasNotBeenSaved, kDontSaveFPRegs); 1623 RegExpMatchInfo::kLastInputOffset, subject, r9,
1624 kLRHasNotBeenSaved, kDontSaveFPRegs);
1626 1625
1627 // Get the static offsets vector filled by the native regexp code. 1626 // Get the static offsets vector filled by the native regexp code.
1628 ExternalReference address_of_static_offsets_vector = 1627 ExternalReference address_of_static_offsets_vector =
1629 ExternalReference::address_of_static_offsets_vector(isolate()); 1628 ExternalReference::address_of_static_offsets_vector(isolate());
1630 __ mov(r4, Operand(address_of_static_offsets_vector)); 1629 __ mov(r4, Operand(address_of_static_offsets_vector));
1631 1630
1632 // r3: number of capture registers 1631 // r3: number of capture registers
1633 // r4: offsets vector 1632 // r4: offsets vector
1634 Label next_capture; 1633 Label next_capture;
1635 // Capture register counter starts from number of capture registers and 1634 // Capture register counter starts from number of capture registers and
1636 // counts down until wraping after zero. 1635 // counts down until wrapping after zero.
1637 __ AddP( 1636 __ AddP(r2, last_match_info_elements,
1638 r2, last_match_info_elements, 1637 Operand(RegExpMatchInfo::kFirstCaptureOffset - kHeapObjectTag -
1639 Operand(RegExpImpl::kFirstCaptureOffset - kHeapObjectTag - kPointerSize)); 1638 kPointerSize));
1640 __ AddP(r4, Operand(-kIntSize)); // bias down for lwzu 1639 __ AddP(r4, Operand(-kIntSize)); // bias down for lwzu
1641 __ bind(&next_capture); 1640 __ bind(&next_capture);
1642 // Read the value from the static offsets vector buffer. 1641 // Read the value from the static offsets vector buffer.
1643 __ ly(r5, MemOperand(r4, kIntSize)); 1642 __ ly(r5, MemOperand(r4, kIntSize));
1644 __ lay(r4, MemOperand(r4, kIntSize)); 1643 __ lay(r4, MemOperand(r4, kIntSize));
1645 // Store the smi value in the last match info. 1644 // Store the smi value in the last match info.
1646 __ SmiTag(r5); 1645 __ SmiTag(r5);
1647 __ StoreP(r5, MemOperand(r2, kPointerSize)); 1646 __ StoreP(r5, MemOperand(r2, kPointerSize));
1648 __ lay(r2, MemOperand(r2, kPointerSize)); 1647 __ lay(r2, MemOperand(r2, kPointerSize));
1649 __ BranchOnCount(r3, &next_capture); 1648 __ BranchOnCount(r3, &next_capture);
1650 1649
1651 // Return last match info. 1650 // Return last match info.
1652 __ LoadP(r2, MemOperand(sp, kLastMatchInfoOffset)); 1651 __ LoadRR(r2, last_match_info_elements);
1653 __ la(sp, MemOperand(sp, (4 * kPointerSize))); 1652 __ la(sp, MemOperand(sp, (4 * kPointerSize)));
1654 __ Ret(); 1653 __ Ret();
1655 1654
1656 // Do the runtime call to execute the regexp. 1655 // Do the runtime call to execute the regexp.
1657 __ bind(&runtime); 1656 __ bind(&runtime);
1658 __ TailCallRuntime(Runtime::kRegExpExec); 1657 __ TailCallRuntime(Runtime::kRegExpExec);
1659 1658
1660 // Deferred code for string handling. 1659 // Deferred code for string handling.
1661 // (5) Long external string? If not, go to (7). 1660 // (5) Long external string? If not, go to (7).
1662 __ bind(&not_seq_nor_cons); 1661 __ bind(&not_seq_nor_cons);
(...skipping 3158 matching lines...) Expand 10 before | Expand all | Expand 10 after
4821 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 4820 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
4822 kStackUnwindSpace, NULL, return_value_operand, NULL); 4821 kStackUnwindSpace, NULL, return_value_operand, NULL);
4823 } 4822 }
4824 4823
4825 #undef __ 4824 #undef __
4826 4825
4827 } // namespace internal 4826 } // namespace internal
4828 } // namespace v8 4827 } // namespace v8
4829 4828
4830 #endif // V8_TARGET_ARCH_S390 4829 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/runtime/runtime-strings.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698