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

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

Issue 10825167: Describe the reserved header bits with their own bit-field definition. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/raw_object.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 VM_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/token.h" 10 #include "vm/token.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // be dereferenced (e.g. RawSmi). 176 // be dereferenced (e.g. RawSmi).
177 class RawObject { 177 class RawObject {
178 public: 178 public:
179 // The tags field which is a part of the object header uses the following 179 // The tags field which is a part of the object header uses the following
180 // bit fields for storing tags. 180 // bit fields for storing tags.
181 enum TagBits { 181 enum TagBits {
182 kFreeBit = 0, 182 kFreeBit = 0,
183 kMarkBit = 1, 183 kMarkBit = 1,
184 kCanonicalBit = 2, 184 kCanonicalBit = 2,
185 kFromSnapshotBit = 3, 185 kFromSnapshotBit = 3,
186 kReservedBit10K = 4, 186 kReservedTagBit = 4, // kReservedBit{10K,100K,1M,10M}
187 kReservedBit100K = 5, 187 kReservedTagSize = 4,
188 kReservedBit1M = 6,
189 kReservedBit10M = 7,
190 kSizeTagBit = 8, 188 kSizeTagBit = 8,
191 kSizeTagSize = 8, 189 kSizeTagSize = 8,
192 kClassIdTagBit = kSizeTagBit + kSizeTagSize, 190 kClassIdTagBit = kSizeTagBit + kSizeTagSize,
193 kClassIdTagSize = 16 191 kClassIdTagSize = 16
194 }; 192 };
195 193
196 // Encodes the object size in the tag in units of object alignment. 194 // Encodes the object size in the tag in units of object alignment.
197 class SizeTag { 195 class SizeTag {
198 public: 196 public:
199 static const intptr_t kMaxSizeTag = 197 static const intptr_t kMaxSizeTag =
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 321
324 private: 322 private:
325 class FreeBit : public BitField<bool, kFreeBit, 1> {}; 323 class FreeBit : public BitField<bool, kFreeBit, 1> {};
326 324
327 class MarkBit : public BitField<bool, kMarkBit, 1> {}; 325 class MarkBit : public BitField<bool, kMarkBit, 1> {};
328 326
329 class CanonicalObjectTag : public BitField<bool, kCanonicalBit, 1> {}; 327 class CanonicalObjectTag : public BitField<bool, kCanonicalBit, 1> {};
330 328
331 class CreatedFromSnapshotTag : public BitField<bool, kFromSnapshotBit, 1> {}; 329 class CreatedFromSnapshotTag : public BitField<bool, kFromSnapshotBit, 1> {};
332 330
331 class ReservedBits : public BitField<intptr_t,
332 kReservedTagBit,
333 kReservedTagSize> {}; // NOLINT
334
333 RawObject* ptr() const { 335 RawObject* ptr() const {
334 ASSERT(IsHeapObject()); 336 ASSERT(IsHeapObject());
335 return reinterpret_cast<RawObject*>( 337 return reinterpret_cast<RawObject*>(
336 reinterpret_cast<uword>(this) - kHeapObjectTag); 338 reinterpret_cast<uword>(this) - kHeapObjectTag);
337 } 339 }
338 340
339 intptr_t SizeFromClass() const; 341 intptr_t SizeFromClass() const;
340 342
341 intptr_t GetClassId() const { 343 intptr_t GetClassId() const {
342 uword tags = ptr()->tags_; 344 uword tags = ptr()->tags_;
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 kExternalUint64Array == kByteArray + 18 && 1518 kExternalUint64Array == kByteArray + 18 &&
1517 kExternalFloat32Array == kByteArray + 19 && 1519 kExternalFloat32Array == kByteArray + 19 &&
1518 kExternalFloat64Array == kByteArray + 20 && 1520 kExternalFloat64Array == kByteArray + 20 &&
1519 kClosure == kByteArray + 21); 1521 kClosure == kByteArray + 21);
1520 return (index >= kByteArray && index <= kClosure); 1522 return (index >= kByteArray && index <= kClosure);
1521 } 1523 }
1522 1524
1523 } // namespace dart 1525 } // namespace dart
1524 1526
1525 #endif // VM_RAW_OBJECT_H_ 1527 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698