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

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

Issue 13951019: - Allow for experimentation with different header sizes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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/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_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 4126 matching lines...) Expand 10 before | Expand all | Expand 10 after
4137 // We use 30 bits for the hash code so that we consistently use a 4137 // We use 30 bits for the hash code so that we consistently use a
4138 // 32bit Smi representation for the hash code on all architectures. 4138 // 32bit Smi representation for the hash code on all architectures.
4139 static const intptr_t kHashBits = 30; 4139 static const intptr_t kHashBits = 30;
4140 4140
4141 static const intptr_t kOneByteChar = 1; 4141 static const intptr_t kOneByteChar = 1;
4142 static const intptr_t kTwoByteChar = 2; 4142 static const intptr_t kTwoByteChar = 2;
4143 4143
4144 // All strings share the same maximum element count to keep things 4144 // All strings share the same maximum element count to keep things
4145 // simple. We choose a value that will prevent integer overflow for 4145 // simple. We choose a value that will prevent integer overflow for
4146 // 2 byte strings, since it is the worst case. 4146 // 2 byte strings, since it is the worst case.
4147 static const intptr_t kSizeofRawString = sizeof(RawObject) + (2 * kWordSize); 4147 static const intptr_t kSizeofRawString =
4148 sizeof(RawInstance) + (2 * kWordSize);
4148 static const intptr_t kMaxElements = kSmiMax / kTwoByteChar; 4149 static const intptr_t kMaxElements = kSmiMax / kTwoByteChar;
4149 4150
4150 class CodePointIterator : public ValueObject { 4151 class CodePointIterator : public ValueObject {
4151 public: 4152 public:
4152 explicit CodePointIterator(const String& str) 4153 explicit CodePointIterator(const String& str)
4153 : str_(str), 4154 : str_(str),
4154 ch_(0), 4155 ch_(0),
4155 index_(-1), 4156 index_(-1),
4156 end_(str.Length()) { 4157 end_(str.Length()) {
4157 } 4158 }
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
4782 return OFFSET_OF(RawArray, type_arguments_); 4783 return OFFSET_OF(RawArray, type_arguments_);
4783 } 4784 }
4784 4785
4785 static intptr_t InstanceSize() { 4786 static intptr_t InstanceSize() {
4786 ASSERT(sizeof(RawArray) == OFFSET_OF_RETURNED_VALUE(RawArray, data)); 4787 ASSERT(sizeof(RawArray) == OFFSET_OF_RETURNED_VALUE(RawArray, data));
4787 return 0; 4788 return 0;
4788 } 4789 }
4789 4790
4790 static intptr_t InstanceSize(intptr_t len) { 4791 static intptr_t InstanceSize(intptr_t len) {
4791 // Ensure that variable length data is not adding to the object length. 4792 // Ensure that variable length data is not adding to the object length.
4792 ASSERT(sizeof(RawArray) == (sizeof(RawObject) + (2 * kWordSize))); 4793 ASSERT(sizeof(RawArray) == (sizeof(RawInstance) + (2 * kWordSize)));
4793 ASSERT(0 <= len && len <= kMaxElements); 4794 ASSERT(0 <= len && len <= kMaxElements);
4794 return RoundedAllocationSize(sizeof(RawArray) + (len * kBytesPerElement)); 4795 return RoundedAllocationSize(sizeof(RawArray) + (len * kBytesPerElement));
4795 } 4796 }
4796 4797
4797 // Make the array immutable to Dart code by switching the class pointer 4798 // Make the array immutable to Dart code by switching the class pointer
4798 // to ImmutableArray. 4799 // to ImmutableArray.
4799 void MakeImmutable() const; 4800 void MakeImmutable() const;
4800 4801
4801 static RawArray* New(intptr_t len, Heap::Space space = Heap::kNew); 4802 static RawArray* New(intptr_t len, Heap::Space space = Heap::kNew);
4802 4803
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
5660 5661
5661 5662
5662 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 5663 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
5663 intptr_t index) { 5664 intptr_t index) {
5664 return array.At((index * kEntryLength) + kTargetFunctionIndex); 5665 return array.At((index * kEntryLength) + kTargetFunctionIndex);
5665 } 5666 }
5666 5667
5667 } // namespace dart 5668 } // namespace dart
5668 5669
5669 #endif // VM_OBJECT_H_ 5670 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698