| 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 13407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13418 bool Code::FindRawCodeVisitor::FindObject(RawObject* raw_obj) const { | 13418 bool Code::FindRawCodeVisitor::FindObject(RawObject* raw_obj) const { |
| 13419 uword tags = raw_obj->ptr()->tags_; | 13419 uword tags = raw_obj->ptr()->tags_; |
| 13420 if (RawObject::ClassIdTag::decode(tags) == kInstructionsCid) { | 13420 if (RawObject::ClassIdTag::decode(tags) == kInstructionsCid) { |
| 13421 RawInstructions* raw_insts = reinterpret_cast<RawInstructions*>(raw_obj); | 13421 RawInstructions* raw_insts = reinterpret_cast<RawInstructions*>(raw_obj); |
| 13422 return RawInstructions::ContainsPC(raw_insts, pc_); | 13422 return RawInstructions::ContainsPC(raw_insts, pc_); |
| 13423 } | 13423 } |
| 13424 return false; | 13424 return false; |
| 13425 } | 13425 } |
| 13426 | 13426 |
| 13427 | 13427 |
| 13428 bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const { |
| 13429 return RawCode::ContainsPC(raw_obj, pc_); |
| 13430 } |
| 13431 |
| 13432 |
| 13428 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { | 13433 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { |
| 13429 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); | 13434 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); |
| 13430 NoSafepointScope no_safepoint; | |
| 13431 FindRawCodeVisitor visitor(pc); | |
| 13432 RawInstructions* instr; | |
| 13433 if (Dart::IsRunningPrecompiledCode()) { | |
| 13434 // TODO(johnmccutchan): Make code lookup work when running precompiled. | |
| 13435 UNIMPLEMENTED(); | |
| 13436 return Code::null(); | |
| 13437 } | |
| 13438 if (isolate->heap() == NULL) { | 13435 if (isolate->heap() == NULL) { |
| 13439 return Code::null(); | 13436 return Code::null(); |
| 13440 } | 13437 } |
| 13441 instr = isolate->heap()->FindObjectInCodeSpace(&visitor); | 13438 NoSafepointScope no_safepoint; |
| 13442 if (instr != Instructions::null()) { | 13439 // TODO(johnmccutchan): Make lookup without a back pointer faster and use for |
| 13443 return Instructions::Handle(instr).code(); | 13440 // both cases. |
| 13441 if (Dart::IsRunningPrecompiledCode()) { |
| 13442 SlowFindRawCodeVisitor visitor(pc); |
| 13443 RawObject* needle = isolate->heap()->FindOldObject(&visitor); |
| 13444 if (needle != Code::null()) { |
| 13445 return static_cast<RawCode*>(needle); |
| 13446 } |
| 13447 return Code::null(); |
| 13448 } else { |
| 13449 FindRawCodeVisitor visitor(pc); |
| 13450 RawInstructions* instr; |
| 13451 instr = isolate->heap()->FindObjectInCodeSpace(&visitor); |
| 13452 if (instr != Instructions::null()) { |
| 13453 return Instructions::Handle(instr).code(); |
| 13454 } |
| 13455 return Code::null(); |
| 13444 } | 13456 } |
| 13445 return Code::null(); | |
| 13446 } | 13457 } |
| 13447 | 13458 |
| 13448 | 13459 |
| 13449 RawCode* Code::LookupCode(uword pc) { | 13460 RawCode* Code::LookupCode(uword pc) { |
| 13450 return LookupCodeInIsolate(Isolate::Current(), pc); | 13461 return LookupCodeInIsolate(Isolate::Current(), pc); |
| 13451 } | 13462 } |
| 13452 | 13463 |
| 13453 | 13464 |
| 13454 RawCode* Code::LookupCodeInVmIsolate(uword pc) { | 13465 RawCode* Code::LookupCodeInVmIsolate(uword pc) { |
| 13455 return LookupCodeInIsolate(Dart::vm_isolate(), pc); | 13466 return LookupCodeInIsolate(Dart::vm_isolate(), pc); |
| (...skipping 8461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21917 return tag_label.ToCString(); | 21928 return tag_label.ToCString(); |
| 21918 } | 21929 } |
| 21919 | 21930 |
| 21920 | 21931 |
| 21921 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21932 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21922 Instance::PrintJSONImpl(stream, ref); | 21933 Instance::PrintJSONImpl(stream, ref); |
| 21923 } | 21934 } |
| 21924 | 21935 |
| 21925 | 21936 |
| 21926 } // namespace dart | 21937 } // namespace dart |
| OLD | NEW |