| 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/stack_frame.h" | 5 #include "vm/stack_frame.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/deopt_instructions.h" | 8 #include "vm/deopt_instructions.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| 11 #include "vm/object_store.h" | 11 #include "vm/object_store.h" |
| 12 #include "vm/os.h" | 12 #include "vm/os.h" |
| 13 #include "vm/parser.h" | 13 #include "vm/parser.h" |
| 14 #include "vm/raw_object.h" | 14 #include "vm/raw_object.h" |
| 15 #include "vm/stub_code.h" | 15 #include "vm/stub_code.h" |
| 16 #include "vm/visitor.h" | 16 #include "vm/visitor.h" |
| 17 | 17 |
| 18 namespace dart { | 18 namespace dart { |
| 19 | 19 |
| 20 | 20 |
| 21 bool StackFrame::IsStubFrame() const { | 21 bool StackFrame::IsStubFrame() const { |
| 22 ASSERT(!(IsEntryFrame() || IsExitFrame())); | 22 ASSERT(!(IsEntryFrame() || IsExitFrame())); |
| 23 uword saved_pc = | 23 uword saved_pc = |
| 24 *(reinterpret_cast<uword*>(fp() + (kPcMarkerSlotFromFp * kWordSize))); | 24 *(reinterpret_cast<uword*>(fp() + (kPcMarkerSlotFromFp * kWordSize))); |
| 25 return (saved_pc == 0); | 25 return (saved_pc == 0); |
| 26 } | 26 } |
| 27 | 27 |
| 28 | 28 |
| 29 void StackFrame::Print() const { | 29 const char* StackFrame::ToCString() const { |
| 30 OS::Print("[%-8s : sp(%#" Px ") ]\n", GetName(), sp()); | 30 Zone* zone = Isolate::Current()->current_zone(); |
| 31 if (IsDartFrame()) { |
| 32 const Code& code = Code::Handle(LookupDartCode()); |
| 33 ASSERT(!code.IsNull()); |
| 34 const Object& owner = Object::Handle(code.owner()); |
| 35 ASSERT(!owner.IsNull()); |
| 36 if (owner.IsFunction()) { |
| 37 const Function& function = Function::Cast(owner); |
| 38 return zone->PrintToString( |
| 39 "[%-8s : sp(%#" Px ") fp(%#" Px ") pc(%#" Px ") %s ]", |
| 40 GetName(), sp(), fp(), pc(), |
| 41 function.ToFullyQualifiedCString()); |
| 42 } else { |
| 43 return zone->PrintToString( |
| 44 "[%-8s : sp(%#" Px ") fp(%#" Px ") pc(%#" Px ") %s ]", |
| 45 GetName(), sp(), fp(), pc(), |
| 46 owner.ToCString()); |
| 47 } |
| 48 } else { |
| 49 return zone->PrintToString( |
| 50 "[%-8s : sp(%#" Px ") fp(%#" Px ") pc(%#" Px ")]", |
| 51 GetName(), sp(), fp(), pc()); |
| 52 } |
| 31 } | 53 } |
| 32 | 54 |
| 33 | 55 |
| 34 void ExitFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 56 void ExitFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
| 35 // There are no objects to visit in this frame. | 57 // There are no objects to visit in this frame. |
| 36 } | 58 } |
| 37 | 59 |
| 38 | 60 |
| 39 RawContext* EntryFrame::SavedContext() const { | 61 RawContext* EntryFrame::SavedContext() const { |
| 40 return *(reinterpret_cast<RawContext**>( | 62 return *(reinterpret_cast<RawContext**>( |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { | 450 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { |
| 429 return (index - num_materializations_); | 451 return (index - num_materializations_); |
| 430 } | 452 } |
| 431 } | 453 } |
| 432 UNREACHABLE(); | 454 UNREACHABLE(); |
| 433 return 0; | 455 return 0; |
| 434 } | 456 } |
| 435 | 457 |
| 436 | 458 |
| 437 } // namespace dart | 459 } // namespace dart |
| OLD | NEW |