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

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

Issue 2912863006: Inline instance object hash code into object header on 64 bit. (Closed)
Patch Set: Use visitor to give objects in VM isolate hash codes. 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
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 #if defined(HASH_IN_OBJECT_HEADER)
Vyacheslav Egorov (Google) 2017/06/07 06:21:15 maybe instead enum WeakSelector { #if ... kHa
erikcorry 2017/06/16 09:26:39 Done.
37 enum WeakSelector { kPeers = 0, kObjectIds, kNumWeakSelectors };
38 #else
36 enum WeakSelector { kPeers = 0, kHashes, kObjectIds, kNumWeakSelectors }; 39 enum WeakSelector { kPeers = 0, kHashes, kObjectIds, kNumWeakSelectors };
40 #endif
37 41
38 enum ApiCallbacks { kIgnoreApiCallbacks, kInvokeApiCallbacks }; 42 enum ApiCallbacks { kIgnoreApiCallbacks, kInvokeApiCallbacks };
39 43
40 enum GCReason { 44 enum GCReason {
41 kNewSpace, 45 kNewSpace,
42 kPromotion, 46 kPromotion,
43 kOldSpace, 47 kOldSpace,
44 kFull, 48 kFull,
45 kGCAtAlloc, 49 kGCAtAlloc,
46 kGCTestCase, 50 kGCTestCase,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 164
161 // Associate a peer with an object. A non-existent peer is equal to NULL. 165 // Associate a peer with an object. A non-existent peer is equal to NULL.
162 void SetPeer(RawObject* raw_obj, void* peer) { 166 void SetPeer(RawObject* raw_obj, void* peer) {
163 SetWeakEntry(raw_obj, kPeers, reinterpret_cast<intptr_t>(peer)); 167 SetWeakEntry(raw_obj, kPeers, reinterpret_cast<intptr_t>(peer));
164 } 168 }
165 void* GetPeer(RawObject* raw_obj) const { 169 void* GetPeer(RawObject* raw_obj) const {
166 return reinterpret_cast<void*>(GetWeakEntry(raw_obj, kPeers)); 170 return reinterpret_cast<void*>(GetWeakEntry(raw_obj, kPeers));
167 } 171 }
168 int64_t PeerCount() const; 172 int64_t PeerCount() const;
169 173
174 #if !defined(HASH_IN_OBJECT_HEADER)
170 // Associate an identity hashCode with an object. An non-existent hashCode 175 // Associate an identity hashCode with an object. An non-existent hashCode
171 // is equal to 0. 176 // is equal to 0.
172 void SetHash(RawObject* raw_obj, intptr_t hash) { 177 void SetHash(RawObject* raw_obj, intptr_t hash) {
173 SetWeakEntry(raw_obj, kHashes, hash); 178 SetWeakEntry(raw_obj, kHashes, hash);
174 } 179 }
175 intptr_t GetHash(RawObject* raw_obj) const { 180 intptr_t GetHash(RawObject* raw_obj) const {
176 return GetWeakEntry(raw_obj, kHashes); 181 return GetWeakEntry(raw_obj, kHashes);
177 } 182 }
183 #endif
178 int64_t HashCount() const; 184 int64_t HashCount() const;
179 185
180 // Associate an id with an object (used when serializing an object). 186 // Associate an id with an object (used when serializing an object).
181 // A non-existant id is equal to 0. 187 // A non-existant id is equal to 0.
182 void SetObjectId(RawObject* raw_obj, intptr_t object_id) { 188 void SetObjectId(RawObject* raw_obj, intptr_t object_id) {
183 ASSERT(Thread::Current()->IsMutatorThread()); 189 ASSERT(Thread::Current()->IsMutatorThread());
184 SetWeakEntry(raw_obj, kObjectIds, object_id); 190 SetWeakEntry(raw_obj, kObjectIds, object_id);
185 } 191 }
186 intptr_t GetObjectId(RawObject* raw_obj) const { 192 intptr_t GetObjectId(RawObject* raw_obj) const {
187 ASSERT(Thread::Current()->IsMutatorThread()); 193 ASSERT(Thread::Current()->IsMutatorThread());
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 // Note: During this scope, the code pages are non-executable. 393 // Note: During this scope, the code pages are non-executable.
388 class WritableVMIsolateScope : StackResource { 394 class WritableVMIsolateScope : StackResource {
389 public: 395 public:
390 explicit WritableVMIsolateScope(Thread* thread); 396 explicit WritableVMIsolateScope(Thread* thread);
391 ~WritableVMIsolateScope(); 397 ~WritableVMIsolateScope();
392 }; 398 };
393 399
394 } // namespace dart 400 } // namespace dart
395 401
396 #endif // RUNTIME_VM_HEAP_H_ 402 #endif // RUNTIME_VM_HEAP_H_
OLDNEW
« no previous file with comments | « runtime/vm/become.cc ('k') | runtime/vm/heap.cc » ('j') | runtime/vm/intrinsifier_arm64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698