| OLD | NEW |
| 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 Loading... |
| 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 __ CompareObjectType(last_match_info_elements, r4, r4, FIXED_ARRAY_TYPE); |
| 1592 __ bne(&runtime); | 1593 __ bne(&runtime); |
| 1593 // Check that the object has fast elements. | 1594 // Check that the object has fast elements. |
| 1594 __ LoadP(last_match_info_elements, | |
| 1595 FieldMemOperand(r2, JSArray::kElementsOffset)); | |
| 1596 __ LoadP(r2, | 1595 __ LoadP(r2, |
| 1597 FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset)); | 1596 FieldMemOperand(last_match_info_elements, HeapObject::kMapOffset)); |
| 1598 __ CompareRoot(r2, Heap::kFixedArrayMapRootIndex); | 1597 __ CompareRoot(r2, Heap::kFixedArrayMapRootIndex); |
| 1599 __ bne(&runtime); | 1598 __ bne(&runtime); |
| 1600 // Check that the last match info has space for the capture registers and the | 1599 // Check that the last match info has space for the capture registers and the |
| 1601 // additional information. | 1600 // additional information. |
| 1602 __ LoadP( | 1601 __ LoadP( |
| 1603 r2, FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset)); | 1602 r2, FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset)); |
| 1604 __ AddP(r4, r3, Operand(RegExpImpl::kLastMatchOverhead)); | 1603 __ AddP(r4, r3, Operand(RegExpMatchInfo::kLastMatchOverhead)); |
| 1605 __ SmiUntag(r0, r2); | 1604 __ SmiUntag(r0, r2); |
| 1606 __ CmpP(r4, r0); | 1605 __ CmpP(r4, r0); |
| 1607 __ bgt(&runtime); | 1606 __ bgt(&runtime); |
| 1608 | 1607 |
| 1609 // r3: number of capture registers | 1608 // r3: number of capture registers |
| 1610 // subject: subject string | 1609 // subject: subject string |
| 1611 // Store the capture count. | 1610 // Store the capture count. |
| 1612 __ SmiTag(r4, r3); | 1611 __ SmiTag(r4, r3); |
| 1613 __ StoreP(r4, FieldMemOperand(last_match_info_elements, | 1612 __ StoreP(r4, FieldMemOperand(last_match_info_elements, |
| 1614 RegExpImpl::kLastCaptureCountOffset)); | 1613 RegExpMatchInfo::kNumberOfCapturesOffset)); |
| 1615 // Store last subject and last input. | 1614 // Store last subject and last input. |
| 1616 __ StoreP(subject, FieldMemOperand(last_match_info_elements, | 1615 __ StoreP(subject, FieldMemOperand(last_match_info_elements, |
| 1617 RegExpImpl::kLastSubjectOffset)); | 1616 RegExpMatchInfo::kLastSubjectOffset)); |
| 1618 __ LoadRR(r4, subject); | 1617 __ LoadRR(r4, subject); |
| 1619 __ RecordWriteField(last_match_info_elements, RegExpImpl::kLastSubjectOffset, | 1618 __ RecordWriteField(last_match_info_elements, |
| 1620 subject, r9, kLRHasNotBeenSaved, kDontSaveFPRegs); | 1619 RegExpMatchInfo::kLastSubjectOffset, subject, r9, |
| 1620 kLRHasNotBeenSaved, kDontSaveFPRegs); |
| 1621 __ LoadRR(subject, r4); | 1621 __ LoadRR(subject, r4); |
| 1622 __ StoreP(subject, FieldMemOperand(last_match_info_elements, | 1622 __ StoreP(subject, FieldMemOperand(last_match_info_elements, |
| 1623 RegExpImpl::kLastInputOffset)); | 1623 RegExpMatchInfo::kLastInputOffset)); |
| 1624 __ RecordWriteField(last_match_info_elements, RegExpImpl::kLastInputOffset, | 1624 __ RecordWriteField(last_match_info_elements, |
| 1625 subject, r9, kLRHasNotBeenSaved, kDontSaveFPRegs); | 1625 RegExpMatchInfo::kLastInputOffset, subject, r9, |
| 1626 kLRHasNotBeenSaved, kDontSaveFPRegs); |
| 1626 | 1627 |
| 1627 // Get the static offsets vector filled by the native regexp code. | 1628 // Get the static offsets vector filled by the native regexp code. |
| 1628 ExternalReference address_of_static_offsets_vector = | 1629 ExternalReference address_of_static_offsets_vector = |
| 1629 ExternalReference::address_of_static_offsets_vector(isolate()); | 1630 ExternalReference::address_of_static_offsets_vector(isolate()); |
| 1630 __ mov(r4, Operand(address_of_static_offsets_vector)); | 1631 __ mov(r4, Operand(address_of_static_offsets_vector)); |
| 1631 | 1632 |
| 1632 // r3: number of capture registers | 1633 // r3: number of capture registers |
| 1633 // r4: offsets vector | 1634 // r4: offsets vector |
| 1634 Label next_capture; | 1635 Label next_capture; |
| 1635 // Capture register counter starts from number of capture registers and | 1636 // Capture register counter starts from number of capture registers and |
| 1636 // counts down until wraping after zero. | 1637 // counts down until wrapping after zero. |
| 1637 __ AddP( | 1638 __ AddP(r2, last_match_info_elements, |
| 1638 r2, last_match_info_elements, | 1639 Operand(RegExpMatchInfo::kFirstCaptureOffset - kHeapObjectTag - |
| 1639 Operand(RegExpImpl::kFirstCaptureOffset - kHeapObjectTag - kPointerSize)); | 1640 kPointerSize)); |
| 1640 __ AddP(r4, Operand(-kIntSize)); // bias down for lwzu | 1641 __ AddP(r4, Operand(-kIntSize)); // bias down for lwzu |
| 1641 __ bind(&next_capture); | 1642 __ bind(&next_capture); |
| 1642 // Read the value from the static offsets vector buffer. | 1643 // Read the value from the static offsets vector buffer. |
| 1643 __ ly(r5, MemOperand(r4, kIntSize)); | 1644 __ ly(r5, MemOperand(r4, kIntSize)); |
| 1644 __ lay(r4, MemOperand(r4, kIntSize)); | 1645 __ lay(r4, MemOperand(r4, kIntSize)); |
| 1645 // Store the smi value in the last match info. | 1646 // Store the smi value in the last match info. |
| 1646 __ SmiTag(r5); | 1647 __ SmiTag(r5); |
| 1647 __ StoreP(r5, MemOperand(r2, kPointerSize)); | 1648 __ StoreP(r5, MemOperand(r2, kPointerSize)); |
| 1648 __ lay(r2, MemOperand(r2, kPointerSize)); | 1649 __ lay(r2, MemOperand(r2, kPointerSize)); |
| 1649 __ BranchOnCount(r3, &next_capture); | 1650 __ BranchOnCount(r3, &next_capture); |
| 1650 | 1651 |
| 1651 // Return last match info. | 1652 // Return last match info. |
| 1652 __ LoadP(r2, MemOperand(sp, kLastMatchInfoOffset)); | 1653 __ LoadRR(r2, last_match_info_elements); |
| 1653 __ la(sp, MemOperand(sp, (4 * kPointerSize))); | 1654 __ la(sp, MemOperand(sp, (4 * kPointerSize))); |
| 1654 __ Ret(); | 1655 __ Ret(); |
| 1655 | 1656 |
| 1656 // Do the runtime call to execute the regexp. | 1657 // Do the runtime call to execute the regexp. |
| 1657 __ bind(&runtime); | 1658 __ bind(&runtime); |
| 1658 __ TailCallRuntime(Runtime::kRegExpExec); | 1659 __ TailCallRuntime(Runtime::kRegExpExec); |
| 1659 | 1660 |
| 1660 // Deferred code for string handling. | 1661 // Deferred code for string handling. |
| 1661 // (5) Long external string? If not, go to (7). | 1662 // (5) Long external string? If not, go to (7). |
| 1662 __ bind(¬_seq_nor_cons); | 1663 __ bind(¬_seq_nor_cons); |
| (...skipping 3158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4821 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 4822 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
| 4822 kStackUnwindSpace, NULL, return_value_operand, NULL); | 4823 kStackUnwindSpace, NULL, return_value_operand, NULL); |
| 4823 } | 4824 } |
| 4824 | 4825 |
| 4825 #undef __ | 4826 #undef __ |
| 4826 | 4827 |
| 4827 } // namespace internal | 4828 } // namespace internal |
| 4828 } // namespace v8 | 4829 } // namespace v8 |
| 4829 | 4830 |
| 4830 #endif // V8_TARGET_ARCH_S390 | 4831 #endif // V8_TARGET_ARCH_S390 |
| OLD | NEW |