| 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) | |
| 178 TYPE_CHECKER(Symbol, SYMBOL_TYPE) | 177 TYPE_CHECKER(Symbol, SYMBOL_TYPE) |
| 179 TYPE_CHECKER(TransitionArray, TRANSITION_ARRAY_TYPE) | 178 TYPE_CHECKER(TransitionArray, TRANSITION_ARRAY_TYPE) |
| 180 TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE) | 179 TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE) |
| 181 TYPE_CHECKER(WeakFixedArray, FIXED_ARRAY_TYPE) | 180 TYPE_CHECKER(WeakFixedArray, FIXED_ARRAY_TYPE) |
| 182 | 181 |
| 183 #define TYPED_ARRAY_TYPE_CHECKER(Type, type, TYPE, ctype, size) \ | 182 #define TYPED_ARRAY_TYPE_CHECKER(Type, type, TYPE, ctype, size) \ |
| 184 TYPE_CHECKER(Fixed##Type##Array, FIXED_##TYPE##_ARRAY_TYPE) | 183 TYPE_CHECKER(Fixed##Type##Array, FIXED_##TYPE##_ARRAY_TYPE) |
| 185 TYPED_ARRAYS(TYPED_ARRAY_TYPE_CHECKER) | 184 TYPED_ARRAYS(TYPED_ARRAY_TYPE_CHECKER) |
| 186 #undef TYPED_ARRAY_TYPE_CHECKER | 185 #undef TYPED_ARRAY_TYPE_CHECKER |
| 187 | 186 |
| 188 #undef TYPE_CHECKER | 187 #undef TYPE_CHECKER |
| 189 | 188 |
| 190 bool HeapObject::IsFixedArrayBase() const { | 189 bool HeapObject::IsFixedArrayBase() const { |
| 191 return IsFixedArray() || IsFixedDoubleArray() || IsFixedTypedArrayBase(); | 190 return IsFixedArray() || IsFixedDoubleArray() || IsFixedTypedArrayBase(); |
| 192 } | 191 } |
| 193 | 192 |
| 194 bool HeapObject::IsFixedArray() const { | 193 bool HeapObject::IsFixedArray() const { |
| 195 InstanceType instance_type = map()->instance_type(); | 194 InstanceType instance_type = map()->instance_type(); |
| 196 return instance_type == FIXED_ARRAY_TYPE || | 195 return instance_type == FIXED_ARRAY_TYPE || |
| 197 instance_type == TRANSITION_ARRAY_TYPE; | 196 instance_type == TRANSITION_ARRAY_TYPE; |
| 198 } | 197 } |
| 199 | 198 |
| 200 bool HeapObject::IsBoilerplateDescription() const { return IsFixedArray(); } | 199 bool HeapObject::IsBoilerplateDescription() const { return IsFixedArray(); } |
| 201 | 200 |
| 202 // External objects are not extensible, so the map check is enough. | 201 // External objects are not extensible, so the map check is enough. |
| 203 bool HeapObject::IsExternal() const { | 202 bool HeapObject::IsExternal() const { |
| 204 return map() == GetHeap()->external_map(); | 203 return map() == GetHeap()->external_map(); |
| 205 } | 204 } |
| 206 | 205 |
| 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 | |
| 212 #define IS_TYPE_FUNCTION_DEF(type_) \ | 206 #define IS_TYPE_FUNCTION_DEF(type_) \ |
| 213 bool Object::Is##type_() const { \ | 207 bool Object::Is##type_() const { \ |
| 214 return IsHeapObject() && HeapObject::cast(this)->Is##type_(); \ | 208 return IsHeapObject() && HeapObject::cast(this)->Is##type_(); \ |
| 215 } | 209 } |
| 216 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DEF) | 210 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DEF) |
| 217 #undef IS_TYPE_FUNCTION_DEF | 211 #undef IS_TYPE_FUNCTION_DEF |
| 218 | 212 |
| 219 #define IS_TYPE_FUNCTION_DEF(Type, Value) \ | 213 #define IS_TYPE_FUNCTION_DEF(Type, Value) \ |
| 220 bool Object::Is##Type(Isolate* isolate) const { \ | 214 bool Object::Is##Type(Isolate* isolate) const { \ |
| 221 return this == isolate->heap()->Value(); \ | 215 return this == isolate->heap()->Value(); \ |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 return reinterpret_cast<type*>(object); \ | 604 return reinterpret_cast<type*>(object); \ |
| 611 } \ | 605 } \ |
| 612 const type* type::cast(const Object* object) { \ | 606 const type* type::cast(const Object* object) { \ |
| 613 SLOW_DCHECK(object->Is##type()); \ | 607 SLOW_DCHECK(object->Is##type()); \ |
| 614 return reinterpret_cast<const type*>(object); \ | 608 return reinterpret_cast<const type*>(object); \ |
| 615 } | 609 } |
| 616 | 610 |
| 617 CAST_ACCESSOR(AbstractCode) | 611 CAST_ACCESSOR(AbstractCode) |
| 618 CAST_ACCESSOR(ArrayList) | 612 CAST_ACCESSOR(ArrayList) |
| 619 CAST_ACCESSOR(BoilerplateDescription) | 613 CAST_ACCESSOR(BoilerplateDescription) |
| 620 CAST_ACCESSOR(Bool16x8) | |
| 621 CAST_ACCESSOR(Bool32x4) | |
| 622 CAST_ACCESSOR(Bool8x16) | |
| 623 CAST_ACCESSOR(ByteArray) | 614 CAST_ACCESSOR(ByteArray) |
| 624 CAST_ACCESSOR(BytecodeArray) | 615 CAST_ACCESSOR(BytecodeArray) |
| 625 CAST_ACCESSOR(Cell) | 616 CAST_ACCESSOR(Cell) |
| 626 CAST_ACCESSOR(Code) | 617 CAST_ACCESSOR(Code) |
| 627 CAST_ACCESSOR(CodeCacheHashTable) | 618 CAST_ACCESSOR(CodeCacheHashTable) |
| 628 CAST_ACCESSOR(CompilationCacheTable) | 619 CAST_ACCESSOR(CompilationCacheTable) |
| 629 CAST_ACCESSOR(ConsString) | 620 CAST_ACCESSOR(ConsString) |
| 630 CAST_ACCESSOR(DeoptimizationInputData) | 621 CAST_ACCESSOR(DeoptimizationInputData) |
| 631 CAST_ACCESSOR(DeoptimizationOutputData) | 622 CAST_ACCESSOR(DeoptimizationOutputData) |
| 632 CAST_ACCESSOR(DependentCode) | 623 CAST_ACCESSOR(DependentCode) |
| 633 CAST_ACCESSOR(DescriptorArray) | 624 CAST_ACCESSOR(DescriptorArray) |
| 634 CAST_ACCESSOR(ExternalOneByteString) | 625 CAST_ACCESSOR(ExternalOneByteString) |
| 635 CAST_ACCESSOR(ExternalString) | 626 CAST_ACCESSOR(ExternalString) |
| 636 CAST_ACCESSOR(ExternalTwoByteString) | 627 CAST_ACCESSOR(ExternalTwoByteString) |
| 637 CAST_ACCESSOR(FixedArray) | 628 CAST_ACCESSOR(FixedArray) |
| 638 CAST_ACCESSOR(FixedArrayBase) | 629 CAST_ACCESSOR(FixedArrayBase) |
| 639 CAST_ACCESSOR(FixedDoubleArray) | 630 CAST_ACCESSOR(FixedDoubleArray) |
| 640 CAST_ACCESSOR(FixedTypedArrayBase) | 631 CAST_ACCESSOR(FixedTypedArrayBase) |
| 641 CAST_ACCESSOR(Float32x4) | |
| 642 CAST_ACCESSOR(Foreign) | 632 CAST_ACCESSOR(Foreign) |
| 643 CAST_ACCESSOR(FrameArray) | 633 CAST_ACCESSOR(FrameArray) |
| 644 CAST_ACCESSOR(GlobalDictionary) | 634 CAST_ACCESSOR(GlobalDictionary) |
| 645 CAST_ACCESSOR(HandlerTable) | 635 CAST_ACCESSOR(HandlerTable) |
| 646 CAST_ACCESSOR(HeapObject) | 636 CAST_ACCESSOR(HeapObject) |
| 647 CAST_ACCESSOR(Int16x8) | |
| 648 CAST_ACCESSOR(Int32x4) | |
| 649 CAST_ACCESSOR(Int8x16) | |
| 650 CAST_ACCESSOR(JSArray) | 637 CAST_ACCESSOR(JSArray) |
| 651 CAST_ACCESSOR(JSArrayBuffer) | 638 CAST_ACCESSOR(JSArrayBuffer) |
| 652 CAST_ACCESSOR(JSArrayBufferView) | 639 CAST_ACCESSOR(JSArrayBufferView) |
| 653 CAST_ACCESSOR(JSBoundFunction) | 640 CAST_ACCESSOR(JSBoundFunction) |
| 654 CAST_ACCESSOR(JSDataView) | 641 CAST_ACCESSOR(JSDataView) |
| 655 CAST_ACCESSOR(JSDate) | 642 CAST_ACCESSOR(JSDate) |
| 656 CAST_ACCESSOR(JSFunction) | 643 CAST_ACCESSOR(JSFunction) |
| 657 CAST_ACCESSOR(JSGeneratorObject) | 644 CAST_ACCESSOR(JSGeneratorObject) |
| 658 CAST_ACCESSOR(JSGlobalObject) | 645 CAST_ACCESSOR(JSGlobalObject) |
| 659 CAST_ACCESSOR(JSGlobalProxy) | 646 CAST_ACCESSOR(JSGlobalProxy) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 690 CAST_ACCESSOR(OrderedHashSet) | 677 CAST_ACCESSOR(OrderedHashSet) |
| 691 CAST_ACCESSOR(PropertyCell) | 678 CAST_ACCESSOR(PropertyCell) |
| 692 CAST_ACCESSOR(TemplateList) | 679 CAST_ACCESSOR(TemplateList) |
| 693 CAST_ACCESSOR(RegExpMatchInfo) | 680 CAST_ACCESSOR(RegExpMatchInfo) |
| 694 CAST_ACCESSOR(ScopeInfo) | 681 CAST_ACCESSOR(ScopeInfo) |
| 695 CAST_ACCESSOR(SeededNumberDictionary) | 682 CAST_ACCESSOR(SeededNumberDictionary) |
| 696 CAST_ACCESSOR(SeqOneByteString) | 683 CAST_ACCESSOR(SeqOneByteString) |
| 697 CAST_ACCESSOR(SeqString) | 684 CAST_ACCESSOR(SeqString) |
| 698 CAST_ACCESSOR(SeqTwoByteString) | 685 CAST_ACCESSOR(SeqTwoByteString) |
| 699 CAST_ACCESSOR(SharedFunctionInfo) | 686 CAST_ACCESSOR(SharedFunctionInfo) |
| 700 CAST_ACCESSOR(Simd128Value) | |
| 701 CAST_ACCESSOR(SlicedString) | 687 CAST_ACCESSOR(SlicedString) |
| 702 CAST_ACCESSOR(Smi) | 688 CAST_ACCESSOR(Smi) |
| 703 CAST_ACCESSOR(String) | 689 CAST_ACCESSOR(String) |
| 704 CAST_ACCESSOR(StringSet) | 690 CAST_ACCESSOR(StringSet) |
| 705 CAST_ACCESSOR(StringTable) | 691 CAST_ACCESSOR(StringTable) |
| 706 CAST_ACCESSOR(Struct) | 692 CAST_ACCESSOR(Struct) |
| 707 CAST_ACCESSOR(Symbol) | 693 CAST_ACCESSOR(Symbol) |
| 708 CAST_ACCESSOR(TemplateInfo) | 694 CAST_ACCESSOR(TemplateInfo) |
| 709 CAST_ACCESSOR(ThinString) | 695 CAST_ACCESSOR(ThinString) |
| 710 CAST_ACCESSOR(Uint16x8) | |
| 711 CAST_ACCESSOR(Uint32x4) | |
| 712 CAST_ACCESSOR(Uint8x16) | |
| 713 CAST_ACCESSOR(UnseededNumberDictionary) | 696 CAST_ACCESSOR(UnseededNumberDictionary) |
| 714 CAST_ACCESSOR(WeakCell) | 697 CAST_ACCESSOR(WeakCell) |
| 715 CAST_ACCESSOR(WeakFixedArray) | 698 CAST_ACCESSOR(WeakFixedArray) |
| 716 CAST_ACCESSOR(WeakHashTable) | 699 CAST_ACCESSOR(WeakHashTable) |
| 717 | 700 |
| 718 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name) | 701 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name) |
| 719 STRUCT_LIST(MAKE_STRUCT_CAST) | 702 STRUCT_LIST(MAKE_STRUCT_CAST) |
| 720 #undef MAKE_STRUCT_CAST | 703 #undef MAKE_STRUCT_CAST |
| 721 | 704 |
| 722 #undef CAST_ACCESSOR | 705 #undef CAST_ACCESSOR |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1568 int HeapNumber::get_exponent() { | 1551 int HeapNumber::get_exponent() { |
| 1569 return ((READ_INT_FIELD(this, kExponentOffset) & kExponentMask) >> | 1552 return ((READ_INT_FIELD(this, kExponentOffset) & kExponentMask) >> |
| 1570 kExponentShift) - kExponentBias; | 1553 kExponentShift) - kExponentBias; |
| 1571 } | 1554 } |
| 1572 | 1555 |
| 1573 | 1556 |
| 1574 int HeapNumber::get_sign() { | 1557 int HeapNumber::get_sign() { |
| 1575 return READ_INT_FIELD(this, kExponentOffset) & kSignMask; | 1558 return READ_INT_FIELD(this, kExponentOffset) & kSignMask; |
| 1576 } | 1559 } |
| 1577 | 1560 |
| 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 | |
| 1682 ACCESSORS(JSReceiver, properties, FixedArray, kPropertiesOffset) | 1561 ACCESSORS(JSReceiver, properties, FixedArray, kPropertiesOffset) |
| 1683 | 1562 |
| 1684 | 1563 |
| 1685 Object** FixedArray::GetFirstElementAddress() { | 1564 Object** FixedArray::GetFirstElementAddress() { |
| 1686 return reinterpret_cast<Object**>(FIELD_ADDR(this, OffsetOfElementAt(0))); | 1565 return reinterpret_cast<Object**>(FIELD_ADDR(this, OffsetOfElementAt(0))); |
| 1687 } | 1566 } |
| 1688 | 1567 |
| 1689 | 1568 |
| 1690 bool FixedArray::ContainsOnlySmisOrHoles() { | 1569 bool FixedArray::ContainsOnlySmisOrHoles() { |
| 1691 Object* the_hole = GetHeap()->the_hole_value(); | 1570 Object* the_hole = GetHeap()->the_hole_value(); |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2451 return Object::ToUint32(index) && *index != kMaxUInt32; | 2330 return Object::ToUint32(index) && *index != kMaxUInt32; |
| 2452 } | 2331 } |
| 2453 | 2332 |
| 2454 | 2333 |
| 2455 void Object::VerifyApiCallResultType() { | 2334 void Object::VerifyApiCallResultType() { |
| 2456 #if DEBUG | 2335 #if DEBUG |
| 2457 if (IsSmi()) return; | 2336 if (IsSmi()) return; |
| 2458 DCHECK(IsHeapObject()); | 2337 DCHECK(IsHeapObject()); |
| 2459 Isolate* isolate = HeapObject::cast(this)->GetIsolate(); | 2338 Isolate* isolate = HeapObject::cast(this)->GetIsolate(); |
| 2460 if (!(IsString() || IsSymbol() || IsJSReceiver() || IsHeapNumber() || | 2339 if (!(IsString() || IsSymbol() || IsJSReceiver() || IsHeapNumber() || |
| 2461 IsSimd128Value() || IsUndefined(isolate) || IsTrue(isolate) || | 2340 IsUndefined(isolate) || IsTrue(isolate) || IsFalse(isolate) || |
| 2462 IsFalse(isolate) || IsNull(isolate))) { | 2341 IsNull(isolate))) { |
| 2463 FATAL("API call returned invalid object"); | 2342 FATAL("API call returned invalid object"); |
| 2464 } | 2343 } |
| 2465 #endif // DEBUG | 2344 #endif // DEBUG |
| 2466 } | 2345 } |
| 2467 | 2346 |
| 2468 | 2347 |
| 2469 Object* FixedArray::get(int index) const { | 2348 Object* FixedArray::get(int index) const { |
| 2470 SLOW_DCHECK(index >= 0 && index < this->length()); | 2349 SLOW_DCHECK(index >= 0 && index < this->length()); |
| 2471 return NOBARRIER_READ_FIELD(this, kHeaderSize + index * kPointerSize); | 2350 return NOBARRIER_READ_FIELD(this, kHeaderSize + index * kPointerSize); |
| 2472 } | 2351 } |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2715 } | 2594 } |
| 2716 | 2595 |
| 2717 | 2596 |
| 2718 AllocationAlignment HeapObject::RequiredAlignment() { | 2597 AllocationAlignment HeapObject::RequiredAlignment() { |
| 2719 #ifdef V8_HOST_ARCH_32_BIT | 2598 #ifdef V8_HOST_ARCH_32_BIT |
| 2720 if ((IsFixedFloat64Array() || IsFixedDoubleArray()) && | 2599 if ((IsFixedFloat64Array() || IsFixedDoubleArray()) && |
| 2721 FixedArrayBase::cast(this)->length() != 0) { | 2600 FixedArrayBase::cast(this)->length() != 0) { |
| 2722 return kDoubleAligned; | 2601 return kDoubleAligned; |
| 2723 } | 2602 } |
| 2724 if (IsHeapNumber()) return kDoubleUnaligned; | 2603 if (IsHeapNumber()) return kDoubleUnaligned; |
| 2725 if (IsSimd128Value()) return kSimd128Unaligned; | |
| 2726 #endif // V8_HOST_ARCH_32_BIT | 2604 #endif // V8_HOST_ARCH_32_BIT |
| 2727 return kWordAligned; | 2605 return kWordAligned; |
| 2728 } | 2606 } |
| 2729 | 2607 |
| 2730 | 2608 |
| 2731 void FixedArray::set(int index, | 2609 void FixedArray::set(int index, |
| 2732 Object* value, | 2610 Object* value, |
| 2733 WriteBarrierMode mode) { | 2611 WriteBarrierMode mode) { |
| 2734 DCHECK_NE(map(), GetHeap()->fixed_cow_array_map()); | 2612 DCHECK_NE(map(), GetHeap()->fixed_cow_array_map()); |
| 2735 DCHECK_GE(index, 0); | 2613 DCHECK_GE(index, 0); |
| (...skipping 5658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8394 #undef WRITE_INT64_FIELD | 8272 #undef WRITE_INT64_FIELD |
| 8395 #undef READ_BYTE_FIELD | 8273 #undef READ_BYTE_FIELD |
| 8396 #undef WRITE_BYTE_FIELD | 8274 #undef WRITE_BYTE_FIELD |
| 8397 #undef NOBARRIER_READ_BYTE_FIELD | 8275 #undef NOBARRIER_READ_BYTE_FIELD |
| 8398 #undef NOBARRIER_WRITE_BYTE_FIELD | 8276 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 8399 | 8277 |
| 8400 } // namespace internal | 8278 } // namespace internal |
| 8401 } // namespace v8 | 8279 } // namespace v8 |
| 8402 | 8280 |
| 8403 #endif // V8_OBJECTS_INL_H_ | 8281 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |