| 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/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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 return; | 26 return; |
| 27 } | 27 } |
| 28 // Validate that the tags_ field is sensible. | 28 // Validate that the tags_ field is sensible. |
| 29 uword tags = ptr()->tags_; | 29 uword tags = ptr()->tags_; |
| 30 ASSERT((tags & 0x000000f0) == 0); | 30 ASSERT((tags & 0x000000f0) == 0); |
| 31 #endif | 31 #endif |
| 32 } | 32 } |
| 33 | 33 |
| 34 | 34 |
| 35 intptr_t RawObject::SizeFromClass() const { | 35 intptr_t RawObject::SizeFromClass() const { |
| 36 NoHandleScope no_handles(Isolate::Current()); | 36 Isolate* isolate = Isolate::Current(); |
| 37 NoHandleScope no_handles(isolate); |
| 37 | 38 |
| 38 // Only reasonable to be called on heap objects. | 39 // Only reasonable to be called on heap objects. |
| 39 ASSERT(IsHeapObject()); | 40 ASSERT(IsHeapObject()); |
| 40 | 41 |
| 41 RawClass* raw_class = Isolate::Current()->class_table()->At(GetClassId()); | 42 RawClass* raw_class = isolate->class_table()->At(GetClassId()); |
| 42 intptr_t instance_size = raw_class->ptr()->instance_size_; | 43 intptr_t instance_size = raw_class->ptr()->instance_size_; |
| 43 ObjectKind instance_kind = raw_class->ptr()->instance_kind_; | 44 ObjectKind instance_kind = raw_class->ptr()->instance_kind_; |
| 44 | 45 |
| 45 if (instance_size == 0) { | 46 if (instance_size == 0) { |
| 46 switch (instance_kind) { | 47 switch (instance_kind) { |
| 47 case kTokenStream: { | 48 case kTokenStream: { |
| 48 const RawTokenStream* raw_tokens = | 49 const RawTokenStream* raw_tokens = |
| 49 reinterpret_cast<const RawTokenStream*>(this); | 50 reinterpret_cast<const RawTokenStream*>(this); |
| 50 intptr_t tokens_length = Smi::Value(raw_tokens->ptr()->length_); | 51 intptr_t tokens_length = Smi::Value(raw_tokens->ptr()->length_); |
| 51 instance_size = TokenStream::InstanceSize(tokens_length); | 52 instance_size = TokenStream::InstanceSize(tokens_length); |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, | 941 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, |
| 941 ObjectPointerVisitor* visitor) { | 942 ObjectPointerVisitor* visitor) { |
| 942 // Make sure that we got here with the tagged pointer as this. | 943 // Make sure that we got here with the tagged pointer as this. |
| 943 ASSERT(raw_obj->IsHeapObject()); | 944 ASSERT(raw_obj->IsHeapObject()); |
| 944 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); | 945 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); |
| 945 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 946 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 946 return JSRegExp::InstanceSize(length); | 947 return JSRegExp::InstanceSize(length); |
| 947 } | 948 } |
| 948 | 949 |
| 949 } // namespace dart | 950 } // namespace dart |
| OLD | NEW |