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 #include <assert.h> // For assert | 5 #include <assert.h> // For assert |
6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
7 | 7 |
8 #if V8_TARGET_ARCH_S390 | 8 #if V8_TARGET_ARCH_S390 |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 AddP(t0, t0, scratch); | 1617 AddP(t0, t0, scratch); |
1618 ShiftLeft(scratch, r0, Operand(11)); | 1618 ShiftLeft(scratch, r0, Operand(11)); |
1619 AddP(t0, t0, scratch); | 1619 AddP(t0, t0, scratch); |
1620 // hash = hash ^ (hash >> 16); | 1620 // hash = hash ^ (hash >> 16); |
1621 ShiftRight(scratch, t0, Operand(16)); | 1621 ShiftRight(scratch, t0, Operand(16)); |
1622 XorP(t0, scratch); | 1622 XorP(t0, scratch); |
1623 // hash & 0x3fffffff | 1623 // hash & 0x3fffffff |
1624 ExtractBitRange(t0, t0, 29, 0); | 1624 ExtractBitRange(t0, t0, 29, 0); |
1625 } | 1625 } |
1626 | 1626 |
1627 void MacroAssembler::LoadFromNumberDictionary(Label* miss, Register elements, | |
1628 Register key, Register result, | |
1629 Register t0, Register t1, | |
1630 Register t2) { | |
1631 // Register use: | |
1632 // | |
1633 // elements - holds the slow-case elements of the receiver on entry. | |
1634 // Unchanged unless 'result' is the same register. | |
1635 // | |
1636 // key - holds the smi key on entry. | |
1637 // Unchanged unless 'result' is the same register. | |
1638 // | |
1639 // result - holds the result on exit if the load succeeded. | |
1640 // Allowed to be the same as 'key' or 'result'. | |
1641 // Unchanged on bailout so 'key' or 'result' can be used | |
1642 // in further computation. | |
1643 // | |
1644 // Scratch registers: | |
1645 // | |
1646 // t0 - holds the untagged key on entry and holds the hash once computed. | |
1647 // | |
1648 // t1 - used to hold the capacity mask of the dictionary | |
1649 // | |
1650 // t2 - used for the index into the dictionary. | |
1651 Label done; | |
1652 | |
1653 GetNumberHash(t0, t1); | |
1654 | |
1655 // Compute the capacity mask. | |
1656 LoadP(t1, FieldMemOperand(elements, SeededNumberDictionary::kCapacityOffset)); | |
1657 SmiUntag(t1); | |
1658 SubP(t1, Operand(1)); | |
1659 | |
1660 // Generate an unrolled loop that performs a few probes before giving up. | |
1661 for (int i = 0; i < kNumberDictionaryProbes; i++) { | |
1662 // Use t2 for index calculations and keep the hash intact in t0. | |
1663 LoadRR(t2, t0); | |
1664 // Compute the masked index: (hash + i + i * i) & mask. | |
1665 if (i > 0) { | |
1666 AddP(t2, Operand(SeededNumberDictionary::GetProbeOffset(i))); | |
1667 } | |
1668 AndP(t2, t1); | |
1669 | |
1670 // Scale the index by multiplying by the element size. | |
1671 DCHECK(SeededNumberDictionary::kEntrySize == 3); | |
1672 LoadRR(ip, t2); | |
1673 sll(ip, Operand(1)); | |
1674 AddP(t2, ip); // t2 = t2 * 3 | |
1675 | |
1676 // Check if the key is identical to the name. | |
1677 sll(t2, Operand(kPointerSizeLog2)); | |
1678 AddP(t2, elements); | |
1679 LoadP(ip, | |
1680 FieldMemOperand(t2, SeededNumberDictionary::kElementsStartOffset)); | |
1681 CmpP(key, ip); | |
1682 if (i != kNumberDictionaryProbes - 1) { | |
1683 beq(&done, Label::kNear); | |
1684 } else { | |
1685 bne(miss); | |
1686 } | |
1687 } | |
1688 | |
1689 bind(&done); | |
1690 // Check that the value is a field property. | |
1691 // t2: elements + (index * kPointerSize) | |
1692 const int kDetailsOffset = | |
1693 SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; | |
1694 LoadP(t1, FieldMemOperand(t2, kDetailsOffset)); | |
1695 LoadSmiLiteral(ip, Smi::FromInt(PropertyDetails::TypeField::kMask)); | |
1696 DCHECK_EQ(DATA, 0); | |
1697 AndP(r0, ip, t1); | |
1698 bne(miss); | |
1699 | |
1700 // Get the value at the masked, scaled index and return. | |
1701 const int kValueOffset = | |
1702 SeededNumberDictionary::kElementsStartOffset + kPointerSize; | |
1703 LoadP(result, FieldMemOperand(t2, kValueOffset)); | |
1704 } | |
1705 | |
1706 void MacroAssembler::Allocate(int object_size, Register result, | 1627 void MacroAssembler::Allocate(int object_size, Register result, |
1707 Register scratch1, Register scratch2, | 1628 Register scratch1, Register scratch2, |
1708 Label* gc_required, AllocationFlags flags) { | 1629 Label* gc_required, AllocationFlags flags) { |
1709 DCHECK(object_size <= kMaxRegularHeapObjectSize); | 1630 DCHECK(object_size <= kMaxRegularHeapObjectSize); |
1710 DCHECK((flags & ALLOCATION_FOLDED) == 0); | 1631 DCHECK((flags & ALLOCATION_FOLDED) == 0); |
1711 if (!FLAG_inline_new) { | 1632 if (!FLAG_inline_new) { |
1712 if (emit_debug_code()) { | 1633 if (emit_debug_code()) { |
1713 // Trash the registers to simulate an allocation failure. | 1634 // Trash the registers to simulate an allocation failure. |
1714 LoadImmP(result, Operand(0x7091)); | 1635 LoadImmP(result, Operand(0x7091)); |
1715 LoadImmP(scratch1, Operand(0x7191)); | 1636 LoadImmP(scratch1, Operand(0x7191)); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2109 STATIC_ASSERT(Map::kInstanceTypeOffset < 4096); | 2030 STATIC_ASSERT(Map::kInstanceTypeOffset < 4096); |
2110 STATIC_ASSERT(LAST_TYPE < 256); | 2031 STATIC_ASSERT(LAST_TYPE < 256); |
2111 LoadlB(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 2032 LoadlB(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
2112 CmpP(type_reg, Operand(type)); | 2033 CmpP(type_reg, Operand(type)); |
2113 } | 2034 } |
2114 | 2035 |
2115 void MacroAssembler::CompareRoot(Register obj, Heap::RootListIndex index) { | 2036 void MacroAssembler::CompareRoot(Register obj, Heap::RootListIndex index) { |
2116 CmpP(obj, MemOperand(kRootRegister, index << kPointerSizeLog2)); | 2037 CmpP(obj, MemOperand(kRootRegister, index << kPointerSizeLog2)); |
2117 } | 2038 } |
2118 | 2039 |
2119 void MacroAssembler::CheckFastElements(Register map, Register scratch, | |
2120 Label* fail) { | |
2121 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); | |
2122 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); | |
2123 STATIC_ASSERT(FAST_ELEMENTS == 2); | |
2124 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3); | |
2125 STATIC_ASSERT(Map::kMaximumBitField2FastHoleyElementValue < 0x8000); | |
2126 CmpLogicalByte(FieldMemOperand(map, Map::kBitField2Offset), | |
2127 Operand(Map::kMaximumBitField2FastHoleyElementValue)); | |
2128 bgt(fail); | |
2129 } | |
2130 | |
2131 void MacroAssembler::CheckFastObjectElements(Register map, Register scratch, | 2040 void MacroAssembler::CheckFastObjectElements(Register map, Register scratch, |
2132 Label* fail) { | 2041 Label* fail) { |
2133 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); | 2042 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); |
2134 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); | 2043 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); |
2135 STATIC_ASSERT(FAST_ELEMENTS == 2); | 2044 STATIC_ASSERT(FAST_ELEMENTS == 2); |
2136 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3); | 2045 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3); |
2137 CmpLogicalByte(FieldMemOperand(map, Map::kBitField2Offset), | 2046 CmpLogicalByte(FieldMemOperand(map, Map::kBitField2Offset), |
2138 Operand(Map::kMaximumBitField2FastHoleySmiElementValue)); | 2047 Operand(Map::kMaximumBitField2FastHoleySmiElementValue)); |
2139 ble(fail); | 2048 ble(fail); |
2140 CmpLogicalByte(FieldMemOperand(map, Map::kBitField2Offset), | 2049 CmpLogicalByte(FieldMemOperand(map, Map::kBitField2Offset), |
(...skipping 3392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5533 } | 5442 } |
5534 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); | 5443 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); |
5535 ExtractBit(r0, dividend, 31); | 5444 ExtractBit(r0, dividend, 31); |
5536 AddP(result, r0); | 5445 AddP(result, r0); |
5537 } | 5446 } |
5538 | 5447 |
5539 } // namespace internal | 5448 } // namespace internal |
5540 } // namespace v8 | 5449 } // namespace v8 |
5541 | 5450 |
5542 #endif // V8_TARGET_ARCH_S390 | 5451 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |