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

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

Issue 133443009: A64: Synchronize with r17441. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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-printer.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 #define TYPE_CHECKER(type, instancetype) \ 74 #define TYPE_CHECKER(type, instancetype) \
75 bool Object::Is##type() { \ 75 bool Object::Is##type() { \
76 return Object::IsHeapObject() && \ 76 return Object::IsHeapObject() && \
77 HeapObject::cast(this)->map()->instance_type() == instancetype; \ 77 HeapObject::cast(this)->map()->instance_type() == instancetype; \
78 } 78 }
79 79
80 80
81 #define CAST_ACCESSOR(type) \ 81 #define CAST_ACCESSOR(type) \
82 type* type::cast(Object* object) { \ 82 type* type::cast(Object* object) { \
83 ASSERT(object->Is##type()); \ 83 SLOW_ASSERT(object->Is##type()); \
84 return reinterpret_cast<type*>(object); \ 84 return reinterpret_cast<type*>(object); \
85 } 85 }
86 86
87 87
88 #define INT_ACCESSORS(holder, name, offset) \ 88 #define INT_ACCESSORS(holder, name, offset) \
89 int holder::name() { return READ_INT_FIELD(this, offset); } \ 89 int holder::name() { return READ_INT_FIELD(this, offset); } \
90 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); } 90 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); }
91 91
92 92
93 #define ACCESSORS(holder, name, type, offset) \ 93 #define ACCESSORS(holder, name, type, offset) \
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 #define BOOL_ACCESSORS(holder, field, name, offset) \ 126 #define BOOL_ACCESSORS(holder, field, name, offset) \
127 bool holder::name() { \ 127 bool holder::name() { \
128 return BooleanBit::get(field(), offset); \ 128 return BooleanBit::get(field(), offset); \
129 } \ 129 } \
130 void holder::set_##name(bool value) { \ 130 void holder::set_##name(bool value) { \
131 set_##field(BooleanBit::set(field(), offset, value)); \ 131 set_##field(BooleanBit::set(field(), offset, value)); \
132 } 132 }
133 133
134 134
135 bool Object::IsFixedArrayBase() { 135 bool Object::IsFixedArrayBase() {
136 return IsFixedArray() || IsFixedDoubleArray(); 136 return IsFixedArray() || IsFixedDoubleArray() || IsConstantPoolArray();
137 } 137 }
138 138
139 139
140 // External objects are not extensible, so the map check is enough. 140 // External objects are not extensible, so the map check is enough.
141 bool Object::IsExternal() { 141 bool Object::IsExternal() {
142 return Object::IsHeapObject() && 142 return Object::IsHeapObject() &&
143 HeapObject::cast(this)->map() == 143 HeapObject::cast(this)->map() ==
144 HeapObject::cast(this)->GetHeap()->external_map(); 144 HeapObject::cast(this)->GetHeap()->external_map();
145 } 145 }
146 146
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 564
565 TYPE_CHECKER(JSFunctionProxy, JS_FUNCTION_PROXY_TYPE) 565 TYPE_CHECKER(JSFunctionProxy, JS_FUNCTION_PROXY_TYPE)
566 TYPE_CHECKER(JSSet, JS_SET_TYPE) 566 TYPE_CHECKER(JSSet, JS_SET_TYPE)
567 TYPE_CHECKER(JSMap, JS_MAP_TYPE) 567 TYPE_CHECKER(JSMap, JS_MAP_TYPE)
568 TYPE_CHECKER(JSWeakMap, JS_WEAK_MAP_TYPE) 568 TYPE_CHECKER(JSWeakMap, JS_WEAK_MAP_TYPE)
569 TYPE_CHECKER(JSWeakSet, JS_WEAK_SET_TYPE) 569 TYPE_CHECKER(JSWeakSet, JS_WEAK_SET_TYPE)
570 TYPE_CHECKER(JSContextExtensionObject, JS_CONTEXT_EXTENSION_OBJECT_TYPE) 570 TYPE_CHECKER(JSContextExtensionObject, JS_CONTEXT_EXTENSION_OBJECT_TYPE)
571 TYPE_CHECKER(Map, MAP_TYPE) 571 TYPE_CHECKER(Map, MAP_TYPE)
572 TYPE_CHECKER(FixedArray, FIXED_ARRAY_TYPE) 572 TYPE_CHECKER(FixedArray, FIXED_ARRAY_TYPE)
573 TYPE_CHECKER(FixedDoubleArray, FIXED_DOUBLE_ARRAY_TYPE) 573 TYPE_CHECKER(FixedDoubleArray, FIXED_DOUBLE_ARRAY_TYPE)
574 TYPE_CHECKER(ConstantPoolArray, CONSTANT_POOL_ARRAY_TYPE)
574 575
575 576
576 bool Object::IsJSWeakCollection() { 577 bool Object::IsJSWeakCollection() {
577 return IsJSWeakMap() || IsJSWeakSet(); 578 return IsJSWeakMap() || IsJSWeakSet();
578 } 579 }
579 580
580 581
581 bool Object::IsDescriptorArray() { 582 bool Object::IsDescriptorArray() {
582 return IsFixedArray(); 583 return IsFixedArray();
583 } 584 }
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 1021
1021 #define WRITE_INTPTR_FIELD(p, offset, value) \ 1022 #define WRITE_INTPTR_FIELD(p, offset, value) \
1022 (*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset)) = value) 1023 (*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset)) = value)
1023 1024
1024 #define READ_UINT32_FIELD(p, offset) \ 1025 #define READ_UINT32_FIELD(p, offset) \
1025 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset))) 1026 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)))
1026 1027
1027 #define WRITE_UINT32_FIELD(p, offset, value) \ 1028 #define WRITE_UINT32_FIELD(p, offset, value) \
1028 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)) = value) 1029 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)) = value)
1029 1030
1031 #define READ_INT32_FIELD(p, offset) \
1032 (*reinterpret_cast<int32_t*>(FIELD_ADDR(p, offset)))
1033
1034 #define WRITE_INT32_FIELD(p, offset, value) \
1035 (*reinterpret_cast<int32_t*>(FIELD_ADDR(p, offset)) = value)
1036
1030 #define READ_INT64_FIELD(p, offset) \ 1037 #define READ_INT64_FIELD(p, offset) \
1031 (*reinterpret_cast<int64_t*>(FIELD_ADDR(p, offset))) 1038 (*reinterpret_cast<int64_t*>(FIELD_ADDR(p, offset)))
1032 1039
1033 #define WRITE_INT64_FIELD(p, offset, value) \ 1040 #define WRITE_INT64_FIELD(p, offset, value) \
1034 (*reinterpret_cast<int64_t*>(FIELD_ADDR(p, offset)) = value) 1041 (*reinterpret_cast<int64_t*>(FIELD_ADDR(p, offset)) = value)
1035 1042
1036 #define READ_SHORT_FIELD(p, offset) \ 1043 #define READ_SHORT_FIELD(p, offset) \
1037 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset))) 1044 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)))
1038 1045
1039 #define WRITE_SHORT_FIELD(p, offset, value) \ 1046 #define WRITE_SHORT_FIELD(p, offset, value) \
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 1183
1177 void HeapObject::VerifySmiField(int offset) { 1184 void HeapObject::VerifySmiField(int offset) {
1178 CHECK(READ_FIELD(this, offset)->IsSmi()); 1185 CHECK(READ_FIELD(this, offset)->IsSmi());
1179 } 1186 }
1180 #endif 1187 #endif
1181 1188
1182 1189
1183 Heap* HeapObject::GetHeap() { 1190 Heap* HeapObject::GetHeap() {
1184 Heap* heap = 1191 Heap* heap =
1185 MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap(); 1192 MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap();
1186 ASSERT(heap != NULL); 1193 SLOW_ASSERT(heap != NULL);
1187 return heap; 1194 return heap;
1188 } 1195 }
1189 1196
1190 1197
1191 Isolate* HeapObject::GetIsolate() { 1198 Isolate* HeapObject::GetIsolate() {
1192 return GetHeap()->isolate(); 1199 return GetHeap()->isolate();
1193 } 1200 }
1194 1201
1195 1202
1196 Map* HeapObject::map() { 1203 Map* HeapObject::map() {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 } 1300 }
1294 1301
1295 1302
1296 FixedArrayBase* JSObject::elements() { 1303 FixedArrayBase* JSObject::elements() {
1297 Object* array = READ_FIELD(this, kElementsOffset); 1304 Object* array = READ_FIELD(this, kElementsOffset);
1298 return static_cast<FixedArrayBase*>(array); 1305 return static_cast<FixedArrayBase*>(array);
1299 } 1306 }
1300 1307
1301 1308
1302 void JSObject::ValidateElements() { 1309 void JSObject::ValidateElements() {
1303 #if DEBUG 1310 #ifdef ENABLE_SLOW_ASSERTS
1304 if (FLAG_enable_slow_asserts) { 1311 if (FLAG_enable_slow_asserts) {
1305 ElementsAccessor* accessor = GetElementsAccessor(); 1312 ElementsAccessor* accessor = GetElementsAccessor();
1306 accessor->Validate(this); 1313 accessor->Validate(this);
1307 } 1314 }
1308 #endif 1315 #endif
1309 } 1316 }
1310 1317
1311 1318
1312 bool JSObject::ShouldTrackAllocationInfo() { 1319 bool JSObject::ShouldTrackAllocationInfo() {
1313 if (AllocationSite::CanTrack(map()->instance_type())) { 1320 if (AllocationSite::CanTrack(map()->instance_type())) {
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 return JSWeakMap::kSize; 1660 return JSWeakMap::kSize;
1654 case JS_WEAK_SET_TYPE: 1661 case JS_WEAK_SET_TYPE:
1655 return JSWeakSet::kSize; 1662 return JSWeakSet::kSize;
1656 case JS_REGEXP_TYPE: 1663 case JS_REGEXP_TYPE:
1657 return JSRegExp::kSize; 1664 return JSRegExp::kSize;
1658 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: 1665 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
1659 return JSObject::kHeaderSize; 1666 return JSObject::kHeaderSize;
1660 case JS_MESSAGE_OBJECT_TYPE: 1667 case JS_MESSAGE_OBJECT_TYPE:
1661 return JSMessageObject::kSize; 1668 return JSMessageObject::kSize;
1662 default: 1669 default:
1663 UNREACHABLE(); 1670 // TODO(jkummerow): Re-enable this. Blink currently hits this
1671 // from its CustomElementConstructorBuilder.
1672 // UNREACHABLE();
1664 return 0; 1673 return 0;
1665 } 1674 }
1666 } 1675 }
1667 1676
1668 1677
1669 int JSObject::GetInternalFieldCount() { 1678 int JSObject::GetInternalFieldCount() {
1670 ASSERT(1 << kPointerSizeLog2 == kPointerSize); 1679 ASSERT(1 << kPointerSizeLog2 == kPointerSize);
1671 // Make sure to adjust for the number of in-object properties. These 1680 // Make sure to adjust for the number of in-object properties. These
1672 // properties do contribute to the size, but are not internal fields. 1681 // properties do contribute to the size, but are not internal fields.
1673 return ((Size() - GetHeaderSize()) >> kPointerSizeLog2) - 1682 return ((Size() - GetHeaderSize()) >> kPointerSizeLog2) -
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 IsTrue() || 1889 IsTrue() ||
1881 IsFalse() || 1890 IsFalse() ||
1882 IsNull())) { 1891 IsNull())) {
1883 FATAL("API call returned invalid object"); 1892 FATAL("API call returned invalid object");
1884 } 1893 }
1885 #endif // ENABLE_EXTRA_CHECKS 1894 #endif // ENABLE_EXTRA_CHECKS
1886 } 1895 }
1887 1896
1888 1897
1889 FixedArrayBase* FixedArrayBase::cast(Object* object) { 1898 FixedArrayBase* FixedArrayBase::cast(Object* object) {
1890 ASSERT(object->IsFixedArray() || object->IsFixedDoubleArray()); 1899 ASSERT(object->IsFixedArray() || object->IsFixedDoubleArray() ||
1900 object->IsConstantPoolArray());
1891 return reinterpret_cast<FixedArrayBase*>(object); 1901 return reinterpret_cast<FixedArrayBase*>(object);
1892 } 1902 }
1893 1903
1894 1904
1895 Object* FixedArray::get(int index) { 1905 Object* FixedArray::get(int index) {
1896 ASSERT(index >= 0 && index < this->length()); 1906 SLOW_ASSERT(index >= 0 && index < this->length());
1897 return READ_FIELD(this, kHeaderSize + index * kPointerSize); 1907 return READ_FIELD(this, kHeaderSize + index * kPointerSize);
1898 } 1908 }
1899 1909
1900 1910
1901 bool FixedArray::is_the_hole(int index) { 1911 bool FixedArray::is_the_hole(int index) {
1902 return get(index) == GetHeap()->the_hole_value(); 1912 return get(index) == GetHeap()->the_hole_value();
1903 } 1913 }
1904 1914
1905 1915
1906 void FixedArray::set(int index, Smi* value) { 1916 void FixedArray::set(int index, Smi* value) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1979 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double()); 1989 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double());
1980 } 1990 }
1981 1991
1982 1992
1983 bool FixedDoubleArray::is_the_hole(int index) { 1993 bool FixedDoubleArray::is_the_hole(int index) {
1984 int offset = kHeaderSize + index * kDoubleSize; 1994 int offset = kHeaderSize + index * kDoubleSize;
1985 return is_the_hole_nan(READ_DOUBLE_FIELD(this, offset)); 1995 return is_the_hole_nan(READ_DOUBLE_FIELD(this, offset));
1986 } 1996 }
1987 1997
1988 1998
1999 SMI_ACCESSORS(ConstantPoolArray, first_ptr_index, kFirstPointerIndexOffset)
2000 SMI_ACCESSORS(ConstantPoolArray, first_int32_index, kFirstInt32IndexOffset)
2001
2002
2003 int ConstantPoolArray::first_int64_index() {
2004 return 0;
2005 }
2006
2007
2008 int ConstantPoolArray::count_of_int64_entries() {
2009 return first_ptr_index();
2010 }
2011
2012
2013 int ConstantPoolArray::count_of_ptr_entries() {
2014 return first_int32_index() - first_ptr_index();
2015 }
2016
2017
2018 int ConstantPoolArray::count_of_int32_entries() {
2019 return length() - first_int32_index();
2020 }
2021
2022
2023 void ConstantPoolArray::SetEntryCounts(int number_of_int64_entries,
2024 int number_of_ptr_entries,
2025 int number_of_int32_entries) {
2026 set_first_ptr_index(number_of_int64_entries);
2027 set_first_int32_index(number_of_int64_entries + number_of_ptr_entries);
2028 set_length(number_of_int64_entries + number_of_ptr_entries +
2029 number_of_int32_entries);
2030 }
2031
2032
2033 int64_t ConstantPoolArray::get_int64_entry(int index) {
2034 ASSERT(map() == GetHeap()->constant_pool_array_map());
2035 ASSERT(index >= 0 && index < first_ptr_index());
2036 return READ_INT64_FIELD(this, OffsetOfElementAt(index));
2037 }
2038
2039 double ConstantPoolArray::get_int64_entry_as_double(int index) {
2040 STATIC_ASSERT(kDoubleSize == kInt64Size);
2041 ASSERT(map() == GetHeap()->constant_pool_array_map());
2042 ASSERT(index >= 0 && index < first_ptr_index());
2043 return READ_DOUBLE_FIELD(this, OffsetOfElementAt(index));
2044 }
2045
2046
2047 Object* ConstantPoolArray::get_ptr_entry(int index) {
2048 ASSERT(map() == GetHeap()->constant_pool_array_map());
2049 ASSERT(index >= first_ptr_index() && index < first_int32_index());
2050 return READ_FIELD(this, OffsetOfElementAt(index));
2051 }
2052
2053
2054 int32_t ConstantPoolArray::get_int32_entry(int index) {
2055 ASSERT(map() == GetHeap()->constant_pool_array_map());
2056 ASSERT(index >= first_int32_index() && index < length());
2057 return READ_INT32_FIELD(this, OffsetOfElementAt(index));
2058 }
2059
2060
2061 void ConstantPoolArray::set(int index, Object* value) {
2062 ASSERT(map() == GetHeap()->constant_pool_array_map());
2063 ASSERT(index >= first_ptr_index() && index < first_int32_index());
2064 WRITE_FIELD(this, OffsetOfElementAt(index), value);
2065 WRITE_BARRIER(GetHeap(), this, OffsetOfElementAt(index), value);
2066 }
2067
2068
2069 void ConstantPoolArray::set(int index, int64_t value) {
2070 ASSERT(map() == GetHeap()->constant_pool_array_map());
2071 ASSERT(index >= first_int64_index() && index < first_ptr_index());
2072 WRITE_INT64_FIELD(this, OffsetOfElementAt(index), value);
2073 }
2074
2075
2076 void ConstantPoolArray::set(int index, double value) {
2077 STATIC_ASSERT(kDoubleSize == kInt64Size);
2078 ASSERT(map() == GetHeap()->constant_pool_array_map());
2079 ASSERT(index >= first_int64_index() && index < first_ptr_index());
2080 WRITE_DOUBLE_FIELD(this, OffsetOfElementAt(index), value);
2081 }
2082
2083
2084 void ConstantPoolArray::set(int index, int32_t value) {
2085 ASSERT(map() == GetHeap()->constant_pool_array_map());
2086 ASSERT(index >= this->first_int32_index() && index < length());
2087 WRITE_INT32_FIELD(this, OffsetOfElementAt(index), value);
2088 }
2089
2090
1989 WriteBarrierMode HeapObject::GetWriteBarrierMode( 2091 WriteBarrierMode HeapObject::GetWriteBarrierMode(
1990 const DisallowHeapAllocation& promise) { 2092 const DisallowHeapAllocation& promise) {
1991 Heap* heap = GetHeap(); 2093 Heap* heap = GetHeap();
1992 if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER; 2094 if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER;
1993 if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER; 2095 if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER;
1994 return UPDATE_WRITE_BARRIER; 2096 return UPDATE_WRITE_BARRIER;
1995 } 2097 }
1996 2098
1997 2099
1998 void FixedArray::set(int index, 2100 void FixedArray::set(int index,
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
2471 set(kMaxNumberKeyIndex, Smi::FromInt(kRequiresSlowElementsMask)); 2573 set(kMaxNumberKeyIndex, Smi::FromInt(kRequiresSlowElementsMask));
2472 } 2574 }
2473 2575
2474 2576
2475 // ------------------------------------ 2577 // ------------------------------------
2476 // Cast operations 2578 // Cast operations
2477 2579
2478 2580
2479 CAST_ACCESSOR(FixedArray) 2581 CAST_ACCESSOR(FixedArray)
2480 CAST_ACCESSOR(FixedDoubleArray) 2582 CAST_ACCESSOR(FixedDoubleArray)
2583 CAST_ACCESSOR(ConstantPoolArray)
2481 CAST_ACCESSOR(DescriptorArray) 2584 CAST_ACCESSOR(DescriptorArray)
2482 CAST_ACCESSOR(DeoptimizationInputData) 2585 CAST_ACCESSOR(DeoptimizationInputData)
2483 CAST_ACCESSOR(DeoptimizationOutputData) 2586 CAST_ACCESSOR(DeoptimizationOutputData)
2484 CAST_ACCESSOR(DependentCode) 2587 CAST_ACCESSOR(DependentCode)
2485 CAST_ACCESSOR(TypeFeedbackCells) 2588 CAST_ACCESSOR(TypeFeedbackCells)
2486 CAST_ACCESSOR(StringTable) 2589 CAST_ACCESSOR(StringTable)
2487 CAST_ACCESSOR(JSFunctionResultCache) 2590 CAST_ACCESSOR(JSFunctionResultCache)
2488 CAST_ACCESSOR(NormalizedMapCache) 2591 CAST_ACCESSOR(NormalizedMapCache)
2489 CAST_ACCESSOR(ScopeInfo) 2592 CAST_ACCESSOR(ScopeInfo)
2490 CAST_ACCESSOR(CompilationCacheTable) 2593 CAST_ACCESSOR(CompilationCacheTable)
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
3366 } 3469 }
3367 if (instance_type == STRING_TYPE || 3470 if (instance_type == STRING_TYPE ||
3368 instance_type == INTERNALIZED_STRING_TYPE) { 3471 instance_type == INTERNALIZED_STRING_TYPE) {
3369 return SeqTwoByteString::SizeFor( 3472 return SeqTwoByteString::SizeFor(
3370 reinterpret_cast<SeqTwoByteString*>(this)->length()); 3473 reinterpret_cast<SeqTwoByteString*>(this)->length());
3371 } 3474 }
3372 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { 3475 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) {
3373 return FixedDoubleArray::SizeFor( 3476 return FixedDoubleArray::SizeFor(
3374 reinterpret_cast<FixedDoubleArray*>(this)->length()); 3477 reinterpret_cast<FixedDoubleArray*>(this)->length());
3375 } 3478 }
3479 if (instance_type == CONSTANT_POOL_ARRAY_TYPE) {
3480 return ConstantPoolArray::SizeFor(
3481 reinterpret_cast<ConstantPoolArray*>(this)->count_of_int64_entries(),
3482 reinterpret_cast<ConstantPoolArray*>(this)->count_of_ptr_entries(),
3483 reinterpret_cast<ConstantPoolArray*>(this)->count_of_int32_entries());
3484 }
3376 ASSERT(instance_type == CODE_TYPE); 3485 ASSERT(instance_type == CODE_TYPE);
3377 return reinterpret_cast<Code*>(this)->CodeSize(); 3486 return reinterpret_cast<Code*>(this)->CodeSize();
3378 } 3487 }
3379 3488
3380 3489
3381 void Map::set_instance_size(int value) { 3490 void Map::set_instance_size(int value) {
3382 ASSERT_EQ(0, value & (kPointerSize - 1)); 3491 ASSERT_EQ(0, value & (kPointerSize - 1));
3383 value >>= kPointerSizeLog2; 3492 value >>= kPointerSizeLog2;
3384 ASSERT(0 <= value && value < 256); 3493 ASSERT(0 <= value && value < 256);
3385 WRITE_BYTE_FIELD(this, kInstanceSizeOffset, static_cast<byte>(value)); 3494 WRITE_BYTE_FIELD(this, kInstanceSizeOffset, static_cast<byte>(value));
(...skipping 2016 matching lines...) Expand 10 before | Expand all | Expand 10 after
5402 ASSERT(index >= kDataIndex); // Only implementation data can be set this way. 5511 ASSERT(index >= kDataIndex); // Only implementation data can be set this way.
5403 FixedArray::cast(data())->set(index, value); 5512 FixedArray::cast(data())->set(index, value);
5404 } 5513 }
5405 5514
5406 5515
5407 ElementsKind JSObject::GetElementsKind() { 5516 ElementsKind JSObject::GetElementsKind() {
5408 ElementsKind kind = map()->elements_kind(); 5517 ElementsKind kind = map()->elements_kind();
5409 #if DEBUG 5518 #if DEBUG
5410 FixedArrayBase* fixed_array = 5519 FixedArrayBase* fixed_array =
5411 reinterpret_cast<FixedArrayBase*>(READ_FIELD(this, kElementsOffset)); 5520 reinterpret_cast<FixedArrayBase*>(READ_FIELD(this, kElementsOffset));
5412 Map* map = fixed_array->map(); 5521
5413 ASSERT((IsFastSmiOrObjectElementsKind(kind) && 5522 // If a GC was caused while constructing this object, the elements
5414 (map == GetHeap()->fixed_array_map() || 5523 // pointer may point to a one pointer filler map.
5415 map == GetHeap()->fixed_cow_array_map())) || 5524 if (ElementsAreSafeToExamine()) {
5416 (IsFastDoubleElementsKind(kind) && 5525 Map* map = fixed_array->map();
5417 (fixed_array->IsFixedDoubleArray() || 5526 ASSERT((IsFastSmiOrObjectElementsKind(kind) &&
5418 fixed_array == GetHeap()->empty_fixed_array())) || 5527 (map == GetHeap()->fixed_array_map() ||
5419 (kind == DICTIONARY_ELEMENTS && 5528 map == GetHeap()->fixed_cow_array_map())) ||
5529 (IsFastDoubleElementsKind(kind) &&
5530 (fixed_array->IsFixedDoubleArray() ||
5531 fixed_array == GetHeap()->empty_fixed_array())) ||
5532 (kind == DICTIONARY_ELEMENTS &&
5420 fixed_array->IsFixedArray() && 5533 fixed_array->IsFixedArray() &&
5421 fixed_array->IsDictionary()) || 5534 fixed_array->IsDictionary()) ||
5422 (kind > DICTIONARY_ELEMENTS)); 5535 (kind > DICTIONARY_ELEMENTS));
5423 ASSERT((kind != NON_STRICT_ARGUMENTS_ELEMENTS) || 5536 ASSERT((kind != NON_STRICT_ARGUMENTS_ELEMENTS) ||
5424 (elements()->IsFixedArray() && elements()->length() >= 2)); 5537 (elements()->IsFixedArray() && elements()->length() >= 2));
5538 }
5425 #endif 5539 #endif
5426 return kind; 5540 return kind;
5427 } 5541 }
5428 5542
5429 5543
5430 ElementsAccessor* JSObject::GetElementsAccessor() { 5544 ElementsAccessor* JSObject::GetElementsAccessor() {
5431 return ElementsAccessor::ForKind(GetElementsKind()); 5545 return ElementsAccessor::ForKind(GetElementsKind());
5432 } 5546 }
5433 5547
5434 5548
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
6045 return GetHeap()->CopyFixedArray(this); 6159 return GetHeap()->CopyFixedArray(this);
6046 } 6160 }
6047 6161
6048 6162
6049 MaybeObject* FixedDoubleArray::Copy() { 6163 MaybeObject* FixedDoubleArray::Copy() {
6050 if (length() == 0) return this; 6164 if (length() == 0) return this;
6051 return GetHeap()->CopyFixedDoubleArray(this); 6165 return GetHeap()->CopyFixedDoubleArray(this);
6052 } 6166 }
6053 6167
6054 6168
6169 MaybeObject* ConstantPoolArray::Copy() {
6170 if (length() == 0) return this;
6171 return GetHeap()->CopyConstantPoolArray(this);
6172 }
6173
6174
6055 void TypeFeedbackCells::SetAstId(int index, TypeFeedbackId id) { 6175 void TypeFeedbackCells::SetAstId(int index, TypeFeedbackId id) {
6056 set(1 + index * 2, Smi::FromInt(id.ToInt())); 6176 set(1 + index * 2, Smi::FromInt(id.ToInt()));
6057 } 6177 }
6058 6178
6059 6179
6060 TypeFeedbackId TypeFeedbackCells::AstId(int index) { 6180 TypeFeedbackId TypeFeedbackCells::AstId(int index) {
6061 return TypeFeedbackId(Smi::cast(get(1 + index * 2))->value()); 6181 return TypeFeedbackId(Smi::cast(get(1 + index * 2))->value());
6062 } 6182 }
6063 6183
6064 6184
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
6280 #undef WRITE_UINT32_FIELD 6400 #undef WRITE_UINT32_FIELD
6281 #undef READ_SHORT_FIELD 6401 #undef READ_SHORT_FIELD
6282 #undef WRITE_SHORT_FIELD 6402 #undef WRITE_SHORT_FIELD
6283 #undef READ_BYTE_FIELD 6403 #undef READ_BYTE_FIELD
6284 #undef WRITE_BYTE_FIELD 6404 #undef WRITE_BYTE_FIELD
6285 6405
6286 6406
6287 } } // namespace v8::internal 6407 } } // namespace v8::internal
6288 6408
6289 #endif // V8_OBJECTS_INL_H_ 6409 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698