| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_HEAP_H_ | 5 #ifndef VM_HEAP_H_ |
| 6 #define VM_HEAP_H_ | 6 #define VM_HEAP_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 SetWeakEntry(raw_obj, kHashes, hash); | 189 SetWeakEntry(raw_obj, kHashes, hash); |
| 190 } | 190 } |
| 191 intptr_t GetHash(RawObject* raw_obj) const { | 191 intptr_t GetHash(RawObject* raw_obj) const { |
| 192 return GetWeakEntry(raw_obj, kHashes); | 192 return GetWeakEntry(raw_obj, kHashes); |
| 193 } | 193 } |
| 194 int64_t HashCount() const; | 194 int64_t HashCount() const; |
| 195 | 195 |
| 196 // Associate an id with an object (used when serializing an object). | 196 // Associate an id with an object (used when serializing an object). |
| 197 // A non-existant id is equal to 0. | 197 // A non-existant id is equal to 0. |
| 198 void SetObjectId(RawObject* raw_obj, intptr_t object_id) { | 198 void SetObjectId(RawObject* raw_obj, intptr_t object_id) { |
| 199 ASSERT(Thread::Current()->IsMutatorThread()); |
| 199 SetWeakEntry(raw_obj, kObjectIds, object_id); | 200 SetWeakEntry(raw_obj, kObjectIds, object_id); |
| 200 } | 201 } |
| 201 intptr_t GetObjectId(RawObject* raw_obj) const { | 202 intptr_t GetObjectId(RawObject* raw_obj) const { |
| 203 ASSERT(Thread::Current()->IsMutatorThread()); |
| 202 return GetWeakEntry(raw_obj, kObjectIds); | 204 return GetWeakEntry(raw_obj, kObjectIds); |
| 203 } | 205 } |
| 204 int64_t ObjectIdCount() const; | 206 int64_t ObjectIdCount() const; |
| 205 void ResetObjectIdTable(); | 207 void ResetObjectIdTable(); |
| 206 | 208 |
| 207 // Used by the GC algorithms to propagate weak entries. | 209 // Used by the GC algorithms to propagate weak entries. |
| 208 intptr_t GetWeakEntry(RawObject* raw_obj, WeakSelector sel) const; | 210 intptr_t GetWeakEntry(RawObject* raw_obj, WeakSelector sel) const; |
| 209 void SetWeakEntry(RawObject* raw_obj, WeakSelector sel, intptr_t val); | 211 void SetWeakEntry(RawObject* raw_obj, WeakSelector sel, intptr_t val); |
| 210 | 212 |
| 211 WeakTable* GetWeakTable(Space space, WeakSelector selector) const { | 213 WeakTable* GetWeakTable(Space space, WeakSelector selector) const { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 // Note: During this scope, the code pages are non-executable. | 394 // Note: During this scope, the code pages are non-executable. |
| 393 class WritableVMIsolateScope : StackResource { | 395 class WritableVMIsolateScope : StackResource { |
| 394 public: | 396 public: |
| 395 explicit WritableVMIsolateScope(Thread* thread); | 397 explicit WritableVMIsolateScope(Thread* thread); |
| 396 ~WritableVMIsolateScope(); | 398 ~WritableVMIsolateScope(); |
| 397 }; | 399 }; |
| 398 | 400 |
| 399 } // namespace dart | 401 } // namespace dart |
| 400 | 402 |
| 401 #endif // VM_HEAP_H_ | 403 #endif // VM_HEAP_H_ |
| OLD | NEW |