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

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

Issue 2889723005: Revert "More compact string representation on 64 bit." (Closed)
Patch Set: Created 3 years, 7 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/object.cc ('k') | 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 RUNTIME_VM_RAW_OBJECT_H_ 5 #ifndef RUNTIME_VM_RAW_OBJECT_H_
6 #define RUNTIME_VM_RAW_OBJECT_H_ 6 #define RUNTIME_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/exceptions.h" 10 #include "vm/exceptions.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 class RawObject { 259 class RawObject {
260 public: 260 public:
261 // The tags field which is a part of the object header uses the following 261 // The tags field which is a part of the object header uses the following
262 // bit fields for storing tags. 262 // bit fields for storing tags.
263 enum TagBits { 263 enum TagBits {
264 kMarkBit = 0, 264 kMarkBit = 0,
265 kCanonicalBit = 1, 265 kCanonicalBit = 1,
266 kVMHeapObjectBit = 2, 266 kVMHeapObjectBit = 2,
267 kRememberedBit = 3, 267 kRememberedBit = 3,
268 kReservedTagPos = 4, // kReservedBit{100K,1M,10M} 268 kReservedTagPos = 4, // kReservedBit{100K,1M,10M}
269 #if defined(ARCH_IS_32_BIT)
269 kReservedTagSize = 4, 270 kReservedTagSize = 4,
270 kSizeTagPos = kReservedTagPos + kReservedTagSize, // = 8 271 kSizeTagPos = kReservedTagPos + kReservedTagSize, // = 8
271 kSizeTagSize = 8, 272 kSizeTagSize = 8,
272 kClassIdTagPos = kSizeTagPos + kSizeTagSize, // = 16 273 kClassIdTagPos = kSizeTagPos + kSizeTagSize, // = 16
273 kClassIdTagSize = 16, 274 kClassIdTagSize = 16,
275 #elif defined(ARCH_IS_64_BIT)
276 kReservedTagSize = 12,
277 kSizeTagPos = kReservedTagPos + kReservedTagSize, // = 16
278 kSizeTagSize = 16,
279 kClassIdTagPos = kSizeTagPos + kSizeTagSize, // = 32
280 kClassIdTagSize = 32,
281 #else
282 #error Unexpected architecture word size
283 #endif
274 }; 284 };
275 285
276 COMPILE_ASSERT(kClassIdTagSize == (sizeof(classid_t) * kBitsPerByte)); 286 COMPILE_ASSERT(kClassIdTagSize == (sizeof(classid_t) * kBitsPerByte));
277 287
278 // Encodes the object size in the tag in units of object alignment. 288 // Encodes the object size in the tag in units of object alignment.
279 class SizeTag { 289 class SizeTag {
280 public: 290 public:
281 static const intptr_t kMaxSizeTag = ((1 << RawObject::kSizeTagSize) - 1) 291 static const intptr_t kMaxSizeTag = ((1 << RawObject::kSizeTagSize) - 1)
282 << kObjectAlignmentLog2; 292 << kObjectAlignmentLog2;
283 293
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 friend class ClassStatsVisitor; 607 friend class ClassStatsVisitor;
598 template <bool> 608 template <bool>
599 friend class MarkingVisitorBase; 609 friend class MarkingVisitorBase;
600 friend class Mint; 610 friend class Mint;
601 friend class Object; 611 friend class Object;
602 friend class OneByteString; // StoreSmi 612 friend class OneByteString; // StoreSmi
603 friend class RawCode; 613 friend class RawCode;
604 friend class RawExternalTypedData; 614 friend class RawExternalTypedData;
605 friend class RawInstructions; 615 friend class RawInstructions;
606 friend class RawInstance; 616 friend class RawInstance;
607 friend class RawString;
608 friend class RawTypedData; 617 friend class RawTypedData;
609 friend class Scavenger; 618 friend class Scavenger;
610 friend class ScavengerVisitor; 619 friend class ScavengerVisitor;
611 friend class SizeExcludingClassVisitor; // GetClassId 620 friend class SizeExcludingClassVisitor; // GetClassId
612 friend class InstanceAccumulator; // GetClassId 621 friend class InstanceAccumulator; // GetClassId
613 friend class RetainingPathVisitor; // GetClassId 622 friend class RetainingPathVisitor; // GetClassId
614 friend class SkippedCodeFunctions; // StorePointer 623 friend class SkippedCodeFunctions; // StorePointer
615 friend class ImageReader; // tags_ check 624 friend class ImageReader; // tags_ check
616 friend class ImageWriter; 625 friend class ImageWriter;
617 friend class AssemblyImageWriter; 626 friend class AssemblyImageWriter;
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 }; 1856 };
1848 COMPILE_ASSERT(sizeof(RawDouble) == 16); 1857 COMPILE_ASSERT(sizeof(RawDouble) == 16);
1849 1858
1850 1859
1851 class RawString : public RawInstance { 1860 class RawString : public RawInstance {
1852 RAW_HEAP_OBJECT_IMPLEMENTATION(String); 1861 RAW_HEAP_OBJECT_IMPLEMENTATION(String);
1853 1862
1854 protected: 1863 protected:
1855 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } 1864 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
1856 RawSmi* length_; 1865 RawSmi* length_;
1857 #if !defined(HASH_IN_OBJECT_HEADER)
1858 RawSmi* hash_; 1866 RawSmi* hash_;
1859 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } 1867 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); }
1860 #else
1861 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
1862 #endif
1863 1868
1864 private:
1865 friend class Library; 1869 friend class Library;
1866 friend class OneByteStringSerializationCluster;
1867 friend class TwoByteStringSerializationCluster;
1868 friend class OneByteStringDeserializationCluster;
1869 friend class TwoByteStringDeserializationCluster;
1870 friend class RODataSerializationCluster;
1871 }; 1870 };
1872 1871
1873 1872
1874 class RawOneByteString : public RawString { 1873 class RawOneByteString : public RawString {
1875 RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString); 1874 RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString);
1876 1875
1877 // Variable length data follows here. 1876 // Variable length data follows here.
1878 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } 1877 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
1879 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); } 1878 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); }
1880 1879
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
2447 inline intptr_t RawObject::NumberOfTypedDataClasses() { 2446 inline intptr_t RawObject::NumberOfTypedDataClasses() {
2448 // Make sure this is updated when new TypedData types are added. 2447 // Make sure this is updated when new TypedData types are added.
2449 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); 2448 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14);
2450 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 2449 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
2451 kTypedDataInt8ArrayViewCid + 15); 2450 kTypedDataInt8ArrayViewCid + 15);
2452 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); 2451 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14);
2453 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); 2452 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1);
2454 return (kNullCid - kTypedDataInt8ArrayCid); 2453 return (kNullCid - kTypedDataInt8ArrayCid);
2455 } 2454 }
2456 2455
2457
2458 } // namespace dart 2456 } // namespace dart
2459 2457
2460 #endif // RUNTIME_VM_RAW_OBJECT_H_ 2458 #endif // RUNTIME_VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698