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

Side by Side Diff: src/objects-inl.h

Issue 7089002: Implement core support for FixedDoubleArrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: final version before commit Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-visiting.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 String::cast(this)->IsAsciiRepresentation(); 210 String::cast(this)->IsAsciiRepresentation();
211 } 211 }
212 212
213 213
214 bool Object::IsExternalTwoByteString() { 214 bool Object::IsExternalTwoByteString() {
215 if (!IsString()) return false; 215 if (!IsString()) return false;
216 return StringShape(String::cast(this)).IsExternal() && 216 return StringShape(String::cast(this)).IsExternal() &&
217 String::cast(this)->IsTwoByteRepresentation(); 217 String::cast(this)->IsTwoByteRepresentation();
218 } 218 }
219 219
220 bool Object::HasValidElements() {
221 // Dictionary is covered under FixedArray.
222 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray();
223 }
220 224
221 StringShape::StringShape(String* str) 225 StringShape::StringShape(String* str)
222 : type_(str->map()->instance_type()) { 226 : type_(str->map()->instance_type()) {
223 set_valid(); 227 set_valid();
224 ASSERT((type_ & kIsNotStringMask) == kStringTag); 228 ASSERT((type_ & kIsNotStringMask) == kStringTag);
225 } 229 }
226 230
227 231
228 StringShape::StringShape(Map* map) 232 StringShape::StringShape(Map* map)
229 : type_(map->instance_type()) { 233 : type_(map->instance_type()) {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 && HeapObject::cast(this)->map()->instance_type() == MAP_TYPE; 486 && HeapObject::cast(this)->map()->instance_type() == MAP_TYPE;
483 } 487 }
484 488
485 489
486 bool Object::IsFixedArray() { 490 bool Object::IsFixedArray() {
487 return Object::IsHeapObject() 491 return Object::IsHeapObject()
488 && HeapObject::cast(this)->map()->instance_type() == FIXED_ARRAY_TYPE; 492 && HeapObject::cast(this)->map()->instance_type() == FIXED_ARRAY_TYPE;
489 } 493 }
490 494
491 495
496 bool Object::IsFixedDoubleArray() {
497 return Object::IsHeapObject()
498 && HeapObject::cast(this)->map()->instance_type() ==
499 FIXED_DOUBLE_ARRAY_TYPE;
500 }
501
502
492 bool Object::IsDescriptorArray() { 503 bool Object::IsDescriptorArray() {
493 return IsFixedArray(); 504 return IsFixedArray();
494 } 505 }
495 506
496 507
497 bool Object::IsDeoptimizationInputData() { 508 bool Object::IsDeoptimizationInputData() {
498 // Must be a fixed array. 509 // Must be a fixed array.
499 if (!IsFixedArray()) return false; 510 if (!IsFixedArray()) return false;
500 511
501 // There's no sure way to detect the difference between a fixed array and 512 // There's no sure way to detect the difference between a fixed array and
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 int HeapNumber::get_sign() { 1322 int HeapNumber::get_sign() {
1312 return READ_INT_FIELD(this, kExponentOffset) & kSignMask; 1323 return READ_INT_FIELD(this, kExponentOffset) & kSignMask;
1313 } 1324 }
1314 1325
1315 1326
1316 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset) 1327 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset)
1317 1328
1318 1329
1319 HeapObject* JSObject::elements() { 1330 HeapObject* JSObject::elements() {
1320 Object* array = READ_FIELD(this, kElementsOffset); 1331 Object* array = READ_FIELD(this, kElementsOffset);
1321 // In the assert below Dictionary is covered under FixedArray. 1332 ASSERT(array->HasValidElements());
1322 ASSERT(array->IsFixedArray() || array->IsExternalArray());
1323 return reinterpret_cast<HeapObject*>(array); 1333 return reinterpret_cast<HeapObject*>(array);
1324 } 1334 }
1325 1335
1326 1336
1327 void JSObject::set_elements(HeapObject* value, WriteBarrierMode mode) { 1337 void JSObject::set_elements(HeapObject* value, WriteBarrierMode mode) {
1328 ASSERT(map()->has_fast_elements() == 1338 ASSERT(map()->has_fast_elements() ==
1329 (value->map() == GetHeap()->fixed_array_map() || 1339 (value->map() == GetHeap()->fixed_array_map() ||
1330 value->map() == GetHeap()->fixed_cow_array_map())); 1340 value->map() == GetHeap()->fixed_cow_array_map()));
1331 // In the assert below Dictionary is covered under FixedArray. 1341 ASSERT(value->HasValidElements());
1332 ASSERT(value->IsFixedArray() || value->IsExternalArray());
1333 WRITE_FIELD(this, kElementsOffset, value); 1342 WRITE_FIELD(this, kElementsOffset, value);
1334 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kElementsOffset, mode); 1343 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kElementsOffset, mode);
1335 } 1344 }
1336 1345
1337 1346
1338 void JSObject::initialize_properties() { 1347 void JSObject::initialize_properties() {
1339 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); 1348 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array()));
1340 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); 1349 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array());
1341 } 1350 }
1342 1351
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 JSValue* js_value = JSValue::cast(this); 1579 JSValue* js_value = JSValue::cast(this);
1571 if (!js_value->value()->IsString()) return false; 1580 if (!js_value->value()->IsString()) return false;
1572 1581
1573 String* str = String::cast(js_value->value()); 1582 String* str = String::cast(js_value->value());
1574 if (index >= (uint32_t)str->length()) return false; 1583 if (index >= (uint32_t)str->length()) return false;
1575 1584
1576 return true; 1585 return true;
1577 } 1586 }
1578 1587
1579 1588
1589 FixedArrayBase* FixedArrayBase::cast(Object* object) {
1590 ASSERT(object->IsFixedArray() || object->IsFixedDoubleArray());
1591 return reinterpret_cast<FixedArrayBase*>(object);
1592 }
1593
1594
1580 Object* FixedArray::get(int index) { 1595 Object* FixedArray::get(int index) {
1581 ASSERT(index >= 0 && index < this->length()); 1596 ASSERT(index >= 0 && index < this->length());
1582 return READ_FIELD(this, kHeaderSize + index * kPointerSize); 1597 return READ_FIELD(this, kHeaderSize + index * kPointerSize);
1583 } 1598 }
1584 1599
1585 1600
1586 void FixedArray::set(int index, Smi* value) { 1601 void FixedArray::set(int index, Smi* value) {
1587 ASSERT(map() != HEAP->fixed_cow_array_map()); 1602 ASSERT(map() != HEAP->fixed_cow_array_map());
1588 ASSERT(reinterpret_cast<Object*>(value)->IsSmi()); 1603 ASSERT(reinterpret_cast<Object*>(value)->IsSmi());
1589 int offset = kHeaderSize + index * kPointerSize; 1604 int offset = kHeaderSize + index * kPointerSize;
1590 WRITE_FIELD(this, offset, value); 1605 WRITE_FIELD(this, offset, value);
1591 } 1606 }
1592 1607
1593 1608
1594 void FixedArray::set(int index, Object* value) { 1609 void FixedArray::set(int index, Object* value) {
1595 ASSERT(map() != HEAP->fixed_cow_array_map()); 1610 ASSERT(map() != HEAP->fixed_cow_array_map());
1596 ASSERT(index >= 0 && index < this->length()); 1611 ASSERT(index >= 0 && index < this->length());
1597 int offset = kHeaderSize + index * kPointerSize; 1612 int offset = kHeaderSize + index * kPointerSize;
1598 WRITE_FIELD(this, offset, value); 1613 WRITE_FIELD(this, offset, value);
1599 WRITE_BARRIER(this, offset); 1614 WRITE_BARRIER(this, offset);
1600 } 1615 }
1601 1616
1602 1617
1618 double FixedDoubleArray::get(int index) {
1619 ASSERT(map() != HEAP->fixed_cow_array_map() &&
1620 map() != HEAP->fixed_array_map());
1621 ASSERT(index >= 0 && index < this->length());
1622 double result = READ_DOUBLE_FIELD(this, kHeaderSize + index * kDoubleSize);
1623 ASSERT(!is_the_hole_nan(result));
1624 return result;
1625 }
1626
1627
1628 void FixedDoubleArray::set(int index, double value) {
1629 ASSERT(map() != HEAP->fixed_cow_array_map() &&
1630 map() != HEAP->fixed_array_map());
1631 int offset = kHeaderSize + index * kDoubleSize;
1632 if (isnan(value)) value = canonical_not_the_hole_nan_as_double();
1633 WRITE_DOUBLE_FIELD(this, offset, value);
1634 }
1635
1636
1637 void FixedDoubleArray::set_the_hole(int index) {
1638 ASSERT(map() != HEAP->fixed_cow_array_map() &&
1639 map() != HEAP->fixed_array_map());
1640 int offset = kHeaderSize + index * kDoubleSize;
1641 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double());
1642 }
1643
1644
1645 bool FixedDoubleArray::is_the_hole(int index) {
1646 int offset = kHeaderSize + index * kDoubleSize;
1647 return is_the_hole_nan(READ_DOUBLE_FIELD(this, offset));
1648 }
1649
1650
1651 void FixedDoubleArray::Initialize(FixedDoubleArray* from) {
1652 int old_length = from->length();
1653 ASSERT(old_length < length());
1654 OS::MemCopy(FIELD_ADDR(this, kHeaderSize),
1655 FIELD_ADDR(from, kHeaderSize),
1656 old_length * kDoubleSize);
1657 int offset = kHeaderSize + old_length * kDoubleSize;
1658 for (int current = from->length(); current < length(); ++current) {
1659 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double());
1660 offset += kDoubleSize;
1661 }
1662 }
1663
1664
1665 void FixedDoubleArray::Initialize(FixedArray* from) {
1666 int old_length = from->length();
1667 ASSERT(old_length < length());
1668 for (int i = 0; i < old_length; i++) {
1669 Object* hole_or_object = from->get(i);
1670 if (hole_or_object->IsTheHole()) {
1671 set_the_hole(i);
1672 } else {
1673 set(i, hole_or_object->Number());
1674 }
1675 }
1676 int offset = kHeaderSize + old_length * kDoubleSize;
1677 for (int current = from->length(); current < length(); ++current) {
1678 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double());
1679 offset += kDoubleSize;
1680 }
1681 }
1682
1683
1684 void FixedDoubleArray::Initialize(NumberDictionary* from) {
1685 int offset = kHeaderSize;
1686 for (int current = 0; current < length(); ++current) {
1687 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double());
1688 offset += kDoubleSize;
1689 }
1690 for (int i = 0; i < from->Capacity(); i++) {
1691 Object* key = from->KeyAt(i);
1692 if (key->IsNumber()) {
1693 uint32_t entry = static_cast<uint32_t>(key->Number());
1694 set(entry, from->ValueAt(i)->Number());
1695 }
1696 }
1697 }
1698
1699
1603 WriteBarrierMode HeapObject::GetWriteBarrierMode(const AssertNoAllocation&) { 1700 WriteBarrierMode HeapObject::GetWriteBarrierMode(const AssertNoAllocation&) {
1604 if (GetHeap()->InNewSpace(this)) return SKIP_WRITE_BARRIER; 1701 if (GetHeap()->InNewSpace(this)) return SKIP_WRITE_BARRIER;
1605 return UPDATE_WRITE_BARRIER; 1702 return UPDATE_WRITE_BARRIER;
1606 } 1703 }
1607 1704
1608 1705
1609 void FixedArray::set(int index, 1706 void FixedArray::set(int index,
1610 Object* value, 1707 Object* value,
1611 WriteBarrierMode mode) { 1708 WriteBarrierMode mode) {
1612 ASSERT(map() != HEAP->fixed_cow_array_map()); 1709 ASSERT(map() != HEAP->fixed_cow_array_map());
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 void NumberDictionary::set_requires_slow_elements() { 1990 void NumberDictionary::set_requires_slow_elements() {
1894 set(kMaxNumberKeyIndex, Smi::FromInt(kRequiresSlowElementsMask)); 1991 set(kMaxNumberKeyIndex, Smi::FromInt(kRequiresSlowElementsMask));
1895 } 1992 }
1896 1993
1897 1994
1898 // ------------------------------------ 1995 // ------------------------------------
1899 // Cast operations 1996 // Cast operations
1900 1997
1901 1998
1902 CAST_ACCESSOR(FixedArray) 1999 CAST_ACCESSOR(FixedArray)
2000 CAST_ACCESSOR(FixedDoubleArray)
1903 CAST_ACCESSOR(DescriptorArray) 2001 CAST_ACCESSOR(DescriptorArray)
1904 CAST_ACCESSOR(DeoptimizationInputData) 2002 CAST_ACCESSOR(DeoptimizationInputData)
1905 CAST_ACCESSOR(DeoptimizationOutputData) 2003 CAST_ACCESSOR(DeoptimizationOutputData)
1906 CAST_ACCESSOR(SymbolTable) 2004 CAST_ACCESSOR(SymbolTable)
1907 CAST_ACCESSOR(JSFunctionResultCache) 2005 CAST_ACCESSOR(JSFunctionResultCache)
1908 CAST_ACCESSOR(NormalizedMapCache) 2006 CAST_ACCESSOR(NormalizedMapCache)
1909 CAST_ACCESSOR(CompilationCacheTable) 2007 CAST_ACCESSOR(CompilationCacheTable)
1910 CAST_ACCESSOR(CodeCacheHashTable) 2008 CAST_ACCESSOR(CodeCacheHashTable)
1911 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) 2009 CAST_ACCESSOR(PolymorphicCodeCacheHashTable)
1912 CAST_ACCESSOR(MapCache) 2010 CAST_ACCESSOR(MapCache)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 #undef MAKE_STRUCT_CAST 2055 #undef MAKE_STRUCT_CAST
1958 2056
1959 2057
1960 template <typename Shape, typename Key> 2058 template <typename Shape, typename Key>
1961 HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) { 2059 HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) {
1962 ASSERT(obj->IsHashTable()); 2060 ASSERT(obj->IsHashTable());
1963 return reinterpret_cast<HashTable*>(obj); 2061 return reinterpret_cast<HashTable*>(obj);
1964 } 2062 }
1965 2063
1966 2064
1967 SMI_ACCESSORS(FixedArray, length, kLengthOffset) 2065 SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset)
1968 SMI_ACCESSORS(ByteArray, length, kLengthOffset) 2066 SMI_ACCESSORS(ByteArray, length, kLengthOffset)
1969 2067
1970 INT_ACCESSORS(ExternalArray, length, kLengthOffset) 2068 INT_ACCESSORS(ExternalArray, length, kLengthOffset)
1971 2069
1972 2070
1973 SMI_ACCESSORS(String, length, kLengthOffset) 2071 SMI_ACCESSORS(String, length, kLengthOffset)
1974 2072
1975 2073
1976 uint32_t String::hash_field() { 2074 uint32_t String::hash_field() {
1977 return READ_UINT32_FIELD(this, kHashFieldOffset); 2075 return READ_UINT32_FIELD(this, kHashFieldOffset);
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
2416 return SeqAsciiString::SizeFor( 2514 return SeqAsciiString::SizeFor(
2417 reinterpret_cast<SeqAsciiString*>(this)->length()); 2515 reinterpret_cast<SeqAsciiString*>(this)->length());
2418 } 2516 }
2419 if (instance_type == BYTE_ARRAY_TYPE) { 2517 if (instance_type == BYTE_ARRAY_TYPE) {
2420 return reinterpret_cast<ByteArray*>(this)->ByteArraySize(); 2518 return reinterpret_cast<ByteArray*>(this)->ByteArraySize();
2421 } 2519 }
2422 if (instance_type == STRING_TYPE) { 2520 if (instance_type == STRING_TYPE) {
2423 return SeqTwoByteString::SizeFor( 2521 return SeqTwoByteString::SizeFor(
2424 reinterpret_cast<SeqTwoByteString*>(this)->length()); 2522 reinterpret_cast<SeqTwoByteString*>(this)->length());
2425 } 2523 }
2524 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) {
2525 return FixedDoubleArray::SizeFor(
2526 reinterpret_cast<FixedDoubleArray*>(this)->length());
2527 }
2426 ASSERT(instance_type == CODE_TYPE); 2528 ASSERT(instance_type == CODE_TYPE);
2427 return reinterpret_cast<Code*>(this)->CodeSize(); 2529 return reinterpret_cast<Code*>(this)->CodeSize();
2428 } 2530 }
2429 2531
2430 2532
2431 void Map::set_instance_size(int value) { 2533 void Map::set_instance_size(int value) {
2432 ASSERT_EQ(0, value & (kPointerSize - 1)); 2534 ASSERT_EQ(0, value & (kPointerSize - 1));
2433 value >>= kPointerSizeLog2; 2535 value >>= kPointerSizeLog2;
2434 ASSERT(0 <= value && value < 256); 2536 ASSERT(0 <= value && value < 256);
2435 WRITE_BYTE_FIELD(this, kInstanceSizeOffset, static_cast<byte>(value)); 2537 WRITE_BYTE_FIELD(this, kInstanceSizeOffset, static_cast<byte>(value));
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
2974 3076
2975 3077
2976 MaybeObject* Map::GetFastElementsMap() { 3078 MaybeObject* Map::GetFastElementsMap() {
2977 if (has_fast_elements()) return this; 3079 if (has_fast_elements()) return this;
2978 Object* obj; 3080 Object* obj;
2979 { MaybeObject* maybe_obj = CopyDropTransitions(); 3081 { MaybeObject* maybe_obj = CopyDropTransitions();
2980 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 3082 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
2981 } 3083 }
2982 Map* new_map = Map::cast(obj); 3084 Map* new_map = Map::cast(obj);
2983 new_map->set_elements_kind(JSObject::FAST_ELEMENTS); 3085 new_map->set_elements_kind(JSObject::FAST_ELEMENTS);
2984 isolate()->counters()->map_slow_to_fast_elements()->Increment(); 3086 isolate()->counters()->map_to_fast_elements()->Increment();
3087 return new_map;
3088 }
3089
3090
3091 MaybeObject* Map::GetFastDoubleElementsMap() {
3092 if (has_fast_double_elements()) return this;
3093 Object* obj;
3094 { MaybeObject* maybe_obj = CopyDropTransitions();
3095 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
3096 }
3097 Map* new_map = Map::cast(obj);
3098 new_map->set_elements_kind(JSObject::FAST_DOUBLE_ELEMENTS);
3099 isolate()->counters()->map_to_fast_double_elements()->Increment();
2985 return new_map; 3100 return new_map;
2986 } 3101 }
2987 3102
2988 3103
2989 MaybeObject* Map::GetSlowElementsMap() { 3104 MaybeObject* Map::GetSlowElementsMap() {
2990 if (!has_fast_elements()) return this; 3105 if (!has_fast_elements() && !has_fast_double_elements()) return this;
2991 Object* obj; 3106 Object* obj;
2992 { MaybeObject* maybe_obj = CopyDropTransitions(); 3107 { MaybeObject* maybe_obj = CopyDropTransitions();
2993 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 3108 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
2994 } 3109 }
2995 Map* new_map = Map::cast(obj); 3110 Map* new_map = Map::cast(obj);
2996 new_map->set_elements_kind(JSObject::DICTIONARY_ELEMENTS); 3111 new_map->set_elements_kind(JSObject::DICTIONARY_ELEMENTS);
2997 isolate()->counters()->map_fast_to_slow_elements()->Increment(); 3112 isolate()->counters()->map_to_slow_elements()->Increment();
2998 return new_map; 3113 return new_map;
2999 } 3114 }
3000 3115
3001 3116
3002 DescriptorArray* Map::instance_descriptors() { 3117 DescriptorArray* Map::instance_descriptors() {
3003 Object* object = READ_FIELD(this, kInstanceDescriptorsOrBitField3Offset); 3118 Object* object = READ_FIELD(this, kInstanceDescriptorsOrBitField3Offset);
3004 if (object->IsSmi()) { 3119 if (object->IsSmi()) {
3005 return HEAP->empty_descriptor_array(); 3120 return HEAP->empty_descriptor_array();
3006 } else { 3121 } else {
3007 return DescriptorArray::cast(object); 3122 return DescriptorArray::cast(object);
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
3781 ASSERT(index >= kDataIndex); // Only implementation data can be set this way. 3896 ASSERT(index >= kDataIndex); // Only implementation data can be set this way.
3782 FixedArray::cast(data())->set(index, value); 3897 FixedArray::cast(data())->set(index, value);
3783 } 3898 }
3784 3899
3785 3900
3786 JSObject::ElementsKind JSObject::GetElementsKind() { 3901 JSObject::ElementsKind JSObject::GetElementsKind() {
3787 ElementsKind kind = map()->elements_kind(); 3902 ElementsKind kind = map()->elements_kind();
3788 ASSERT((kind == FAST_ELEMENTS && 3903 ASSERT((kind == FAST_ELEMENTS &&
3789 (elements()->map() == GetHeap()->fixed_array_map() || 3904 (elements()->map() == GetHeap()->fixed_array_map() ||
3790 elements()->map() == GetHeap()->fixed_cow_array_map())) || 3905 elements()->map() == GetHeap()->fixed_cow_array_map())) ||
3906 (kind == FAST_DOUBLE_ELEMENTS &&
3907 elements()->IsFixedDoubleArray()) ||
3791 (kind == DICTIONARY_ELEMENTS && 3908 (kind == DICTIONARY_ELEMENTS &&
3792 elements()->IsFixedArray() && 3909 elements()->IsFixedArray() &&
3793 elements()->IsDictionary()) || 3910 elements()->IsDictionary()) ||
3794 (kind > DICTIONARY_ELEMENTS)); 3911 (kind > DICTIONARY_ELEMENTS));
3795 return kind; 3912 return kind;
3796 } 3913 }
3797 3914
3798 3915
3799 bool JSObject::HasFastElements() { 3916 bool JSObject::HasFastElements() {
3800 return GetElementsKind() == FAST_ELEMENTS; 3917 return GetElementsKind() == FAST_ELEMENTS;
3801 } 3918 }
3802 3919
3803 3920
3921 bool JSObject::HasFastDoubleElements() {
3922 return GetElementsKind() == FAST_DOUBLE_ELEMENTS;
3923 }
3924
3925
3804 bool JSObject::HasDictionaryElements() { 3926 bool JSObject::HasDictionaryElements() {
3805 return GetElementsKind() == DICTIONARY_ELEMENTS; 3927 return GetElementsKind() == DICTIONARY_ELEMENTS;
3806 } 3928 }
3807 3929
3808 3930
3809 bool JSObject::HasExternalArrayElements() { 3931 bool JSObject::HasExternalArrayElements() {
3810 HeapObject* array = elements(); 3932 HeapObject* array = elements();
3811 ASSERT(array != NULL); 3933 ASSERT(array != NULL);
3812 return array->IsExternalArray(); 3934 return array->IsExternalArray();
3813 } 3935 }
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
4306 #undef WRITE_INT_FIELD 4428 #undef WRITE_INT_FIELD
4307 #undef READ_SHORT_FIELD 4429 #undef READ_SHORT_FIELD
4308 #undef WRITE_SHORT_FIELD 4430 #undef WRITE_SHORT_FIELD
4309 #undef READ_BYTE_FIELD 4431 #undef READ_BYTE_FIELD
4310 #undef WRITE_BYTE_FIELD 4432 #undef WRITE_BYTE_FIELD
4311 4433
4312 4434
4313 } } // namespace v8::internal 4435 } } // namespace v8::internal
4314 4436
4315 #endif // V8_OBJECTS_INL_H_ 4437 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-visiting.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698