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

Side by Side Diff: runtime/vm/heap.h

Issue 2953753002: Revert "Inline instance object hash code into object header on 64 bit." (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « runtime/vm/freelist.cc ('k') | runtime/vm/heap.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 (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 RUNTIME_VM_HEAP_H_ 5 #ifndef RUNTIME_VM_HEAP_H_
6 #define RUNTIME_VM_HEAP_H_ 6 #define RUNTIME_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 15 matching lines...) Expand all
26 class VirtualMemory; 26 class VirtualMemory;
27 27
28 class Heap { 28 class Heap {
29 public: 29 public:
30 enum Space { 30 enum Space {
31 kNew, 31 kNew,
32 kOld, 32 kOld,
33 kCode, 33 kCode,
34 }; 34 };
35 35
36 enum WeakSelector { 36 enum WeakSelector { kPeers = 0, kHashes, kObjectIds, kNumWeakSelectors };
37 kPeers = 0,
38 #if !defined(HASH_IN_OBJECT_HEADER)
39 kHashes,
40 #endif
41 kObjectIds,
42 kNumWeakSelectors
43 };
44 37
45 enum ApiCallbacks { kIgnoreApiCallbacks, kInvokeApiCallbacks }; 38 enum ApiCallbacks { kIgnoreApiCallbacks, kInvokeApiCallbacks };
46 39
47 enum GCReason { 40 enum GCReason {
48 kNewSpace, 41 kNewSpace,
49 kPromotion, 42 kPromotion,
50 kOldSpace, 43 kOldSpace,
51 kFull, 44 kFull,
52 kGCAtAlloc, 45 kGCAtAlloc,
53 kGCTestCase, 46 kGCTestCase,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 166
174 // Associate a peer with an object. A non-existent peer is equal to NULL. 167 // Associate a peer with an object. A non-existent peer is equal to NULL.
175 void SetPeer(RawObject* raw_obj, void* peer) { 168 void SetPeer(RawObject* raw_obj, void* peer) {
176 SetWeakEntry(raw_obj, kPeers, reinterpret_cast<intptr_t>(peer)); 169 SetWeakEntry(raw_obj, kPeers, reinterpret_cast<intptr_t>(peer));
177 } 170 }
178 void* GetPeer(RawObject* raw_obj) const { 171 void* GetPeer(RawObject* raw_obj) const {
179 return reinterpret_cast<void*>(GetWeakEntry(raw_obj, kPeers)); 172 return reinterpret_cast<void*>(GetWeakEntry(raw_obj, kPeers));
180 } 173 }
181 int64_t PeerCount() const; 174 int64_t PeerCount() const;
182 175
183 #if !defined(HASH_IN_OBJECT_HEADER)
184 // Associate an identity hashCode with an object. An non-existent hashCode 176 // Associate an identity hashCode with an object. An non-existent hashCode
185 // is equal to 0. 177 // is equal to 0.
186 void SetHash(RawObject* raw_obj, intptr_t hash) { 178 void SetHash(RawObject* raw_obj, intptr_t hash) {
187 SetWeakEntry(raw_obj, kHashes, hash); 179 SetWeakEntry(raw_obj, kHashes, hash);
188 } 180 }
189 intptr_t GetHash(RawObject* raw_obj) const { 181 intptr_t GetHash(RawObject* raw_obj) const {
190 return GetWeakEntry(raw_obj, kHashes); 182 return GetWeakEntry(raw_obj, kHashes);
191 } 183 }
192 #endif
193 int64_t HashCount() const; 184 int64_t HashCount() const;
194 185
195 // Associate an id with an object (used when serializing an object). 186 // Associate an id with an object (used when serializing an object).
196 // A non-existant id is equal to 0. 187 // A non-existant id is equal to 0.
197 void SetObjectId(RawObject* raw_obj, intptr_t object_id) { 188 void SetObjectId(RawObject* raw_obj, intptr_t object_id) {
198 ASSERT(Thread::Current()->IsMutatorThread()); 189 ASSERT(Thread::Current()->IsMutatorThread());
199 SetWeakEntry(raw_obj, kObjectIds, object_id); 190 SetWeakEntry(raw_obj, kObjectIds, object_id);
200 } 191 }
201 intptr_t GetObjectId(RawObject* raw_obj) const { 192 intptr_t GetObjectId(RawObject* raw_obj) const {
202 ASSERT(Thread::Current()->IsMutatorThread()); 193 ASSERT(Thread::Current()->IsMutatorThread());
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 // Note: During this scope, the code pages are non-executable. 393 // Note: During this scope, the code pages are non-executable.
403 class WritableVMIsolateScope : StackResource { 394 class WritableVMIsolateScope : StackResource {
404 public: 395 public:
405 explicit WritableVMIsolateScope(Thread* thread); 396 explicit WritableVMIsolateScope(Thread* thread);
406 ~WritableVMIsolateScope(); 397 ~WritableVMIsolateScope();
407 }; 398 };
408 399
409 } // namespace dart 400 } // namespace dart
410 401
411 #endif // RUNTIME_VM_HEAP_H_ 402 #endif // RUNTIME_VM_HEAP_H_
OLDNEW
« no previous file with comments | « runtime/vm/freelist.cc ('k') | runtime/vm/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698