OLD | NEW |
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/freelist.h" | 7 #include "vm/freelist.h" |
8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 ASSERT(raw_class_class->IsHeapObject()); | 29 ASSERT(raw_class_class->IsHeapObject()); |
30 ASSERT(raw_class_class->ptr()->instance_kind_ == kClass); | 30 ASSERT(raw_class_class->ptr()->instance_kind_ == kClass); |
31 | 31 |
32 // Validate that the tags_ field is sensible. | 32 // Validate that the tags_ field is sensible. |
33 intptr_t tags = ptr()->tags_; | 33 intptr_t tags = ptr()->tags_; |
34 ASSERT((tags & 0xffff00f0) == 0); | 34 ASSERT((tags & 0xffff00f0) == 0); |
35 } | 35 } |
36 | 36 |
37 | 37 |
38 intptr_t RawObject::SizeFromClass() const { | 38 intptr_t RawObject::SizeFromClass() const { |
39 NoHandleScope no_handles(Isolate::Current()); | 39 NOHANDLESCOPE(Isolate::Current()); |
40 | 40 |
41 // Only reasonable to be called on heap objects. | 41 // Only reasonable to be called on heap objects. |
42 ASSERT(IsHeapObject()); | 42 ASSERT(IsHeapObject()); |
43 | 43 |
44 RawClass* raw_class = ptr()->class_; | 44 RawClass* raw_class = ptr()->class_; |
45 intptr_t instance_size = raw_class->ptr()->instance_size_; | 45 intptr_t instance_size = raw_class->ptr()->instance_size_; |
46 ObjectKind instance_kind = raw_class->ptr()->instance_kind_; | 46 ObjectKind instance_kind = raw_class->ptr()->instance_kind_; |
47 | 47 |
48 if (instance_size == 0) { | 48 if (instance_size == 0) { |
49 switch (instance_kind) { | 49 switch (instance_kind) { |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 intptr_t tags = ptr()->tags_; | 180 intptr_t tags = ptr()->tags_; |
181 ASSERT((instance_size == SizeTag::decode(tags)) || | 181 ASSERT((instance_size == SizeTag::decode(tags)) || |
182 (SizeTag::decode(tags) == 0) || | 182 (SizeTag::decode(tags) == 0) || |
183 FreeBit::decode(tags)); | 183 FreeBit::decode(tags)); |
184 return instance_size; | 184 return instance_size; |
185 } | 185 } |
186 | 186 |
187 | 187 |
188 intptr_t RawObject::VisitPointers(ObjectPointerVisitor* visitor) { | 188 intptr_t RawObject::VisitPointers(ObjectPointerVisitor* visitor) { |
189 intptr_t size = 0; | 189 intptr_t size = 0; |
190 NoHandleScope no_handles(Isolate::Current()); | 190 NOHANDLESCOPE(Isolate::Current()); |
191 | 191 |
192 // Only reasonable to be called on heap objects. | 192 // Only reasonable to be called on heap objects. |
193 ASSERT(IsHeapObject()); | 193 ASSERT(IsHeapObject()); |
194 | 194 |
195 // Read the necessary data out of the class before visting the class itself. | 195 // Read the necessary data out of the class before visting the class itself. |
196 RawClass* raw_class = ptr()->class_; | 196 RawClass* raw_class = ptr()->class_; |
197 ObjectKind kind = raw_class->ptr()->instance_kind_; | 197 ObjectKind kind = raw_class->ptr()->instance_kind_; |
198 | 198 |
199 // Visit the class before visting the fields. | 199 // Visit the class before visting the fields. |
200 visitor->VisitPointer(reinterpret_cast<RawObject**>(&ptr()->class_)); | 200 visitor->VisitPointer(reinterpret_cast<RawObject**>(&ptr()->class_)); |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, | 693 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, |
694 ObjectPointerVisitor* visitor) { | 694 ObjectPointerVisitor* visitor) { |
695 // Make sure that we got here with the tagged pointer as this. | 695 // Make sure that we got here with the tagged pointer as this. |
696 ASSERT(raw_obj->IsHeapObject()); | 696 ASSERT(raw_obj->IsHeapObject()); |
697 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); | 697 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); |
698 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 698 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
699 return JSRegExp::InstanceSize(length); | 699 return JSRegExp::InstanceSize(length); |
700 } | 700 } |
701 | 701 |
702 } // namespace dart | 702 } // namespace dart |
OLD | NEW |