OLD | NEW |
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 Loading... |
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 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 | 1183 |
1184 void HeapObject::VerifySmiField(int offset) { | 1184 void HeapObject::VerifySmiField(int offset) { |
1185 CHECK(READ_FIELD(this, offset)->IsSmi()); | 1185 CHECK(READ_FIELD(this, offset)->IsSmi()); |
1186 } | 1186 } |
1187 #endif | 1187 #endif |
1188 | 1188 |
1189 | 1189 |
1190 Heap* HeapObject::GetHeap() { | 1190 Heap* HeapObject::GetHeap() { |
1191 Heap* heap = | 1191 Heap* heap = |
1192 MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap(); | 1192 MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap(); |
1193 ASSERT(heap != NULL); | 1193 SLOW_ASSERT(heap != NULL); |
1194 return heap; | 1194 return heap; |
1195 } | 1195 } |
1196 | 1196 |
1197 | 1197 |
1198 Isolate* HeapObject::GetIsolate() { | 1198 Isolate* HeapObject::GetIsolate() { |
1199 return GetHeap()->isolate(); | 1199 return GetHeap()->isolate(); |
1200 } | 1200 } |
1201 | 1201 |
1202 | 1202 |
1203 Map* HeapObject::map() { | 1203 Map* HeapObject::map() { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 } | 1300 } |
1301 | 1301 |
1302 | 1302 |
1303 FixedArrayBase* JSObject::elements() { | 1303 FixedArrayBase* JSObject::elements() { |
1304 Object* array = READ_FIELD(this, kElementsOffset); | 1304 Object* array = READ_FIELD(this, kElementsOffset); |
1305 return static_cast<FixedArrayBase*>(array); | 1305 return static_cast<FixedArrayBase*>(array); |
1306 } | 1306 } |
1307 | 1307 |
1308 | 1308 |
1309 void JSObject::ValidateElements() { | 1309 void JSObject::ValidateElements() { |
1310 #if DEBUG | 1310 #ifdef ENABLE_SLOW_ASSERTS |
1311 if (FLAG_enable_slow_asserts) { | 1311 if (FLAG_enable_slow_asserts) { |
1312 ElementsAccessor* accessor = GetElementsAccessor(); | 1312 ElementsAccessor* accessor = GetElementsAccessor(); |
1313 accessor->Validate(this); | 1313 accessor->Validate(this); |
1314 } | 1314 } |
1315 #endif | 1315 #endif |
1316 } | 1316 } |
1317 | 1317 |
1318 | 1318 |
1319 bool JSObject::ShouldTrackAllocationInfo() { | 1319 bool JSObject::ShouldTrackAllocationInfo() { |
1320 if (AllocationSite::CanTrack(map()->instance_type())) { | 1320 if (AllocationSite::CanTrack(map()->instance_type())) { |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 | 1894 |
1895 | 1895 |
1896 FixedArrayBase* FixedArrayBase::cast(Object* object) { | 1896 FixedArrayBase* FixedArrayBase::cast(Object* object) { |
1897 ASSERT(object->IsFixedArray() || object->IsFixedDoubleArray() || | 1897 ASSERT(object->IsFixedArray() || object->IsFixedDoubleArray() || |
1898 object->IsConstantPoolArray()); | 1898 object->IsConstantPoolArray()); |
1899 return reinterpret_cast<FixedArrayBase*>(object); | 1899 return reinterpret_cast<FixedArrayBase*>(object); |
1900 } | 1900 } |
1901 | 1901 |
1902 | 1902 |
1903 Object* FixedArray::get(int index) { | 1903 Object* FixedArray::get(int index) { |
1904 ASSERT(index >= 0 && index < this->length()); | 1904 SLOW_ASSERT(index >= 0 && index < this->length()); |
1905 return READ_FIELD(this, kHeaderSize + index * kPointerSize); | 1905 return READ_FIELD(this, kHeaderSize + index * kPointerSize); |
1906 } | 1906 } |
1907 | 1907 |
1908 | 1908 |
1909 bool FixedArray::is_the_hole(int index) { | 1909 bool FixedArray::is_the_hole(int index) { |
1910 return get(index) == GetHeap()->the_hole_value(); | 1910 return get(index) == GetHeap()->the_hole_value(); |
1911 } | 1911 } |
1912 | 1912 |
1913 | 1913 |
1914 void FixedArray::set(int index, Smi* value) { | 1914 void FixedArray::set(int index, Smi* value) { |
(...skipping 4478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6393 #undef WRITE_UINT32_FIELD | 6393 #undef WRITE_UINT32_FIELD |
6394 #undef READ_SHORT_FIELD | 6394 #undef READ_SHORT_FIELD |
6395 #undef WRITE_SHORT_FIELD | 6395 #undef WRITE_SHORT_FIELD |
6396 #undef READ_BYTE_FIELD | 6396 #undef READ_BYTE_FIELD |
6397 #undef WRITE_BYTE_FIELD | 6397 #undef WRITE_BYTE_FIELD |
6398 | 6398 |
6399 | 6399 |
6400 } } // namespace v8::internal | 6400 } } // namespace v8::internal |
6401 | 6401 |
6402 #endif // V8_OBJECTS_INL_H_ | 6402 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |