| 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/isolate.h" | 8 #include "vm/isolate.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 if (handlers.TryIndex(j) == try_index) { | 171 if (handlers.TryIndex(j) == try_index) { |
| 172 *handler_pc = handlers.HandlerPC(j); | 172 *handler_pc = handlers.HandlerPC(j); |
| 173 return true; | 173 return true; |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 return false; | 177 return false; |
| 178 } | 178 } |
| 179 | 179 |
| 180 | 180 |
| 181 intptr_t StackFrame::GetTokenPos() const { |
| 182 const Code& code = Code::Handle(LookupDartCode()); |
| 183 if (code.IsNull()) { |
| 184 return -1; // Stub frames do not have token_pos. |
| 185 } |
| 186 const PcDescriptors& descriptors = |
| 187 PcDescriptors::Handle(code.pc_descriptors()); |
| 188 ASSERT(!descriptors.IsNull()); |
| 189 for (int i = 0; i < descriptors.Length(); i++) { |
| 190 if (static_cast<uword>(descriptors.PC(i)) == pc()) { |
| 191 return descriptors.TokenPos(i); |
| 192 } |
| 193 } |
| 194 return -1; |
| 195 } |
| 196 |
| 197 |
| 198 |
| 181 bool StackFrame::IsValid() const { | 199 bool StackFrame::IsValid() const { |
| 182 if (IsEntryFrame() || IsExitFrame() || IsStubFrame()) { | 200 if (IsEntryFrame() || IsExitFrame() || IsStubFrame()) { |
| 183 return true; | 201 return true; |
| 184 } | 202 } |
| 185 return (LookupDartCode() != Code::null()); | 203 return (LookupDartCode() != Code::null()); |
| 186 } | 204 } |
| 187 | 205 |
| 188 | 206 |
| 189 StackFrameIterator::StackFrameIterator(bool validate) | 207 StackFrameIterator::StackFrameIterator(bool validate) |
| 190 : validate_(validate), entry_(), exit_(), current_frame_(NULL) { | 208 : validate_(validate), entry_(), exit_(), current_frame_(NULL) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 EntryFrame* StackFrameIterator::NextEntryFrame() { | 282 EntryFrame* StackFrameIterator::NextEntryFrame() { |
| 265 ASSERT(!frames_.HasNext()); | 283 ASSERT(!frames_.HasNext()); |
| 266 entry_.sp_ = frames_.sp_; | 284 entry_.sp_ = frames_.sp_; |
| 267 entry_.fp_ = frames_.fp_; | 285 entry_.fp_ = frames_.fp_; |
| 268 SetupNextExitFrameData(); // Setup data for next exit frame in chain. | 286 SetupNextExitFrameData(); // Setup data for next exit frame in chain. |
| 269 ASSERT(entry_.IsValid()); | 287 ASSERT(entry_.IsValid()); |
| 270 return &entry_; | 288 return &entry_; |
| 271 } | 289 } |
| 272 | 290 |
| 273 } // namespace dart | 291 } // namespace dart |
| OLD | NEW |