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

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

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 | « runtime/vm/raw_object.h ('k') | no next file » | 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 #include "vm/raw_object.h" 5 #include "vm/raw_object.h"
6 6
7 #include "vm/class_table.h" 7 #include "vm/class_table.h"
8 #include "vm/freelist.h" 8 #include "vm/freelist.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
11 #include "vm/visitor.h" 11 #include "vm/visitor.h"
12 12
13 13
14 namespace dart { 14 namespace dart {
15 15
16 void RawObject::Validate(Isolate* isolate) const { 16 void RawObject::Validate(Isolate* isolate) const {
17 if (Object::null_class_ == reinterpret_cast<RawClass*>(kHeapObjectTag)) { 17 if (Object::null_class_ == reinterpret_cast<RawClass*>(kHeapObjectTag)) {
18 // Validation relies on properly initialized class classes. Skip if the 18 // Validation relies on properly initialized class classes. Skip if the
19 // VM is still being initialized. 19 // VM is still being initialized.
20 return; 20 return;
21 } 21 }
22 // All Smi values are valid. 22 // All Smi values are valid.
23 if (!IsHeapObject()) { 23 if (!IsHeapObject()) {
24 return; 24 return;
25 } 25 }
26 // Validate that the tags_ field is sensible. 26 // Validate that the tags_ field is sensible.
27 uword tags = ptr()->tags_; 27 uword tags = ptr()->tags_;
28 uword reserved = 0; 28 intptr_t reserved = ReservedBits::decode(tags);
29 reserved |= (1 << kReservedBit10K); 29 if (reserved != 0) {
30 reserved |= (1 << kReservedBit100K);
31 reserved |= (1 << kReservedBit1M);
32 reserved |= (1 << kReservedBit10M);
33 if ((tags & reserved) != 0) {
34 FATAL1("Invalid tags field encountered %#lx\n", tags); 30 FATAL1("Invalid tags field encountered %#lx\n", tags);
35 } 31 }
36 intptr_t class_id = ClassIdTag::decode(tags); 32 intptr_t class_id = ClassIdTag::decode(tags);
37 if (!isolate->class_table()->IsValidIndex(class_id)) { 33 if (!isolate->class_table()->IsValidIndex(class_id)) {
38 FATAL1("Invalid class id encountered %d\n", class_id); 34 FATAL1("Invalid class id encountered %d\n", class_id);
39 } 35 }
40 intptr_t size = SizeTag::decode(tags); 36 intptr_t size = SizeTag::decode(tags);
41 if (size != 0 && size != SizeFromClass()) { 37 if (size != 0 && size != SizeFromClass()) {
42 FATAL1("Inconsistent class size encountered %d\n", size); 38 FATAL1("Inconsistent class size encountered %d\n", size);
43 } 39 }
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, 949 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj,
954 ObjectPointerVisitor* visitor) { 950 ObjectPointerVisitor* visitor) {
955 // Make sure that we got here with the tagged pointer as this. 951 // Make sure that we got here with the tagged pointer as this.
956 ASSERT(raw_obj->IsHeapObject()); 952 ASSERT(raw_obj->IsHeapObject());
957 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); 953 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_);
958 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 954 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
959 return JSRegExp::InstanceSize(length); 955 return JSRegExp::InstanceSize(length);
960 } 956 }
961 957
962 } // namespace dart 958 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698