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

Side by Side Diff: src/deoptimizer.cc

Issue 14612012: Cleaned up deopt output a bit. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added grep marker. Created 7 years, 7 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 | « src/deoptimizer.h ('k') | src/ia32/deoptimizer-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 case OSR: 498 case OSR:
499 return FLAG_trace_osr; 499 return FLAG_trace_osr;
500 } 500 }
501 UNREACHABLE(); 501 UNREACHABLE();
502 return false; 502 return false;
503 } 503 }
504 504
505 505
506 const char* Deoptimizer::MessageFor(BailoutType type) { 506 const char* Deoptimizer::MessageFor(BailoutType type) {
507 switch (type) { 507 switch (type) {
508 case EAGER: 508 case EAGER: return "eager";
509 case SOFT: 509 case SOFT: return "soft";
510 case LAZY: 510 case LAZY: return "lazy";
511 return "DEOPT"; 511 case DEBUGGER: return "debugger";
512 case DEBUGGER: 512 case OSR: return "OSR";
513 return "DEOPT FOR DEBUGGER";
514 case OSR:
515 return "OSR";
516 } 513 }
517 UNREACHABLE(); 514 UNREACHABLE();
518 return NULL; 515 return NULL;
519 } 516 }
520 517
521 518
522 Deoptimizer::Deoptimizer(Isolate* isolate, 519 Deoptimizer::Deoptimizer(Isolate* isolate,
523 JSFunction* function, 520 JSFunction* function,
524 BailoutType type, 521 BailoutType type,
525 unsigned bailout_id, 522 unsigned bailout_id,
(...skipping 28 matching lines...) Expand all
554 int opt_count = function->shared()->opt_count(); 551 int opt_count = function->shared()->opt_count();
555 if (opt_count > 0) opt_count--; 552 if (opt_count > 0) opt_count--;
556 function->shared()->set_opt_count(opt_count); 553 function->shared()->set_opt_count(opt_count);
557 } 554 }
558 } 555 }
559 compiled_code_ = FindOptimizedCode(function, optimized_code); 556 compiled_code_ = FindOptimizedCode(function, optimized_code);
560 StackFrame::Type frame_type = function == NULL 557 StackFrame::Type frame_type = function == NULL
561 ? StackFrame::STUB 558 ? StackFrame::STUB
562 : StackFrame::JAVA_SCRIPT; 559 : StackFrame::JAVA_SCRIPT;
563 trace_ = TraceEnabledFor(type, frame_type); 560 trace_ = TraceEnabledFor(type, frame_type);
564 if (trace_) Trace();
565 ASSERT(HEAP->allow_allocation(false)); 561 ASSERT(HEAP->allow_allocation(false));
566 unsigned size = ComputeInputFrameSize(); 562 unsigned size = ComputeInputFrameSize();
567 input_ = new(size) FrameDescription(size, function); 563 input_ = new(size) FrameDescription(size, function);
568 input_->SetFrameType(frame_type); 564 input_->SetFrameType(frame_type);
569 } 565 }
570 566
571 567
572 Code* Deoptimizer::FindOptimizedCode(JSFunction* function, 568 Code* Deoptimizer::FindOptimizedCode(JSFunction* function,
573 Code* optimized_code) { 569 Code* optimized_code) {
574 switch (bailout_type_) { 570 switch (bailout_type_) {
(...skipping 19 matching lines...) Expand all
594 } 590 }
595 case Deoptimizer::DEBUGGER: 591 case Deoptimizer::DEBUGGER:
596 ASSERT(optimized_code->contains(from_)); 592 ASSERT(optimized_code->contains(from_));
597 return optimized_code; 593 return optimized_code;
598 } 594 }
599 UNREACHABLE(); 595 UNREACHABLE();
600 return NULL; 596 return NULL;
601 } 597 }
602 598
603 599
604 void Deoptimizer::Trace() {
605 PrintF("**** %s: ", Deoptimizer::MessageFor(bailout_type_));
606 PrintFunctionName();
607 PrintF(" at id #%u, address 0x%" V8PRIxPTR ", frame size %d\n",
608 bailout_id_,
609 reinterpret_cast<intptr_t>(from_),
610 fp_to_sp_delta_ - (2 * kPointerSize));
611 if (bailout_type_ == EAGER || bailout_type_ == SOFT) {
612 compiled_code_->PrintDeoptLocation(bailout_id_);
613 }
614 }
615
616
617 void Deoptimizer::PrintFunctionName() { 600 void Deoptimizer::PrintFunctionName() {
618 if (function_->IsJSFunction()) { 601 if (function_->IsJSFunction()) {
619 function_->PrintName(); 602 function_->PrintName();
620 } else { 603 } else {
621 PrintF("%s", Code::Kind2String(compiled_code_->kind())); 604 PrintF("%s", Code::Kind2String(compiled_code_->kind()));
622 } 605 }
623 } 606 }
624 607
625 608
626 Deoptimizer::~Deoptimizer() { 609 Deoptimizer::~Deoptimizer() {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 // without having a real stack frame in place. 699 // without having a real stack frame in place.
717 void Deoptimizer::DoComputeOutputFrames() { 700 void Deoptimizer::DoComputeOutputFrames() {
718 if (bailout_type_ == OSR) { 701 if (bailout_type_ == OSR) {
719 DoComputeOsrOutputFrame(); 702 DoComputeOsrOutputFrame();
720 return; 703 return;
721 } 704 }
722 705
723 // Print some helpful diagnostic information. 706 // Print some helpful diagnostic information.
724 int64_t start = OS::Ticks(); 707 int64_t start = OS::Ticks();
725 if (trace_) { 708 if (trace_) {
726 PrintF("[deoptimizing%s: begin 0x%08" V8PRIxPTR " ", 709 PrintF("[deoptimizing (DEOPT %s): begin 0x%08" V8PRIxPTR " ",
727 (bailout_type_ == LAZY ? " (lazy)" : ""), 710 MessageFor(bailout_type_),
728 reinterpret_cast<intptr_t>(function_)); 711 reinterpret_cast<intptr_t>(function_));
729 PrintFunctionName(); 712 PrintFunctionName();
730 PrintF(" @%d]\n", bailout_id_); 713 PrintF(" @%d, FP to SP delta: %d]\n", bailout_id_, fp_to_sp_delta_);
714 if (bailout_type_ == EAGER || bailout_type_ == SOFT) {
715 compiled_code_->PrintDeoptLocation(bailout_id_);
716 }
731 } 717 }
732 718
733 // Determine basic deoptimization information. The optimized frame is 719 // Determine basic deoptimization information. The optimized frame is
734 // described by the input data. 720 // described by the input data.
735 DeoptimizationInputData* input_data = 721 DeoptimizationInputData* input_data =
736 DeoptimizationInputData::cast(compiled_code_->deoptimization_data()); 722 DeoptimizationInputData::cast(compiled_code_->deoptimization_data());
737 BailoutId node_id = input_data->AstId(bailout_id_); 723 BailoutId node_id = input_data->AstId(bailout_id_);
738 ByteArray* translations = input_data->TranslationByteArray(); 724 ByteArray* translations = input_data->TranslationByteArray();
739 unsigned translation_index = 725 unsigned translation_index =
740 input_data->TranslationIndex(bailout_id_)->value(); 726 input_data->TranslationIndex(bailout_id_)->value();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 UNREACHABLE(); 783 UNREACHABLE();
798 break; 784 break;
799 } 785 }
800 } 786 }
801 787
802 // Print some helpful diagnostic information. 788 // Print some helpful diagnostic information.
803 if (trace_) { 789 if (trace_) {
804 double ms = static_cast<double>(OS::Ticks() - start) / 1000; 790 double ms = static_cast<double>(OS::Ticks() - start) / 1000;
805 int index = output_count_ - 1; // Index of the topmost frame. 791 int index = output_count_ - 1; // Index of the topmost frame.
806 JSFunction* function = output_[index]->GetFunction(); 792 JSFunction* function = output_[index]->GetFunction();
807 PrintF("[deoptimizing: end 0x%08" V8PRIxPTR " ", 793 PrintF("[deoptimizing (%s): end 0x%08" V8PRIxPTR " ",
794 MessageFor(bailout_type_),
808 reinterpret_cast<intptr_t>(function)); 795 reinterpret_cast<intptr_t>(function));
809 if (function != NULL) function->PrintName(); 796 PrintFunctionName();
810 PrintF(" => node=%d, pc=0x%08" V8PRIxPTR ", state=%s, alignment=%s," 797 PrintF(" @%d => node=%d, pc=0x%08" V8PRIxPTR ", state=%s, alignment=%s,"
811 " took %0.3f ms]\n", 798 " took %0.3f ms]\n",
799 bailout_id_,
812 node_id.ToInt(), 800 node_id.ToInt(),
813 output_[index]->GetPc(), 801 output_[index]->GetPc(),
814 FullCodeGenerator::State2String( 802 FullCodeGenerator::State2String(
815 static_cast<FullCodeGenerator::State>( 803 static_cast<FullCodeGenerator::State>(
816 output_[index]->GetState()->value())), 804 output_[index]->GetState()->value())),
817 has_alignment_padding_ ? "with padding" : "no padding", 805 has_alignment_padding_ ? "with padding" : "no padding",
818 ms); 806 ms);
819 } 807 }
820 } 808 }
821 809
(...skipping 1953 matching lines...) Expand 10 before | Expand all | Expand 10 after
2775 2763
2776 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 2764 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
2777 v->VisitPointer(BitCast<Object**>(&function_)); 2765 v->VisitPointer(BitCast<Object**>(&function_));
2778 v->VisitPointers(parameters_, parameters_ + parameters_count_); 2766 v->VisitPointers(parameters_, parameters_ + parameters_count_);
2779 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 2767 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
2780 } 2768 }
2781 2769
2782 #endif // ENABLE_DEBUGGER_SUPPORT 2770 #endif // ENABLE_DEBUGGER_SUPPORT
2783 2771
2784 } } // namespace v8::internal 2772 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/deoptimizer.h ('k') | src/ia32/deoptimizer-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698