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

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

Issue 12049039: Fix source position for stack traces with optimized top function. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: avoid default arguments by using pending_deoptimization_env_ Created 7 years, 10 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
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_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"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 ASSERT(entry_.IsValid()); 278 ASSERT(entry_.IsValid());
279 return &entry_; 279 return &entry_;
280 } 280 }
281 281
282 282
283 InlinedFunctionsInDartFrameIterator::InlinedFunctionsInDartFrameIterator( 283 InlinedFunctionsInDartFrameIterator::InlinedFunctionsInDartFrameIterator(
284 StackFrame* frame) : index_(0), 284 StackFrame* frame) : index_(0),
285 frame_(frame), 285 frame_(frame),
286 func_(Function::Handle()), 286 func_(Function::Handle()),
287 deopt_info_(DeoptInfo::Handle()), 287 deopt_info_(DeoptInfo::Handle()),
288 deopt_instructions_(),
288 object_table_(Array::Handle()) { 289 object_table_(Array::Handle()) {
289 ASSERT(frame_ != NULL); 290 ASSERT(frame_ != NULL);
290 const Code& code = Code::Handle(frame_->LookupDartCode()); 291 const Code& code = Code::Handle(frame_->LookupDartCode());
291 ASSERT(code.is_optimized()); 292 ASSERT(code.is_optimized());
292 func_ = code.function(); 293 func_ = code.function();
293 intptr_t deopt_reason = kDeoptUnknown; 294 intptr_t deopt_reason = kDeoptUnknown;
294 deopt_info_ = code.GetDeoptInfoAtPc(frame_->pc(), &deopt_reason); 295 deopt_info_ = code.GetDeoptInfoAtPc(frame_->pc(), &deopt_reason);
296
297 // Unpack deopt info into instructions (translate away suffixes).
298 const Array& deopt_table = Array::Handle(code.deopt_info_array());
299 ASSERT(!deopt_table.IsNull());
300 deopt_info_.ToInstructions(deopt_table, &deopt_instructions_);
siva 2013/01/28 22:46:55 Is this some kind of code hoisting optimization yo
Florian Schneider 2013/01/29 12:19:07 No, this is not for optimization purposes: The raw
301
295 object_table_ = code.object_table(); 302 object_table_ = code.object_table();
296 } 303 }
297 304
298 305
299 RawFunction* InlinedFunctionsInDartFrameIterator::GetNextFunction(uword* pc) { 306 RawFunction* InlinedFunctionsInDartFrameIterator::GetNextFunction(uword* pc,
307 Code* code) {
siva 2013/01/28 22:46:55 I try and avoid functions which have two return va
Florian Schneider 2013/01/29 12:19:07 I agree. I'll get rid of one output parameter and
300 if (index_ == -1) { 308 if (index_ == -1) {
301 return Function::null(); 309 return Function::null();
302 } 310 }
303 if (deopt_info_.IsNull()) { 311 if (deopt_info_.IsNull()) {
304 // We are at a PC that has no deoptimization info so there are no 312 // We are at a PC that has no deoptimization info so there are no
305 // inlined functions to iterate over, we return the function. 313 // inlined functions to iterate over, we return the function.
306 index_ = -1; // No more functions. 314 index_ = -1; // No more functions.
307 *pc = frame_->pc(); 315 *pc = frame_->pc();
316 *code = func_.CurrentCode();
308 return func_.raw(); 317 return func_.raw();
309 } 318 }
310 // Iterate over the deopt instructions and determine the inlined 319 // Iterate over the deopt instructions and determine the inlined
311 // functions if any and iterate over them. 320 // functions if any and iterate over them.
312 ASSERT(deopt_info_.Length() != 0); 321 ASSERT(deopt_instructions_.length() != 0);
313 while (index_ < deopt_info_.Length()) { 322 while (index_ < deopt_instructions_.length()) {
314 intptr_t cur_index = index_; 323 intptr_t cur_index = index_;
315 index_ += 1; 324 index_ += 1;
316 intptr_t deopt_instr = deopt_info_.Instruction(cur_index); 325 DeoptInstr* deopt_instr = deopt_instructions_[cur_index];
317 ASSERT(deopt_instr != DeoptInstr::kRetBeforeAddress); 326 ASSERT(deopt_instr->kind() != DeoptInstr::kRetBeforeAddress);
318 if (deopt_instr == DeoptInstr::kRetAfterAddress) { 327 if (deopt_instr->kind() == DeoptInstr::kRetAfterAddress) {
319 intptr_t deopt_from_index = deopt_info_.FromIndex(cur_index); 328 *pc = DeoptInstr::GetRetAfterAddress(deopt_instr,
320 *pc = DeoptInstr::GetRetAfterAddress(deopt_from_index,
321 object_table_, 329 object_table_,
322 &func_); 330 &func_);
331 *code = func_.unoptimized_code();
323 return func_.raw(); 332 return func_.raw();
324 } 333 }
325 } 334 }
326 index_ = -1; 335 index_ = -1;
327 return Function::null(); 336 return Function::null();
328 } 337 }
329 338
330 } // namespace dart 339 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698