OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 TYPE_CHECKER(JSStringIterator, JS_STRING_ITERATOR_TYPE) | 167 TYPE_CHECKER(JSStringIterator, JS_STRING_ITERATOR_TYPE) |
168 TYPE_CHECKER(JSTypedArray, JS_TYPED_ARRAY_TYPE) | 168 TYPE_CHECKER(JSTypedArray, JS_TYPED_ARRAY_TYPE) |
169 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) | 169 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) |
170 TYPE_CHECKER(JSWeakMap, JS_WEAK_MAP_TYPE) | 170 TYPE_CHECKER(JSWeakMap, JS_WEAK_MAP_TYPE) |
171 TYPE_CHECKER(JSWeakSet, JS_WEAK_SET_TYPE) | 171 TYPE_CHECKER(JSWeakSet, JS_WEAK_SET_TYPE) |
172 TYPE_CHECKER(Map, MAP_TYPE) | 172 TYPE_CHECKER(Map, MAP_TYPE) |
173 TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE) | 173 TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE) |
174 TYPE_CHECKER(Oddball, ODDBALL_TYPE) | 174 TYPE_CHECKER(Oddball, ODDBALL_TYPE) |
175 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE) | 175 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE) |
176 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) | 176 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) |
| 177 TYPE_CHECKER(Simd128Value, SIMD128_VALUE_TYPE) |
177 TYPE_CHECKER(Symbol, SYMBOL_TYPE) | 178 TYPE_CHECKER(Symbol, SYMBOL_TYPE) |
178 TYPE_CHECKER(TransitionArray, TRANSITION_ARRAY_TYPE) | 179 TYPE_CHECKER(TransitionArray, TRANSITION_ARRAY_TYPE) |
179 TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE) | 180 TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE) |
180 TYPE_CHECKER(WeakFixedArray, FIXED_ARRAY_TYPE) | 181 TYPE_CHECKER(WeakFixedArray, FIXED_ARRAY_TYPE) |
181 | 182 |
182 #define TYPED_ARRAY_TYPE_CHECKER(Type, type, TYPE, ctype, size) \ | 183 #define TYPED_ARRAY_TYPE_CHECKER(Type, type, TYPE, ctype, size) \ |
183 TYPE_CHECKER(Fixed##Type##Array, FIXED_##TYPE##_ARRAY_TYPE) | 184 TYPE_CHECKER(Fixed##Type##Array, FIXED_##TYPE##_ARRAY_TYPE) |
184 TYPED_ARRAYS(TYPED_ARRAY_TYPE_CHECKER) | 185 TYPED_ARRAYS(TYPED_ARRAY_TYPE_CHECKER) |
185 #undef TYPED_ARRAY_TYPE_CHECKER | 186 #undef TYPED_ARRAY_TYPE_CHECKER |
186 | 187 |
187 #undef TYPE_CHECKER | 188 #undef TYPE_CHECKER |
188 | 189 |
189 bool HeapObject::IsFixedArrayBase() const { | 190 bool HeapObject::IsFixedArrayBase() const { |
190 return IsFixedArray() || IsFixedDoubleArray() || IsFixedTypedArrayBase(); | 191 return IsFixedArray() || IsFixedDoubleArray() || IsFixedTypedArrayBase(); |
191 } | 192 } |
192 | 193 |
193 bool HeapObject::IsFixedArray() const { | 194 bool HeapObject::IsFixedArray() const { |
194 InstanceType instance_type = map()->instance_type(); | 195 InstanceType instance_type = map()->instance_type(); |
195 return instance_type == FIXED_ARRAY_TYPE || | 196 return instance_type == FIXED_ARRAY_TYPE || |
196 instance_type == TRANSITION_ARRAY_TYPE; | 197 instance_type == TRANSITION_ARRAY_TYPE; |
197 } | 198 } |
198 | 199 |
199 bool HeapObject::IsBoilerplateDescription() const { return IsFixedArray(); } | 200 bool HeapObject::IsBoilerplateDescription() const { return IsFixedArray(); } |
200 | 201 |
201 // External objects are not extensible, so the map check is enough. | 202 // External objects are not extensible, so the map check is enough. |
202 bool HeapObject::IsExternal() const { | 203 bool HeapObject::IsExternal() const { |
203 return map() == GetHeap()->external_map(); | 204 return map() == GetHeap()->external_map(); |
204 } | 205 } |
205 | 206 |
| 207 #define SIMD128_TYPE_CHECKER(TYPE, Type, type, lane_count, lane_type) \ |
| 208 bool HeapObject::Is##Type() const { return map() == GetHeap()->type##_map(); } |
| 209 SIMD128_TYPES(SIMD128_TYPE_CHECKER) |
| 210 #undef SIMD128_TYPE_CHECKER |
| 211 |
206 #define IS_TYPE_FUNCTION_DEF(type_) \ | 212 #define IS_TYPE_FUNCTION_DEF(type_) \ |
207 bool Object::Is##type_() const { \ | 213 bool Object::Is##type_() const { \ |
208 return IsHeapObject() && HeapObject::cast(this)->Is##type_(); \ | 214 return IsHeapObject() && HeapObject::cast(this)->Is##type_(); \ |
209 } | 215 } |
210 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DEF) | 216 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DEF) |
211 #undef IS_TYPE_FUNCTION_DEF | 217 #undef IS_TYPE_FUNCTION_DEF |
212 | 218 |
213 #define IS_TYPE_FUNCTION_DEF(Type, Value) \ | 219 #define IS_TYPE_FUNCTION_DEF(Type, Value) \ |
214 bool Object::Is##Type(Isolate* isolate) const { \ | 220 bool Object::Is##Type(Isolate* isolate) const { \ |
215 return this == isolate->heap()->Value(); \ | 221 return this == isolate->heap()->Value(); \ |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 return reinterpret_cast<type*>(object); \ | 610 return reinterpret_cast<type*>(object); \ |
605 } \ | 611 } \ |
606 const type* type::cast(const Object* object) { \ | 612 const type* type::cast(const Object* object) { \ |
607 SLOW_DCHECK(object->Is##type()); \ | 613 SLOW_DCHECK(object->Is##type()); \ |
608 return reinterpret_cast<const type*>(object); \ | 614 return reinterpret_cast<const type*>(object); \ |
609 } | 615 } |
610 | 616 |
611 CAST_ACCESSOR(AbstractCode) | 617 CAST_ACCESSOR(AbstractCode) |
612 CAST_ACCESSOR(ArrayList) | 618 CAST_ACCESSOR(ArrayList) |
613 CAST_ACCESSOR(BoilerplateDescription) | 619 CAST_ACCESSOR(BoilerplateDescription) |
| 620 CAST_ACCESSOR(Bool16x8) |
| 621 CAST_ACCESSOR(Bool32x4) |
| 622 CAST_ACCESSOR(Bool8x16) |
614 CAST_ACCESSOR(ByteArray) | 623 CAST_ACCESSOR(ByteArray) |
615 CAST_ACCESSOR(BytecodeArray) | 624 CAST_ACCESSOR(BytecodeArray) |
616 CAST_ACCESSOR(Cell) | 625 CAST_ACCESSOR(Cell) |
617 CAST_ACCESSOR(Code) | 626 CAST_ACCESSOR(Code) |
618 CAST_ACCESSOR(CodeCacheHashTable) | 627 CAST_ACCESSOR(CodeCacheHashTable) |
619 CAST_ACCESSOR(CompilationCacheTable) | 628 CAST_ACCESSOR(CompilationCacheTable) |
620 CAST_ACCESSOR(ConsString) | 629 CAST_ACCESSOR(ConsString) |
621 CAST_ACCESSOR(DeoptimizationInputData) | 630 CAST_ACCESSOR(DeoptimizationInputData) |
622 CAST_ACCESSOR(DeoptimizationOutputData) | 631 CAST_ACCESSOR(DeoptimizationOutputData) |
623 CAST_ACCESSOR(DependentCode) | 632 CAST_ACCESSOR(DependentCode) |
624 CAST_ACCESSOR(DescriptorArray) | 633 CAST_ACCESSOR(DescriptorArray) |
625 CAST_ACCESSOR(ExternalOneByteString) | 634 CAST_ACCESSOR(ExternalOneByteString) |
626 CAST_ACCESSOR(ExternalString) | 635 CAST_ACCESSOR(ExternalString) |
627 CAST_ACCESSOR(ExternalTwoByteString) | 636 CAST_ACCESSOR(ExternalTwoByteString) |
628 CAST_ACCESSOR(FixedArray) | 637 CAST_ACCESSOR(FixedArray) |
629 CAST_ACCESSOR(FixedArrayBase) | 638 CAST_ACCESSOR(FixedArrayBase) |
630 CAST_ACCESSOR(FixedDoubleArray) | 639 CAST_ACCESSOR(FixedDoubleArray) |
631 CAST_ACCESSOR(FixedTypedArrayBase) | 640 CAST_ACCESSOR(FixedTypedArrayBase) |
| 641 CAST_ACCESSOR(Float32x4) |
632 CAST_ACCESSOR(Foreign) | 642 CAST_ACCESSOR(Foreign) |
633 CAST_ACCESSOR(FrameArray) | 643 CAST_ACCESSOR(FrameArray) |
634 CAST_ACCESSOR(GlobalDictionary) | 644 CAST_ACCESSOR(GlobalDictionary) |
635 CAST_ACCESSOR(HandlerTable) | 645 CAST_ACCESSOR(HandlerTable) |
636 CAST_ACCESSOR(HeapObject) | 646 CAST_ACCESSOR(HeapObject) |
| 647 CAST_ACCESSOR(Int16x8) |
| 648 CAST_ACCESSOR(Int32x4) |
| 649 CAST_ACCESSOR(Int8x16) |
637 CAST_ACCESSOR(JSArray) | 650 CAST_ACCESSOR(JSArray) |
638 CAST_ACCESSOR(JSArrayBuffer) | 651 CAST_ACCESSOR(JSArrayBuffer) |
639 CAST_ACCESSOR(JSArrayBufferView) | 652 CAST_ACCESSOR(JSArrayBufferView) |
640 CAST_ACCESSOR(JSBoundFunction) | 653 CAST_ACCESSOR(JSBoundFunction) |
641 CAST_ACCESSOR(JSDataView) | 654 CAST_ACCESSOR(JSDataView) |
642 CAST_ACCESSOR(JSDate) | 655 CAST_ACCESSOR(JSDate) |
643 CAST_ACCESSOR(JSFunction) | 656 CAST_ACCESSOR(JSFunction) |
644 CAST_ACCESSOR(JSGeneratorObject) | 657 CAST_ACCESSOR(JSGeneratorObject) |
645 CAST_ACCESSOR(JSGlobalObject) | 658 CAST_ACCESSOR(JSGlobalObject) |
646 CAST_ACCESSOR(JSGlobalProxy) | 659 CAST_ACCESSOR(JSGlobalProxy) |
(...skipping 30 matching lines...) Expand all Loading... |
677 CAST_ACCESSOR(OrderedHashSet) | 690 CAST_ACCESSOR(OrderedHashSet) |
678 CAST_ACCESSOR(PropertyCell) | 691 CAST_ACCESSOR(PropertyCell) |
679 CAST_ACCESSOR(TemplateList) | 692 CAST_ACCESSOR(TemplateList) |
680 CAST_ACCESSOR(RegExpMatchInfo) | 693 CAST_ACCESSOR(RegExpMatchInfo) |
681 CAST_ACCESSOR(ScopeInfo) | 694 CAST_ACCESSOR(ScopeInfo) |
682 CAST_ACCESSOR(SeededNumberDictionary) | 695 CAST_ACCESSOR(SeededNumberDictionary) |
683 CAST_ACCESSOR(SeqOneByteString) | 696 CAST_ACCESSOR(SeqOneByteString) |
684 CAST_ACCESSOR(SeqString) | 697 CAST_ACCESSOR(SeqString) |
685 CAST_ACCESSOR(SeqTwoByteString) | 698 CAST_ACCESSOR(SeqTwoByteString) |
686 CAST_ACCESSOR(SharedFunctionInfo) | 699 CAST_ACCESSOR(SharedFunctionInfo) |
| 700 CAST_ACCESSOR(Simd128Value) |
687 CAST_ACCESSOR(SlicedString) | 701 CAST_ACCESSOR(SlicedString) |
688 CAST_ACCESSOR(Smi) | 702 CAST_ACCESSOR(Smi) |
689 CAST_ACCESSOR(String) | 703 CAST_ACCESSOR(String) |
690 CAST_ACCESSOR(StringSet) | 704 CAST_ACCESSOR(StringSet) |
691 CAST_ACCESSOR(StringTable) | 705 CAST_ACCESSOR(StringTable) |
692 CAST_ACCESSOR(Struct) | 706 CAST_ACCESSOR(Struct) |
693 CAST_ACCESSOR(Symbol) | 707 CAST_ACCESSOR(Symbol) |
694 CAST_ACCESSOR(TemplateInfo) | 708 CAST_ACCESSOR(TemplateInfo) |
695 CAST_ACCESSOR(ThinString) | 709 CAST_ACCESSOR(ThinString) |
| 710 CAST_ACCESSOR(Uint16x8) |
| 711 CAST_ACCESSOR(Uint32x4) |
| 712 CAST_ACCESSOR(Uint8x16) |
696 CAST_ACCESSOR(UnseededNumberDictionary) | 713 CAST_ACCESSOR(UnseededNumberDictionary) |
697 CAST_ACCESSOR(WeakCell) | 714 CAST_ACCESSOR(WeakCell) |
698 CAST_ACCESSOR(WeakFixedArray) | 715 CAST_ACCESSOR(WeakFixedArray) |
699 CAST_ACCESSOR(WeakHashTable) | 716 CAST_ACCESSOR(WeakHashTable) |
700 | 717 |
701 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name) | 718 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name) |
702 STRUCT_LIST(MAKE_STRUCT_CAST) | 719 STRUCT_LIST(MAKE_STRUCT_CAST) |
703 #undef MAKE_STRUCT_CAST | 720 #undef MAKE_STRUCT_CAST |
704 | 721 |
705 #undef CAST_ACCESSOR | 722 #undef CAST_ACCESSOR |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 int HeapNumber::get_exponent() { | 1568 int HeapNumber::get_exponent() { |
1552 return ((READ_INT_FIELD(this, kExponentOffset) & kExponentMask) >> | 1569 return ((READ_INT_FIELD(this, kExponentOffset) & kExponentMask) >> |
1553 kExponentShift) - kExponentBias; | 1570 kExponentShift) - kExponentBias; |
1554 } | 1571 } |
1555 | 1572 |
1556 | 1573 |
1557 int HeapNumber::get_sign() { | 1574 int HeapNumber::get_sign() { |
1558 return READ_INT_FIELD(this, kExponentOffset) & kSignMask; | 1575 return READ_INT_FIELD(this, kExponentOffset) & kSignMask; |
1559 } | 1576 } |
1560 | 1577 |
| 1578 |
| 1579 bool Simd128Value::Equals(Simd128Value* that) { |
| 1580 // TODO(bmeurer): This doesn't match the SIMD.js specification, but it seems |
| 1581 // to be consistent with what the CompareICStub does, and what is tested in |
| 1582 // the current SIMD.js testsuite. |
| 1583 if (this == that) return true; |
| 1584 #define SIMD128_VALUE(TYPE, Type, type, lane_count, lane_type) \ |
| 1585 if (this->Is##Type()) { \ |
| 1586 if (!that->Is##Type()) return false; \ |
| 1587 return Type::cast(this)->Equals(Type::cast(that)); \ |
| 1588 } |
| 1589 SIMD128_TYPES(SIMD128_VALUE) |
| 1590 #undef SIMD128_VALUE |
| 1591 return false; |
| 1592 } |
| 1593 |
| 1594 |
| 1595 // static |
| 1596 bool Simd128Value::Equals(Handle<Simd128Value> one, Handle<Simd128Value> two) { |
| 1597 return one->Equals(*two); |
| 1598 } |
| 1599 |
| 1600 |
| 1601 #define SIMD128_VALUE_EQUALS(TYPE, Type, type, lane_count, lane_type) \ |
| 1602 bool Type::Equals(Type* that) { \ |
| 1603 for (int lane = 0; lane < lane_count; ++lane) { \ |
| 1604 if (this->get_lane(lane) != that->get_lane(lane)) return false; \ |
| 1605 } \ |
| 1606 return true; \ |
| 1607 } |
| 1608 SIMD128_TYPES(SIMD128_VALUE_EQUALS) |
| 1609 #undef SIMD128_VALUE_EQUALS |
| 1610 |
| 1611 |
| 1612 #if defined(V8_TARGET_LITTLE_ENDIAN) |
| 1613 #define SIMD128_READ_LANE(lane_type, lane_count, field_type, field_size) \ |
| 1614 lane_type value = \ |
| 1615 READ_##field_type##_FIELD(this, kValueOffset + lane * field_size); |
| 1616 #elif defined(V8_TARGET_BIG_ENDIAN) |
| 1617 #define SIMD128_READ_LANE(lane_type, lane_count, field_type, field_size) \ |
| 1618 lane_type value = READ_##field_type##_FIELD( \ |
| 1619 this, kValueOffset + (lane_count - lane - 1) * field_size); |
| 1620 #else |
| 1621 #error Unknown byte ordering |
| 1622 #endif |
| 1623 |
| 1624 #if defined(V8_TARGET_LITTLE_ENDIAN) |
| 1625 #define SIMD128_WRITE_LANE(lane_count, field_type, field_size, value) \ |
| 1626 WRITE_##field_type##_FIELD(this, kValueOffset + lane * field_size, value); |
| 1627 #elif defined(V8_TARGET_BIG_ENDIAN) |
| 1628 #define SIMD128_WRITE_LANE(lane_count, field_type, field_size, value) \ |
| 1629 WRITE_##field_type##_FIELD( \ |
| 1630 this, kValueOffset + (lane_count - lane - 1) * field_size, value); |
| 1631 #else |
| 1632 #error Unknown byte ordering |
| 1633 #endif |
| 1634 |
| 1635 #define SIMD128_NUMERIC_LANE_FNS(type, lane_type, lane_count, field_type, \ |
| 1636 field_size) \ |
| 1637 lane_type type::get_lane(int lane) const { \ |
| 1638 DCHECK(lane < lane_count && lane >= 0); \ |
| 1639 SIMD128_READ_LANE(lane_type, lane_count, field_type, field_size) \ |
| 1640 return value; \ |
| 1641 } \ |
| 1642 \ |
| 1643 void type::set_lane(int lane, lane_type value) { \ |
| 1644 DCHECK(lane < lane_count && lane >= 0); \ |
| 1645 SIMD128_WRITE_LANE(lane_count, field_type, field_size, value) \ |
| 1646 } |
| 1647 |
| 1648 SIMD128_NUMERIC_LANE_FNS(Float32x4, float, 4, FLOAT, kFloatSize) |
| 1649 SIMD128_NUMERIC_LANE_FNS(Int32x4, int32_t, 4, INT32, kInt32Size) |
| 1650 SIMD128_NUMERIC_LANE_FNS(Uint32x4, uint32_t, 4, UINT32, kInt32Size) |
| 1651 SIMD128_NUMERIC_LANE_FNS(Int16x8, int16_t, 8, INT16, kShortSize) |
| 1652 SIMD128_NUMERIC_LANE_FNS(Uint16x8, uint16_t, 8, UINT16, kShortSize) |
| 1653 SIMD128_NUMERIC_LANE_FNS(Int8x16, int8_t, 16, INT8, kCharSize) |
| 1654 SIMD128_NUMERIC_LANE_FNS(Uint8x16, uint8_t, 16, UINT8, kCharSize) |
| 1655 #undef SIMD128_NUMERIC_LANE_FNS |
| 1656 |
| 1657 |
| 1658 #define SIMD128_BOOLEAN_LANE_FNS(type, lane_type, lane_count, field_type, \ |
| 1659 field_size) \ |
| 1660 bool type::get_lane(int lane) const { \ |
| 1661 DCHECK(lane < lane_count && lane >= 0); \ |
| 1662 SIMD128_READ_LANE(lane_type, lane_count, field_type, field_size) \ |
| 1663 DCHECK(value == 0 || value == -1); \ |
| 1664 return value != 0; \ |
| 1665 } \ |
| 1666 \ |
| 1667 void type::set_lane(int lane, bool value) { \ |
| 1668 DCHECK(lane < lane_count && lane >= 0); \ |
| 1669 int32_t int_val = value ? -1 : 0; \ |
| 1670 SIMD128_WRITE_LANE(lane_count, field_type, field_size, int_val) \ |
| 1671 } |
| 1672 |
| 1673 SIMD128_BOOLEAN_LANE_FNS(Bool32x4, int32_t, 4, INT32, kInt32Size) |
| 1674 SIMD128_BOOLEAN_LANE_FNS(Bool16x8, int16_t, 8, INT16, kShortSize) |
| 1675 SIMD128_BOOLEAN_LANE_FNS(Bool8x16, int8_t, 16, INT8, kCharSize) |
| 1676 #undef SIMD128_BOOLEAN_LANE_FNS |
| 1677 |
| 1678 #undef SIMD128_READ_LANE |
| 1679 #undef SIMD128_WRITE_LANE |
| 1680 |
| 1681 |
1561 ACCESSORS(JSReceiver, properties, FixedArray, kPropertiesOffset) | 1682 ACCESSORS(JSReceiver, properties, FixedArray, kPropertiesOffset) |
1562 | 1683 |
1563 | 1684 |
1564 Object** FixedArray::GetFirstElementAddress() { | 1685 Object** FixedArray::GetFirstElementAddress() { |
1565 return reinterpret_cast<Object**>(FIELD_ADDR(this, OffsetOfElementAt(0))); | 1686 return reinterpret_cast<Object**>(FIELD_ADDR(this, OffsetOfElementAt(0))); |
1566 } | 1687 } |
1567 | 1688 |
1568 | 1689 |
1569 bool FixedArray::ContainsOnlySmisOrHoles() { | 1690 bool FixedArray::ContainsOnlySmisOrHoles() { |
1570 Object* the_hole = GetHeap()->the_hole_value(); | 1691 Object* the_hole = GetHeap()->the_hole_value(); |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2330 return Object::ToUint32(index) && *index != kMaxUInt32; | 2451 return Object::ToUint32(index) && *index != kMaxUInt32; |
2331 } | 2452 } |
2332 | 2453 |
2333 | 2454 |
2334 void Object::VerifyApiCallResultType() { | 2455 void Object::VerifyApiCallResultType() { |
2335 #if DEBUG | 2456 #if DEBUG |
2336 if (IsSmi()) return; | 2457 if (IsSmi()) return; |
2337 DCHECK(IsHeapObject()); | 2458 DCHECK(IsHeapObject()); |
2338 Isolate* isolate = HeapObject::cast(this)->GetIsolate(); | 2459 Isolate* isolate = HeapObject::cast(this)->GetIsolate(); |
2339 if (!(IsString() || IsSymbol() || IsJSReceiver() || IsHeapNumber() || | 2460 if (!(IsString() || IsSymbol() || IsJSReceiver() || IsHeapNumber() || |
2340 IsUndefined(isolate) || IsTrue(isolate) || IsFalse(isolate) || | 2461 IsSimd128Value() || IsUndefined(isolate) || IsTrue(isolate) || |
2341 IsNull(isolate))) { | 2462 IsFalse(isolate) || IsNull(isolate))) { |
2342 FATAL("API call returned invalid object"); | 2463 FATAL("API call returned invalid object"); |
2343 } | 2464 } |
2344 #endif // DEBUG | 2465 #endif // DEBUG |
2345 } | 2466 } |
2346 | 2467 |
2347 | 2468 |
2348 Object* FixedArray::get(int index) const { | 2469 Object* FixedArray::get(int index) const { |
2349 SLOW_DCHECK(index >= 0 && index < this->length()); | 2470 SLOW_DCHECK(index >= 0 && index < this->length()); |
2350 return NOBARRIER_READ_FIELD(this, kHeaderSize + index * kPointerSize); | 2471 return NOBARRIER_READ_FIELD(this, kHeaderSize + index * kPointerSize); |
2351 } | 2472 } |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2594 } | 2715 } |
2595 | 2716 |
2596 | 2717 |
2597 AllocationAlignment HeapObject::RequiredAlignment() { | 2718 AllocationAlignment HeapObject::RequiredAlignment() { |
2598 #ifdef V8_HOST_ARCH_32_BIT | 2719 #ifdef V8_HOST_ARCH_32_BIT |
2599 if ((IsFixedFloat64Array() || IsFixedDoubleArray()) && | 2720 if ((IsFixedFloat64Array() || IsFixedDoubleArray()) && |
2600 FixedArrayBase::cast(this)->length() != 0) { | 2721 FixedArrayBase::cast(this)->length() != 0) { |
2601 return kDoubleAligned; | 2722 return kDoubleAligned; |
2602 } | 2723 } |
2603 if (IsHeapNumber()) return kDoubleUnaligned; | 2724 if (IsHeapNumber()) return kDoubleUnaligned; |
| 2725 if (IsSimd128Value()) return kSimd128Unaligned; |
2604 #endif // V8_HOST_ARCH_32_BIT | 2726 #endif // V8_HOST_ARCH_32_BIT |
2605 return kWordAligned; | 2727 return kWordAligned; |
2606 } | 2728 } |
2607 | 2729 |
2608 | 2730 |
2609 void FixedArray::set(int index, | 2731 void FixedArray::set(int index, |
2610 Object* value, | 2732 Object* value, |
2611 WriteBarrierMode mode) { | 2733 WriteBarrierMode mode) { |
2612 DCHECK_NE(map(), GetHeap()->fixed_cow_array_map()); | 2734 DCHECK_NE(map(), GetHeap()->fixed_cow_array_map()); |
2613 DCHECK_GE(index, 0); | 2735 DCHECK_GE(index, 0); |
(...skipping 5658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8272 #undef WRITE_INT64_FIELD | 8394 #undef WRITE_INT64_FIELD |
8273 #undef READ_BYTE_FIELD | 8395 #undef READ_BYTE_FIELD |
8274 #undef WRITE_BYTE_FIELD | 8396 #undef WRITE_BYTE_FIELD |
8275 #undef NOBARRIER_READ_BYTE_FIELD | 8397 #undef NOBARRIER_READ_BYTE_FIELD |
8276 #undef NOBARRIER_WRITE_BYTE_FIELD | 8398 #undef NOBARRIER_WRITE_BYTE_FIELD |
8277 | 8399 |
8278 } // namespace internal | 8400 } // namespace internal |
8279 } // namespace v8 | 8401 } // namespace v8 |
8280 | 8402 |
8281 #endif // V8_OBJECTS_INL_H_ | 8403 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |