| 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 7293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7304 | 7304 |
| 7305 RawObject* Library::GetMetadata(const Object& obj) const { | 7305 RawObject* Library::GetMetadata(const Object& obj) const { |
| 7306 if (!obj.IsClass() && !obj.IsField() && !obj.IsFunction() && | 7306 if (!obj.IsClass() && !obj.IsField() && !obj.IsFunction() && |
| 7307 !obj.IsLibrary() && !obj.IsTypeParameter()) { | 7307 !obj.IsLibrary() && !obj.IsTypeParameter()) { |
| 7308 return Object::null(); | 7308 return Object::null(); |
| 7309 } | 7309 } |
| 7310 const String& metaname = String::Handle(MakeMetadataName(obj)); | 7310 const String& metaname = String::Handle(MakeMetadataName(obj)); |
| 7311 Field& field = Field::Handle(GetMetadataField(metaname)); | 7311 Field& field = Field::Handle(GetMetadataField(metaname)); |
| 7312 if (field.IsNull()) { | 7312 if (field.IsNull()) { |
| 7313 // There is no metadata for this object. | 7313 // There is no metadata for this object. |
| 7314 return Object::empty_array().raw();; | 7314 return Object::empty_array().raw(); |
| 7315 } | 7315 } |
| 7316 Object& metadata = Object::Handle(); | 7316 Object& metadata = Object::Handle(); |
| 7317 metadata = field.value(); | 7317 metadata = field.value(); |
| 7318 if (field.value() == Object::empty_array().raw()) { | 7318 if (field.value() == Object::empty_array().raw()) { |
| 7319 metadata = Parser::ParseMetadata(Class::Handle(field.owner()), | 7319 metadata = Parser::ParseMetadata(Class::Handle(field.owner()), |
| 7320 field.token_pos()); | 7320 field.token_pos()); |
| 7321 if (metadata.IsArray()) { | 7321 if (metadata.IsArray()) { |
| 7322 ASSERT(Array::Cast(metadata).raw() != Object::empty_array().raw()); | 7322 ASSERT(Array::Cast(metadata).raw() != Object::empty_array().raw()); |
| 7323 field.set_value(Array::Cast(metadata)); | 7323 field.set_value(Array::Cast(metadata)); |
| 7324 } | 7324 } |
| (...skipping 2265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9590 bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) { | 9590 bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) { |
| 9591 return RawInstructions::ContainsPC(obj, pc_); | 9591 return RawInstructions::ContainsPC(obj, pc_); |
| 9592 } | 9592 } |
| 9593 | 9593 |
| 9594 | 9594 |
| 9595 RawCode* Code::LookupCode(uword pc) { | 9595 RawCode* Code::LookupCode(uword pc) { |
| 9596 Isolate* isolate = Isolate::Current(); | 9596 Isolate* isolate = Isolate::Current(); |
| 9597 NoGCScope no_gc; | 9597 NoGCScope no_gc; |
| 9598 FindRawCodeVisitor visitor(pc); | 9598 FindRawCodeVisitor visitor(pc); |
| 9599 RawInstructions* instr; | 9599 RawInstructions* instr; |
| 9600 if (isolate->heap() == NULL) { |
| 9601 return Code::null(); |
| 9602 } |
| 9600 instr = isolate->heap()->FindObjectInCodeSpace(&visitor); | 9603 instr = isolate->heap()->FindObjectInCodeSpace(&visitor); |
| 9601 if (instr != Instructions::null()) { | 9604 if (instr != Instructions::null()) { |
| 9602 return instr->ptr()->code_; | 9605 return instr->ptr()->code_; |
| 9603 } | 9606 } |
| 9604 return Code::null(); | 9607 return Code::null(); |
| 9605 } | 9608 } |
| 9606 | 9609 |
| 9607 | 9610 |
| 9608 intptr_t Code::GetTokenIndexOfPC(uword pc) const { | 9611 intptr_t Code::GetTokenIndexOfPC(uword pc) const { |
| 9609 intptr_t token_pos = -1; | 9612 intptr_t token_pos = -1; |
| (...skipping 6306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15916 return "_MirrorReference"; | 15919 return "_MirrorReference"; |
| 15917 } | 15920 } |
| 15918 | 15921 |
| 15919 | 15922 |
| 15920 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 15923 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 15921 JSONObject jsobj(stream); | 15924 JSONObject jsobj(stream); |
| 15922 } | 15925 } |
| 15923 | 15926 |
| 15924 | 15927 |
| 15925 } // namespace dart | 15928 } // namespace dart |
| OLD | NEW |