| 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/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 12105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12116 return Instance::null(); | 12116 return Instance::null(); |
| 12117 } | 12117 } |
| 12118 intptr_t instance_size = cls.instance_size(); | 12118 intptr_t instance_size = cls.instance_size(); |
| 12119 ASSERT(instance_size > 0); | 12119 ASSERT(instance_size > 0); |
| 12120 RawObject* raw = Object::Allocate(cls.id(), instance_size, space); | 12120 RawObject* raw = Object::Allocate(cls.id(), instance_size, space); |
| 12121 return reinterpret_cast<RawInstance*>(raw); | 12121 return reinterpret_cast<RawInstance*>(raw); |
| 12122 } | 12122 } |
| 12123 | 12123 |
| 12124 | 12124 |
| 12125 bool Instance::IsValidFieldOffset(intptr_t offset) const { | 12125 bool Instance::IsValidFieldOffset(intptr_t offset) const { |
| 12126 const Class& cls = Class::Handle(clazz()); | 12126 Isolate* isolate = Isolate::Current(); |
| 12127 REUSABLE_CLASS_HANDLESCOPE(isolate); |
| 12128 Class& cls = isolate->ClassHandle(); |
| 12129 cls = clazz(); |
| 12127 return (offset >= 0 && offset <= (cls.instance_size() - kWordSize)); | 12130 return (offset >= 0 && offset <= (cls.instance_size() - kWordSize)); |
| 12128 } | 12131 } |
| 12129 | 12132 |
| 12130 | 12133 |
| 12131 const char* Instance::ToCString() const { | 12134 const char* Instance::ToCString() const { |
| 12132 if (IsNull()) { | 12135 if (IsNull()) { |
| 12133 return "null"; | 12136 return "null"; |
| 12134 } else if (raw() == Object::sentinel().raw()) { | 12137 } else if (raw() == Object::sentinel().raw()) { |
| 12135 return "sentinel"; | 12138 return "sentinel"; |
| 12136 } else if (raw() == Object::transition_sentinel().raw()) { | 12139 } else if (raw() == Object::transition_sentinel().raw()) { |
| (...skipping 5444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17581 return "_MirrorReference"; | 17584 return "_MirrorReference"; |
| 17582 } | 17585 } |
| 17583 | 17586 |
| 17584 | 17587 |
| 17585 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 17588 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 17586 Instance::PrintToJSONStream(stream, ref); | 17589 Instance::PrintToJSONStream(stream, ref); |
| 17587 } | 17590 } |
| 17588 | 17591 |
| 17589 | 17592 |
| 17590 } // namespace dart | 17593 } // namespace dart |
| OLD | NEW |