OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 VerifyPointer(READ_FIELD(this, offset)); | 1151 VerifyPointer(READ_FIELD(this, offset)); |
1152 } | 1152 } |
1153 | 1153 |
1154 void HeapObject::VerifySmiField(int offset) { | 1154 void HeapObject::VerifySmiField(int offset) { |
1155 ASSERT(READ_FIELD(this, offset)->IsSmi()); | 1155 ASSERT(READ_FIELD(this, offset)->IsSmi()); |
1156 } | 1156 } |
1157 #endif | 1157 #endif |
1158 | 1158 |
1159 | 1159 |
1160 Heap* HeapObject::GetHeap() { | 1160 Heap* HeapObject::GetHeap() { |
1161 uintptr_t addr = reinterpret_cast<uintptr_t>(this); | 1161 // During GC, the map pointer in HeapObject is used in various ways that |
1162 addr >>= kHeapDescriptorGranularityBits; | 1162 // prevent us from retrieving Heap from the map. |
1163 return heap_descriptors[addr].heap; | 1163 // Assert that we are not in GC, implement GC code in a way that it doesn't |
| 1164 // pull heap from the map. |
| 1165 ASSERT(HEAP->is_safe_to_read_maps()); |
| 1166 return map()->heap(); |
1164 } | 1167 } |
1165 | 1168 |
1166 | 1169 |
1167 Isolate* HeapObject::GetIsolate() { | 1170 Isolate* HeapObject::GetIsolate() { |
1168 return GetHeap()->isolate(); | 1171 return GetHeap()->isolate(); |
1169 } | 1172 } |
1170 | 1173 |
1171 | 1174 |
1172 Map* HeapObject::map() { | 1175 Map* HeapObject::map() { |
1173 return map_word().ToMap(); | 1176 return map_word().ToMap(); |
(...skipping 2984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4158 #undef WRITE_INT_FIELD | 4161 #undef WRITE_INT_FIELD |
4159 #undef READ_SHORT_FIELD | 4162 #undef READ_SHORT_FIELD |
4160 #undef WRITE_SHORT_FIELD | 4163 #undef WRITE_SHORT_FIELD |
4161 #undef READ_BYTE_FIELD | 4164 #undef READ_BYTE_FIELD |
4162 #undef WRITE_BYTE_FIELD | 4165 #undef WRITE_BYTE_FIELD |
4163 | 4166 |
4164 | 4167 |
4165 } } // namespace v8::internal | 4168 } } // namespace v8::internal |
4166 | 4169 |
4167 #endif // V8_OBJECTS_INL_H_ | 4170 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |