| 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_macros.h" | 7 #include "vm/assembler_macros.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 = *(reinterpret_cast<uword*>(fp() - kWordSize)); | 23 uword saved_pc = |
| 24 *(reinterpret_cast<uword*>(fp() + EntrypointMarkerOffsetFromFp())); |
| 24 return (saved_pc == 0); | 25 return (saved_pc == 0); |
| 25 } | 26 } |
| 26 | 27 |
| 27 | 28 |
| 28 void StackFrame::Print() const { | 29 void StackFrame::Print() const { |
| 29 OS::Print("[%-8s : sp(%#"Px") ]\n", GetName(), sp()); | 30 OS::Print("[%-8s : sp(%#"Px") ]\n", GetName(), sp()); |
| 30 } | 31 } |
| 31 | 32 |
| 32 | 33 |
| 33 void ExitFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 34 void ExitFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 ASSERT(code == Code::null() || code->ptr()->function_ != Function::null()); | 132 ASSERT(code == Code::null() || code->ptr()->function_ != Function::null()); |
| 132 return code; | 133 return code; |
| 133 } | 134 } |
| 134 | 135 |
| 135 | 136 |
| 136 RawCode* StackFrame::GetCodeObject() const { | 137 RawCode* StackFrame::GetCodeObject() const { |
| 137 // We add a no gc scope to ensure that the code below does not trigger | 138 // We add a no gc scope to ensure that the code below does not trigger |
| 138 // a GC as we are handling raw object references here. It is possible | 139 // a GC as we are handling raw object references here. It is possible |
| 139 // that the code is called while a GC is in progress, that is ok. | 140 // that the code is called while a GC is in progress, that is ok. |
| 140 NoGCScope no_gc; | 141 NoGCScope no_gc; |
| 141 uword saved_pc = *(reinterpret_cast<uword*>(fp() - kWordSize)); | 142 uword saved_pc = |
| 143 *(reinterpret_cast<uword*>(fp() + EntrypointMarkerOffsetFromFp())); |
| 142 if (saved_pc != 0) { | 144 if (saved_pc != 0) { |
| 143 uword entry_point = | 145 uword entry_point = |
| 144 (saved_pc - AssemblerMacros::kOffsetOfSavedPCfromEntrypoint); | 146 (saved_pc - AssemblerMacros::kOffsetOfSavedPCfromEntrypoint); |
| 145 RawInstructions* instr = Instructions::FromEntryPoint(entry_point); | 147 RawInstructions* instr = Instructions::FromEntryPoint(entry_point); |
| 146 if (instr != Instructions::null()) { | 148 if (instr != Instructions::null()) { |
| 147 return instr->ptr()->code_; | 149 return instr->ptr()->code_; |
| 148 } | 150 } |
| 149 } | 151 } |
| 150 return Code::null(); | 152 return Code::null(); |
| 151 } | 153 } |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 &func); | 339 &func); |
| 338 code_ = func.unoptimized_code(); | 340 code_ = func.unoptimized_code(); |
| 339 function_ = func.raw(); | 341 function_ = func.raw(); |
| 340 return; | 342 return; |
| 341 } | 343 } |
| 342 } | 344 } |
| 343 SetDone(); | 345 SetDone(); |
| 344 } | 346 } |
| 345 | 347 |
| 346 } // namespace dart | 348 } // namespace dart |
| OLD | NEW |