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

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

Issue 171513003: Don't forget to subtract materialization instructions when computing the offset of the frame pointe… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
« no previous file with comments | « runtime/vm/stack_frame.h ('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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 entry_.fp_ = frames_.fp_; 358 entry_.fp_ = frames_.fp_;
359 entry_.pc_ = frames_.pc_; 359 entry_.pc_ = frames_.pc_;
360 SetupNextExitFrameData(); // Setup data for next exit frame in chain. 360 SetupNextExitFrameData(); // Setup data for next exit frame in chain.
361 ASSERT(entry_.IsValid()); 361 ASSERT(entry_.IsValid());
362 return &entry_; 362 return &entry_;
363 } 363 }
364 364
365 365
366 InlinedFunctionsIterator::InlinedFunctionsIterator(const Code& code, uword pc) 366 InlinedFunctionsIterator::InlinedFunctionsIterator(const Code& code, uword pc)
367 : index_(0), 367 : index_(0),
368 num_materializations_(0),
368 code_(Code::Handle(code.raw())), 369 code_(Code::Handle(code.raw())),
369 deopt_info_(DeoptInfo::Handle()), 370 deopt_info_(DeoptInfo::Handle()),
370 function_(Function::Handle()), 371 function_(Function::Handle()),
371 pc_(pc), 372 pc_(pc),
372 deopt_instructions_(), 373 deopt_instructions_(),
373 object_table_(Array::Handle()) { 374 object_table_(Array::Handle()) {
374 ASSERT(code_.is_optimized()); 375 ASSERT(code_.is_optimized());
375 ASSERT(pc_ != 0); 376 ASSERT(pc_ != 0);
376 ASSERT(code.ContainsInstructionAt(pc)); 377 ASSERT(code.ContainsInstructionAt(pc));
377 intptr_t deopt_reason = kDeoptUnknown; 378 intptr_t deopt_reason = kDeoptUnknown;
378 deopt_info_ = code_.GetDeoptInfoAtPc(pc, &deopt_reason); 379 deopt_info_ = code_.GetDeoptInfoAtPc(pc, &deopt_reason);
379 if (deopt_info_.IsNull()) { 380 if (deopt_info_.IsNull()) {
380 // This is the case when a call without deopt info in optimized code 381 // This is the case when a call without deopt info in optimized code
381 // throws an exception. (e.g. in the parameter copying prologue). 382 // throws an exception. (e.g. in the parameter copying prologue).
382 // In that case there won't be any inlined frames. 383 // In that case there won't be any inlined frames.
383 function_ = code_.function(); 384 function_ = code_.function();
384 } else { 385 } else {
385 // Unpack deopt info into instructions (translate away suffixes). 386 // Unpack deopt info into instructions (translate away suffixes).
386 const Array& deopt_table = Array::Handle(code_.deopt_info_array()); 387 const Array& deopt_table = Array::Handle(code_.deopt_info_array());
387 ASSERT(!deopt_table.IsNull()); 388 ASSERT(!deopt_table.IsNull());
389
390 const intptr_t translation_len = deopt_info_.TranslationLength();
388 deopt_info_.ToInstructions(deopt_table, &deopt_instructions_); 391 deopt_info_.ToInstructions(deopt_table, &deopt_instructions_);
392 const intptr_t frame_size = deopt_info_.FrameSize();
393 num_materializations_ = translation_len - frame_size;
Cutch 2014/02/18 23:44:09 Put in an accessor for this.
turnidge 2014/02/19 00:55:54 Done.
389 object_table_ = code_.object_table(); 394 object_table_ = code_.object_table();
390 Advance(); 395 Advance();
391 } 396 }
392 } 397 }
393 398
394 399
395 void InlinedFunctionsIterator::Advance() { 400 void InlinedFunctionsIterator::Advance() {
396 // Iterate over the deopt instructions and determine the inlined 401 // Iterate over the deopt instructions and determine the inlined
397 // functions if any and iterate over them. 402 // functions if any and iterate over them.
398 ASSERT(!Done()); 403 ASSERT(!Done());
(...skipping 20 matching lines...) Expand all
419 424
420 // Finds the potential offset for the current function's FP if the 425 // Finds the potential offset for the current function's FP if the
421 // current frame were to be deoptimized. 426 // current frame were to be deoptimized.
422 intptr_t InlinedFunctionsIterator::GetDeoptFpOffset() const { 427 intptr_t InlinedFunctionsIterator::GetDeoptFpOffset() const {
423 ASSERT(deopt_instructions_.length() != 0); 428 ASSERT(deopt_instructions_.length() != 0);
424 for (intptr_t index = index_; 429 for (intptr_t index = index_;
425 index < deopt_instructions_.length(); 430 index < deopt_instructions_.length();
426 index++) { 431 index++) {
427 DeoptInstr* deopt_instr = deopt_instructions_[index]; 432 DeoptInstr* deopt_instr = deopt_instructions_[index];
428 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { 433 if (deopt_instr->kind() == DeoptInstr::kCallerFp) {
429 return index; 434 return (index - num_materializations_);
430 } 435 }
431 } 436 }
432 UNREACHABLE(); 437 UNREACHABLE();
433 return 0; 438 return 0;
434 } 439 }
435 440
436 441
437 } // namespace dart 442 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/stack_frame.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698