| 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 7100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7111 | 7111 |
| 7112 RawObject* Library::GetMetadata(const Object& obj) const { | 7112 RawObject* Library::GetMetadata(const Object& obj) const { |
| 7113 if (!obj.IsClass() && !obj.IsField() && !obj.IsFunction() && | 7113 if (!obj.IsClass() && !obj.IsField() && !obj.IsFunction() && |
| 7114 !obj.IsLibrary() && !obj.IsTypeParameter()) { | 7114 !obj.IsLibrary() && !obj.IsTypeParameter()) { |
| 7115 return Object::null(); | 7115 return Object::null(); |
| 7116 } | 7116 } |
| 7117 const String& metaname = String::Handle(MakeMetadataName(obj)); | 7117 const String& metaname = String::Handle(MakeMetadataName(obj)); |
| 7118 Field& field = Field::Handle(GetMetadataField(metaname)); | 7118 Field& field = Field::Handle(GetMetadataField(metaname)); |
| 7119 if (field.IsNull()) { | 7119 if (field.IsNull()) { |
| 7120 // There is no metadata for this object. | 7120 // There is no metadata for this object. |
| 7121 return Object::empty_array().raw();; | 7121 return Object::empty_array().raw(); |
| 7122 } | 7122 } |
| 7123 Object& metadata = Object::Handle(); | 7123 Object& metadata = Object::Handle(); |
| 7124 metadata = field.value(); | 7124 metadata = field.value(); |
| 7125 if (field.value() == Object::empty_array().raw()) { | 7125 if (field.value() == Object::empty_array().raw()) { |
| 7126 metadata = Parser::ParseMetadata(Class::Handle(field.owner()), | 7126 metadata = Parser::ParseMetadata(Class::Handle(field.owner()), |
| 7127 field.token_pos()); | 7127 field.token_pos()); |
| 7128 if (metadata.IsArray()) { | 7128 if (metadata.IsArray()) { |
| 7129 ASSERT(Array::Cast(metadata).raw() != Object::empty_array().raw()); | 7129 ASSERT(Array::Cast(metadata).raw() != Object::empty_array().raw()); |
| 7130 field.set_value(Array::Cast(metadata)); | 7130 field.set_value(Array::Cast(metadata)); |
| 7131 } | 7131 } |
| (...skipping 2261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9393 bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) { | 9393 bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) { |
| 9394 return RawInstructions::ContainsPC(obj, pc_); | 9394 return RawInstructions::ContainsPC(obj, pc_); |
| 9395 } | 9395 } |
| 9396 | 9396 |
| 9397 | 9397 |
| 9398 RawCode* Code::LookupCode(uword pc) { | 9398 RawCode* Code::LookupCode(uword pc) { |
| 9399 Isolate* isolate = Isolate::Current(); | 9399 Isolate* isolate = Isolate::Current(); |
| 9400 NoGCScope no_gc; | 9400 NoGCScope no_gc; |
| 9401 FindRawCodeVisitor visitor(pc); | 9401 FindRawCodeVisitor visitor(pc); |
| 9402 RawInstructions* instr; | 9402 RawInstructions* instr; |
| 9403 if (isolate->heap() == NULL) { |
| 9404 return Code::null(); |
| 9405 } |
| 9403 instr = isolate->heap()->FindObjectInCodeSpace(&visitor); | 9406 instr = isolate->heap()->FindObjectInCodeSpace(&visitor); |
| 9404 if (instr != Instructions::null()) { | 9407 if (instr != Instructions::null()) { |
| 9405 return instr->ptr()->code_; | 9408 return instr->ptr()->code_; |
| 9406 } | 9409 } |
| 9407 return Code::null(); | 9410 return Code::null(); |
| 9408 } | 9411 } |
| 9409 | 9412 |
| 9410 | 9413 |
| 9411 intptr_t Code::GetTokenIndexOfPC(uword pc) const { | 9414 intptr_t Code::GetTokenIndexOfPC(uword pc) const { |
| 9412 intptr_t token_pos = -1; | 9415 intptr_t token_pos = -1; |
| (...skipping 6146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15559 return "_MirrorReference"; | 15562 return "_MirrorReference"; |
| 15560 } | 15563 } |
| 15561 | 15564 |
| 15562 | 15565 |
| 15563 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 15566 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 15564 JSONObject jsobj(stream); | 15567 JSONObject jsobj(stream); |
| 15565 } | 15568 } |
| 15566 | 15569 |
| 15567 | 15570 |
| 15568 } // namespace dart | 15571 } // namespace dart |
| OLD | NEW |