| OLD | NEW |
| 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 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 VerifyPointer(READ_FIELD(this, offset)); | 1130 VerifyPointer(READ_FIELD(this, offset)); |
| 1131 } | 1131 } |
| 1132 | 1132 |
| 1133 void HeapObject::VerifySmiField(int offset) { | 1133 void HeapObject::VerifySmiField(int offset) { |
| 1134 ASSERT(READ_FIELD(this, offset)->IsSmi()); | 1134 ASSERT(READ_FIELD(this, offset)->IsSmi()); |
| 1135 } | 1135 } |
| 1136 #endif | 1136 #endif |
| 1137 | 1137 |
| 1138 | 1138 |
| 1139 Heap* HeapObject::GetHeap() { | 1139 Heap* HeapObject::GetHeap() { |
| 1140 return MemoryChunk::FromAddress(address())->heap(); | 1140 Heap* heap = |
| 1141 MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap(); |
| 1142 ASSERT(heap != NULL); |
| 1143 ASSERT(heap->isolate() == Isolate::Current()); |
| 1144 return heap; |
| 1141 } | 1145 } |
| 1142 | 1146 |
| 1143 | 1147 |
| 1144 Isolate* HeapObject::GetIsolate() { | 1148 Isolate* HeapObject::GetIsolate() { |
| 1145 return GetHeap()->isolate(); | 1149 return GetHeap()->isolate(); |
| 1146 } | 1150 } |
| 1147 | 1151 |
| 1148 | 1152 |
| 1149 Map* HeapObject::map() { | 1153 Map* HeapObject::map() { |
| 1150 return map_word().ToMap(); | 1154 return map_word().ToMap(); |
| 1151 } | 1155 } |
| 1152 | 1156 |
| 1153 | 1157 |
| 1154 void HeapObject::set_map(Map* value) { | 1158 void HeapObject::set_map(Map* value) { |
| 1155 set_map_word(MapWord::FromMap(value)); | 1159 set_map_word(MapWord::FromMap(value)); |
| 1156 if (value != NULL) { | 1160 if (value != NULL) { |
| 1157 // We are passing NULL as a slot because maps can never be on evacuation | 1161 // TODO(1600) We are passing NULL as a slot because maps can never be on |
| 1158 // candidate. | 1162 // evacuation candidate. |
| 1159 // TODO(gc) Maps are compacted by a separate (non-evacuation) algorithm. | |
| 1160 value->GetHeap()->incremental_marking()->RecordWrite(this, NULL, value); | 1163 value->GetHeap()->incremental_marking()->RecordWrite(this, NULL, value); |
| 1161 } | 1164 } |
| 1162 } | 1165 } |
| 1163 | 1166 |
| 1164 | 1167 |
| 1165 MapWord HeapObject::map_word() { | 1168 MapWord HeapObject::map_word() { |
| 1166 return MapWord(reinterpret_cast<uintptr_t>(READ_FIELD(this, kMapOffset))); | 1169 return MapWord(reinterpret_cast<uintptr_t>(READ_FIELD(this, kMapOffset))); |
| 1167 } | 1170 } |
| 1168 | 1171 |
| 1169 | 1172 |
| (...skipping 2273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3443 } | 3446 } |
| 3444 | 3447 |
| 3445 | 3448 |
| 3446 Code* SharedFunctionInfo::unchecked_code() { | 3449 Code* SharedFunctionInfo::unchecked_code() { |
| 3447 return reinterpret_cast<Code*>(READ_FIELD(this, kCodeOffset)); | 3450 return reinterpret_cast<Code*>(READ_FIELD(this, kCodeOffset)); |
| 3448 } | 3451 } |
| 3449 | 3452 |
| 3450 | 3453 |
| 3451 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { | 3454 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { |
| 3452 WRITE_FIELD(this, kCodeOffset, value); | 3455 WRITE_FIELD(this, kCodeOffset, value); |
| 3453 // TODO(gc) ISOLATESMERGE HEAP | 3456 WRITE_BARRIER(value->GetHeap(), this, kCodeOffset, value); |
| 3454 WRITE_BARRIER(HEAP, this, kCodeOffset, value); | |
| 3455 } | 3457 } |
| 3456 | 3458 |
| 3457 | 3459 |
| 3458 SerializedScopeInfo* SharedFunctionInfo::scope_info() { | 3460 SerializedScopeInfo* SharedFunctionInfo::scope_info() { |
| 3459 return reinterpret_cast<SerializedScopeInfo*>( | 3461 return reinterpret_cast<SerializedScopeInfo*>( |
| 3460 READ_FIELD(this, kScopeInfoOffset)); | 3462 READ_FIELD(this, kScopeInfoOffset)); |
| 3461 } | 3463 } |
| 3462 | 3464 |
| 3463 | 3465 |
| 3464 void SharedFunctionInfo::set_scope_info(SerializedScopeInfo* value, | 3466 void SharedFunctionInfo::set_scope_info(SerializedScopeInfo* value, |
| (...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4472 #undef WRITE_INT_FIELD | 4474 #undef WRITE_INT_FIELD |
| 4473 #undef READ_SHORT_FIELD | 4475 #undef READ_SHORT_FIELD |
| 4474 #undef WRITE_SHORT_FIELD | 4476 #undef WRITE_SHORT_FIELD |
| 4475 #undef READ_BYTE_FIELD | 4477 #undef READ_BYTE_FIELD |
| 4476 #undef WRITE_BYTE_FIELD | 4478 #undef WRITE_BYTE_FIELD |
| 4477 | 4479 |
| 4478 | 4480 |
| 4479 } } // namespace v8::internal | 4481 } } // namespace v8::internal |
| 4480 | 4482 |
| 4481 #endif // V8_OBJECTS_INL_H_ | 4483 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |