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

Side by Side Diff: vm/object.h

Issue 9072011: - Add a size field to the header. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 8 years, 11 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/assert.h" 8 #include "vm/assert.h"
9 #include "vm/dart.h" 9 #include "vm/dart.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 kApiErrorClass, 145 kApiErrorClass,
146 kMaxId, 146 kMaxId,
147 kInvalidIndex = -1, 147 kInvalidIndex = -1,
148 }; 148 };
149 149
150 virtual ~Object() { } 150 virtual ~Object() { }
151 151
152 RawObject* raw() const { return raw_; } 152 RawObject* raw() const { return raw_; }
153 void operator=(RawObject* value) { SetRaw(value); } 153 void operator=(RawObject* value) { SetRaw(value); }
154 154
155 void set_tags(intptr_t tags) { 155 void set_tags(intptr_t value) {
156 // TODO(asiva): Remove the capability of setting tags in general. The mask
157 // here only allows for canonical and from_snapshot flags to be set.
156 ASSERT(!IsNull()); 158 ASSERT(!IsNull());
157 raw()->ptr()->tags_ = tags; 159 uword tags = raw()->ptr()->tags_ & ~0x0000000c;
160 raw()->ptr()->tags_ = tags | (value & 0x0000000c);
158 } 161 }
159 void SetCreatedFromSnapshot() const { 162 void SetCreatedFromSnapshot() const {
160 ASSERT(!IsNull()); 163 ASSERT(!IsNull());
161 raw()->SetCreatedFromSnapshot(); 164 raw()->SetCreatedFromSnapshot();
162 } 165 }
163 bool IsCanonical() const { 166 bool IsCanonical() const {
164 ASSERT(!IsNull()); 167 ASSERT(!IsNull());
165 return raw()->IsCanonical(); 168 return raw()->IsCanonical();
166 } 169 }
167 void SetCanonical() const { 170 void SetCanonical() const {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 static RawClass* library_prefix_class_; // Class of Library prefix vm object. 365 static RawClass* library_prefix_class_; // Class of Library prefix vm object.
363 static RawClass* code_class_; // Class of the Code vm object. 366 static RawClass* code_class_; // Class of the Code vm object.
364 static RawClass* instructions_class_; // Class of the Instructions vm object. 367 static RawClass* instructions_class_; // Class of the Instructions vm object.
365 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. 368 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object.
366 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors. 369 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors.
367 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. 370 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers.
368 static RawClass* context_class_; // Class of the Context vm object. 371 static RawClass* context_class_; // Class of the Context vm object.
369 static RawClass* context_scope_class_; // Class of ContextScope vm object. 372 static RawClass* context_scope_class_; // Class of ContextScope vm object.
370 static RawClass* api_error_class_; // Class of ApiError. 373 static RawClass* api_error_class_; // Class of ApiError.
371 374
375 friend void RawObject::Validate() const;
372 friend class Class; 376 friend class Class;
373 friend class SnapshotReader; 377 friend class SnapshotReader;
374 378
375 // Disallow allocation. 379 // Disallow allocation.
376 void* operator new(size_t size); 380 void* operator new(size_t size);
377 // Disallow copy constructor. 381 // Disallow copy constructor.
378 DISALLOW_COPY_AND_ASSIGN(Object); 382 DISALLOW_COPY_AND_ASSIGN(Object);
379 }; 383 };
380 384
381 385
(...skipping 2966 matching lines...) Expand 10 before | Expand all | Expand 10 after
3348 } 3352 }
3349 3353
3350 3354
3351 void Context::SetAt(intptr_t index, const Instance& value) const { 3355 void Context::SetAt(intptr_t index, const Instance& value) const {
3352 StorePointer(InstanceAddr(index), value.raw()); 3356 StorePointer(InstanceAddr(index), value.raw());
3353 } 3357 }
3354 3358
3355 } // namespace dart 3359 } // namespace dart
3356 3360
3357 #endif // VM_OBJECT_H_ 3361 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698