OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/disasm.h" | 10 #include "src/disasm.h" |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 DCHECK(optimized_code->contains(from_)); | 630 DCHECK(optimized_code->contains(from_)); |
631 return optimized_code; | 631 return optimized_code; |
632 } | 632 } |
633 FATAL("Could not find code for optimized function"); | 633 FATAL("Could not find code for optimized function"); |
634 return NULL; | 634 return NULL; |
635 } | 635 } |
636 | 636 |
637 | 637 |
638 void Deoptimizer::PrintFunctionName() { | 638 void Deoptimizer::PrintFunctionName() { |
639 if (function_->IsJSFunction()) { | 639 if (function_->IsJSFunction()) { |
640 function_->PrintName(trace_scope_->file()); | 640 function_->ShortPrint(trace_scope_->file()); |
641 } else { | 641 } else { |
642 PrintF(trace_scope_->file(), | 642 PrintF(trace_scope_->file(), |
643 "%s", Code::Kind2String(compiled_code_->kind())); | 643 "%s", Code::Kind2String(compiled_code_->kind())); |
644 } | 644 } |
645 } | 645 } |
646 | 646 |
647 | 647 |
648 Deoptimizer::~Deoptimizer() { | 648 Deoptimizer::~Deoptimizer() { |
649 DCHECK(input_ == NULL && output_ == NULL); | 649 DCHECK(input_ == NULL && output_ == NULL); |
650 DCHECK(disallow_heap_allocation_ == NULL); | 650 DCHECK(disallow_heap_allocation_ == NULL); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 base::ElapsedTimer timer; | 755 base::ElapsedTimer timer; |
756 | 756 |
757 // Determine basic deoptimization information. The optimized frame is | 757 // Determine basic deoptimization information. The optimized frame is |
758 // described by the input data. | 758 // described by the input data. |
759 DeoptimizationInputData* input_data = | 759 DeoptimizationInputData* input_data = |
760 DeoptimizationInputData::cast(compiled_code_->deoptimization_data()); | 760 DeoptimizationInputData::cast(compiled_code_->deoptimization_data()); |
761 | 761 |
762 if (trace_scope_ != NULL) { | 762 if (trace_scope_ != NULL) { |
763 timer.Start(); | 763 timer.Start(); |
764 PrintF(trace_scope_->file(), | 764 PrintF(trace_scope_->file(), |
765 "[deoptimizing (DEOPT %s): begin 0x%08" V8PRIxPTR " ", | 765 "[deoptimizing (DEOPT %s): begin ", |
766 MessageFor(bailout_type_), | 766 MessageFor(bailout_type_)); |
767 reinterpret_cast<intptr_t>(function_)); | |
768 PrintFunctionName(); | 767 PrintFunctionName(); |
769 PrintF(trace_scope_->file(), | 768 PrintF(trace_scope_->file(), |
770 " (opt #%d) @%d, FP to SP delta: %d]\n", | 769 " (opt #%d) @%d, FP to SP delta: %d]\n", |
771 input_data->OptimizationId()->value(), | 770 input_data->OptimizationId()->value(), |
772 bailout_id_, | 771 bailout_id_, |
773 fp_to_sp_delta_); | 772 fp_to_sp_delta_); |
774 if (bailout_type_ == EAGER || bailout_type_ == SOFT || | 773 if (bailout_type_ == EAGER || bailout_type_ == SOFT || |
775 (compiled_code_->is_hydrogen_stub())) { | 774 (compiled_code_->is_hydrogen_stub())) { |
776 compiled_code_->PrintDeoptLocation(trace_scope_->file(), bailout_id_); | 775 compiled_code_->PrintDeoptLocation(trace_scope_->file(), bailout_id_); |
777 } | 776 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 default: | 842 default: |
844 FATAL("Unsupported translation"); | 843 FATAL("Unsupported translation"); |
845 break; | 844 break; |
846 } | 845 } |
847 } | 846 } |
848 | 847 |
849 // Print some helpful diagnostic information. | 848 // Print some helpful diagnostic information. |
850 if (trace_scope_ != NULL) { | 849 if (trace_scope_ != NULL) { |
851 double ms = timer.Elapsed().InMillisecondsF(); | 850 double ms = timer.Elapsed().InMillisecondsF(); |
852 int index = output_count_ - 1; // Index of the topmost frame. | 851 int index = output_count_ - 1; // Index of the topmost frame. |
853 JSFunction* function = output_[index]->GetFunction(); | |
854 PrintF(trace_scope_->file(), | 852 PrintF(trace_scope_->file(), |
855 "[deoptimizing (%s): end 0x%08" V8PRIxPTR " ", | 853 "[deoptimizing (%s): end ", |
856 MessageFor(bailout_type_), | 854 MessageFor(bailout_type_)); |
857 reinterpret_cast<intptr_t>(function)); | |
858 PrintFunctionName(); | 855 PrintFunctionName(); |
859 PrintF(trace_scope_->file(), | 856 PrintF(trace_scope_->file(), |
860 " @%d => node=%d, pc=0x%08" V8PRIxPTR ", state=%s, alignment=%s," | 857 " @%d => node=%d, pc=0x%08" V8PRIxPTR ", state=%s, alignment=%s," |
861 " took %0.3f ms]\n", | 858 " took %0.3f ms]\n", |
862 bailout_id_, | 859 bailout_id_, |
863 node_id.ToInt(), | 860 node_id.ToInt(), |
864 output_[index]->GetPc(), | 861 output_[index]->GetPc(), |
865 FullCodeGenerator::State2String( | 862 FullCodeGenerator::State2String( |
866 static_cast<FullCodeGenerator::State>( | 863 static_cast<FullCodeGenerator::State>( |
867 output_[index]->GetState()->value())), | 864 output_[index]->GetState()->value())), |
(...skipping 2759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3627 | 3624 |
3628 | 3625 |
3629 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 3626 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
3630 v->VisitPointer(bit_cast<Object**>(&function_)); | 3627 v->VisitPointer(bit_cast<Object**>(&function_)); |
3631 v->VisitPointer(&context_); | 3628 v->VisitPointer(&context_); |
3632 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 3629 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
3633 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 3630 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
3634 } | 3631 } |
3635 | 3632 |
3636 } } // namespace v8::internal | 3633 } } // namespace v8::internal |
OLD | NEW |