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

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

Issue 1174173007: Expand the class id to 32 bits and size field to 16 bits on 64-bit platforms. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 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/atomic.h" 9 #include "vm/atomic.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 class RawObject { 231 class RawObject {
232 public: 232 public:
233 // The tags field which is a part of the object header uses the following 233 // The tags field which is a part of the object header uses the following
234 // bit fields for storing tags. 234 // bit fields for storing tags.
235 enum TagBits { 235 enum TagBits {
236 kWatchedBit = 0, 236 kWatchedBit = 0,
237 kMarkBit = 1, 237 kMarkBit = 1,
238 kCanonicalBit = 2, 238 kCanonicalBit = 2,
239 kFromSnapshotBit = 3, 239 kFromSnapshotBit = 3,
240 kRememberedBit = 4, 240 kRememberedBit = 4,
241 kReservedTagPos = 5, // kReservedBit{10K,100K,1M,10M} 241 #if defined(ARCH_IS_32_BIT)
242 kReservedTagPos = 5, // kReservedBit{100K,1M,10M}
242 kReservedTagSize = 3, 243 kReservedTagSize = 3,
243 kSizeTagPos = kReservedTagPos + kReservedTagSize, // = 8 244 kSizeTagPos = kReservedTagPos + kReservedTagSize, // = 8
244 kSizeTagSize = 8, 245 kSizeTagSize = 8,
245 kClassIdTagPos = kSizeTagPos + kSizeTagSize, // = 16 246 kClassIdTagPos = kSizeTagPos + kSizeTagSize, // = 16
246 kClassIdTagSize = 16, 247 kClassIdTagSize = 16,
248 #elif defined(ARCH_IS_64_BIT)
249 kReservedTagPos = 5, // kReservedBit{100K,1M,10M}
250 kReservedTagSize = 11,
251 kSizeTagPos = kReservedTagPos + kReservedTagSize, // = 16
252 kSizeTagSize = 16,
253 kClassIdTagPos = kSizeTagPos + kSizeTagSize, // = 32
254 kClassIdTagSize = 32,
255 #else
256 #error Unexpected architecture word size
257 #endif
247 }; 258 };
248 259
260 COMPILE_ASSERT(kClassIdTagSize == (sizeof(classid_t) * kBitsPerByte));
261
249 // Encodes the object size in the tag in units of object alignment. 262 // Encodes the object size in the tag in units of object alignment.
250 class SizeTag { 263 class SizeTag {
251 public: 264 public:
252 static const intptr_t kMaxSizeTag = 265 static const intptr_t kMaxSizeTag =
253 ((1 << RawObject::kSizeTagSize) - 1) << kObjectAlignmentLog2; 266 ((1 << RawObject::kSizeTagSize) - 1) << kObjectAlignmentLog2;
254 267
255 static uword encode(intptr_t size) { 268 static uword encode(intptr_t size) {
256 return SizeBits::encode(SizeToTagValue(size)); 269 return SizeBits::encode(SizeToTagValue(size));
257 } 270 }
258 271
(...skipping 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 2178 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
2166 kTypedDataInt8ArrayViewCid + 15); 2179 kTypedDataInt8ArrayViewCid + 15);
2167 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); 2180 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14);
2168 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); 2181 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1);
2169 return (kNullCid - kTypedDataInt8ArrayCid); 2182 return (kNullCid - kTypedDataInt8ArrayCid);
2170 } 2183 }
2171 2184
2172 } // namespace dart 2185 } // namespace dart
2173 2186
2174 #endif // VM_RAW_OBJECT_H_ 2187 #endif // VM_RAW_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698