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 7278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7289 | 7289 |
7290 RawObject* Library::GetMetadata(const Object& obj) const { | 7290 RawObject* Library::GetMetadata(const Object& obj) const { |
7291 if (!obj.IsClass() && !obj.IsField() && !obj.IsFunction() && | 7291 if (!obj.IsClass() && !obj.IsField() && !obj.IsFunction() && |
7292 !obj.IsLibrary() && !obj.IsTypeParameter()) { | 7292 !obj.IsLibrary() && !obj.IsTypeParameter()) { |
7293 return Object::null(); | 7293 return Object::null(); |
7294 } | 7294 } |
7295 const String& metaname = String::Handle(MakeMetadataName(obj)); | 7295 const String& metaname = String::Handle(MakeMetadataName(obj)); |
7296 Field& field = Field::Handle(GetMetadataField(metaname)); | 7296 Field& field = Field::Handle(GetMetadataField(metaname)); |
7297 if (field.IsNull()) { | 7297 if (field.IsNull()) { |
7298 // There is no metadata for this object. | 7298 // There is no metadata for this object. |
7299 return Object::empty_array().raw();; | 7299 return Object::empty_array().raw(); |
7300 } | 7300 } |
7301 Object& metadata = Object::Handle(); | 7301 Object& metadata = Object::Handle(); |
7302 metadata = field.value(); | 7302 metadata = field.value(); |
7303 if (field.value() == Object::empty_array().raw()) { | 7303 if (field.value() == Object::empty_array().raw()) { |
7304 metadata = Parser::ParseMetadata(Class::Handle(field.owner()), | 7304 metadata = Parser::ParseMetadata(Class::Handle(field.owner()), |
7305 field.token_pos()); | 7305 field.token_pos()); |
7306 if (metadata.IsArray()) { | 7306 if (metadata.IsArray()) { |
7307 ASSERT(Array::Cast(metadata).raw() != Object::empty_array().raw()); | 7307 ASSERT(Array::Cast(metadata).raw() != Object::empty_array().raw()); |
7308 field.set_value(Array::Cast(metadata)); | 7308 field.set_value(Array::Cast(metadata)); |
7309 } | 7309 } |
(...skipping 2265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9575 bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) { | 9575 bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) { |
9576 return RawInstructions::ContainsPC(obj, pc_); | 9576 return RawInstructions::ContainsPC(obj, pc_); |
9577 } | 9577 } |
9578 | 9578 |
9579 | 9579 |
9580 RawCode* Code::LookupCode(uword pc) { | 9580 RawCode* Code::LookupCode(uword pc) { |
9581 Isolate* isolate = Isolate::Current(); | 9581 Isolate* isolate = Isolate::Current(); |
9582 NoGCScope no_gc; | 9582 NoGCScope no_gc; |
9583 FindRawCodeVisitor visitor(pc); | 9583 FindRawCodeVisitor visitor(pc); |
9584 RawInstructions* instr; | 9584 RawInstructions* instr; |
| 9585 if (isolate->heap() == NULL) { |
| 9586 return Code::null(); |
| 9587 } |
9585 instr = isolate->heap()->FindObjectInCodeSpace(&visitor); | 9588 instr = isolate->heap()->FindObjectInCodeSpace(&visitor); |
9586 if (instr != Instructions::null()) { | 9589 if (instr != Instructions::null()) { |
9587 return instr->ptr()->code_; | 9590 return instr->ptr()->code_; |
9588 } | 9591 } |
9589 return Code::null(); | 9592 return Code::null(); |
9590 } | 9593 } |
9591 | 9594 |
9592 | 9595 |
9593 intptr_t Code::GetTokenIndexOfPC(uword pc) const { | 9596 intptr_t Code::GetTokenIndexOfPC(uword pc) const { |
9594 intptr_t token_pos = -1; | 9597 intptr_t token_pos = -1; |
(...skipping 6152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15747 return "_MirrorReference"; | 15750 return "_MirrorReference"; |
15748 } | 15751 } |
15749 | 15752 |
15750 | 15753 |
15751 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 15754 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
15752 JSONObject jsobj(stream); | 15755 JSONObject jsobj(stream); |
15753 } | 15756 } |
15754 | 15757 |
15755 | 15758 |
15756 } // namespace dart | 15759 } // namespace dart |
OLD | NEW |