Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(715)

Side by Side Diff: runtime/vm/stack_frame.cc

Issue 396213005: Fix PcDescriptor iteratot to never return a pointer to a memory location since the data can move wi… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/simulator_arm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (handlers.Length() == 0) { 219 if (handlers.Length() == 0) {
220 return false; 220 return false;
221 } 221 }
222 222
223 // Find pc descriptor for the current pc. 223 // Find pc descriptor for the current pc.
224 REUSABLE_PC_DESCRIPTORS_HANDLESCOPE(isolate); 224 REUSABLE_PC_DESCRIPTORS_HANDLESCOPE(isolate);
225 PcDescriptors& descriptors = reused_pc_descriptors_handle.Handle(); 225 PcDescriptors& descriptors = reused_pc_descriptors_handle.Handle();
226 descriptors = code.pc_descriptors(); 226 descriptors = code.pc_descriptors();
227 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind); 227 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind);
228 while (iter.HasNext()) { 228 while (iter.HasNext()) {
229 const RawPcDescriptors::PcDescriptorRec& rec = iter.Next(); 229 RawPcDescriptors::PcDescriptorRec rec;
230 iter.NextRec(&rec);
230 if ((rec.pc() == pc()) && (rec.try_index() != -1)) { 231 if ((rec.pc() == pc()) && (rec.try_index() != -1)) {
231 RawExceptionHandlers::HandlerInfo handler_info; 232 RawExceptionHandlers::HandlerInfo handler_info;
232 handlers.GetHandlerInfo(rec.try_index(), &handler_info); 233 handlers.GetHandlerInfo(rec.try_index(), &handler_info);
233 *handler_pc = handler_info.handler_pc; 234 *handler_pc = handler_info.handler_pc;
234 *needs_stacktrace = handler_info.needs_stacktrace; 235 *needs_stacktrace = handler_info.needs_stacktrace;
235 *has_catch_all = handler_info.has_catch_all; 236 *has_catch_all = handler_info.has_catch_all;
236 return true; 237 return true;
237 } 238 }
238 } 239 }
239 return false; 240 return false;
240 } 241 }
241 242
242 243
243 intptr_t StackFrame::GetTokenPos() const { 244 intptr_t StackFrame::GetTokenPos() const {
244 const Code& code = Code::Handle(LookupDartCode()); 245 const Code& code = Code::Handle(LookupDartCode());
245 if (code.IsNull()) { 246 if (code.IsNull()) {
246 return -1; // Stub frames do not have token_pos. 247 return -1; // Stub frames do not have token_pos.
247 } 248 }
248 const PcDescriptors& descriptors = 249 const PcDescriptors& descriptors =
249 PcDescriptors::Handle(code.pc_descriptors()); 250 PcDescriptors::Handle(code.pc_descriptors());
250 ASSERT(!descriptors.IsNull()); 251 ASSERT(!descriptors.IsNull());
251 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind); 252 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind);
252 while (iter.HasNext()) { 253 while (iter.HasNext()) {
253 const RawPcDescriptors::PcDescriptorRec& rec = iter.Next(); 254 RawPcDescriptors::PcDescriptorRec rec;
255 iter.NextRec(&rec);
254 if (rec.pc() == pc()) { 256 if (rec.pc() == pc()) {
255 return rec.token_pos(); 257 return rec.token_pos();
256 } 258 }
257 } 259 }
258 return -1; 260 return -1;
259 } 261 }
260 262
261 263
262 264
263 bool StackFrame::IsValid() const { 265 bool StackFrame::IsValid() const {
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { 485 if (deopt_instr->kind() == DeoptInstr::kCallerFp) {
484 return (index - num_materializations_); 486 return (index - num_materializations_);
485 } 487 }
486 } 488 }
487 UNREACHABLE(); 489 UNREACHABLE();
488 return 0; 490 return 0;
489 } 491 }
490 492
491 493
492 } // namespace dart 494 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/simulator_arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698