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

Side by Side Diff: src/deoptimizer.cc

Issue 984773003: CpuProfiler: fix for GetDeoptReason code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: comments addressed Created 5 years, 9 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
« no previous file with comments | « src/deoptimizer.h ('k') | src/log.h » ('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 // 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/cpu-profiler.h" 9 #include "src/cpu-profiler.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 StackFrame::Type frame_type = function == NULL 603 StackFrame::Type frame_type = function == NULL
604 ? StackFrame::STUB 604 ? StackFrame::STUB
605 : StackFrame::JAVA_SCRIPT; 605 : StackFrame::JAVA_SCRIPT;
606 trace_scope_ = TraceEnabledFor(type, frame_type) ? 606 trace_scope_ = TraceEnabledFor(type, frame_type) ?
607 new CodeTracer::Scope(isolate->GetCodeTracer()) : NULL; 607 new CodeTracer::Scope(isolate->GetCodeTracer()) : NULL;
608 #ifdef DEBUG 608 #ifdef DEBUG
609 CHECK(AllowHeapAllocation::IsAllowed()); 609 CHECK(AllowHeapAllocation::IsAllowed());
610 disallow_heap_allocation_ = new DisallowHeapAllocation(); 610 disallow_heap_allocation_ = new DisallowHeapAllocation();
611 #endif // DEBUG 611 #endif // DEBUG
612 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) { 612 if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) {
613 PROFILE(isolate_, CodeDeoptEvent(compiled_code_, bailout_id_, from_, 613 PROFILE(isolate_, CodeDeoptEvent(compiled_code_, from_, fp_to_sp_delta_));
614 fp_to_sp_delta_));
615 } 614 }
616 unsigned size = ComputeInputFrameSize(); 615 unsigned size = ComputeInputFrameSize();
617 input_ = new(size) FrameDescription(size, function); 616 input_ = new(size) FrameDescription(size, function);
618 input_->SetFrameType(frame_type); 617 input_->SetFrameType(frame_type);
619 } 618 }
620 619
621 620
622 Code* Deoptimizer::FindOptimizedCode(JSFunction* function, 621 Code* Deoptimizer::FindOptimizedCode(JSFunction* function,
623 Code* optimized_code) { 622 Code* optimized_code) {
624 switch (bailout_type_) { 623 switch (bailout_type_) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 PrintF(trace_scope_->file(), "[deoptimizing (DEOPT %s): begin ", 762 PrintF(trace_scope_->file(), "[deoptimizing (DEOPT %s): begin ",
764 MessageFor(bailout_type_)); 763 MessageFor(bailout_type_));
765 PrintFunctionName(); 764 PrintFunctionName();
766 PrintF(trace_scope_->file(), 765 PrintF(trace_scope_->file(),
767 " (opt #%d) @%d, FP to SP delta: %d]\n", 766 " (opt #%d) @%d, FP to SP delta: %d]\n",
768 input_data->OptimizationId()->value(), 767 input_data->OptimizationId()->value(),
769 bailout_id_, 768 bailout_id_,
770 fp_to_sp_delta_); 769 fp_to_sp_delta_);
771 if (bailout_type_ == EAGER || bailout_type_ == SOFT || 770 if (bailout_type_ == EAGER || bailout_type_ == SOFT ||
772 (compiled_code_->is_hydrogen_stub())) { 771 (compiled_code_->is_hydrogen_stub())) {
773 compiled_code_->PrintDeoptLocation(trace_scope_->file(), bailout_id_); 772 compiled_code_->PrintDeoptLocation(trace_scope_->file(), from_);
774 } 773 }
775 } 774 }
776 775
777 BailoutId node_id = input_data->AstId(bailout_id_); 776 BailoutId node_id = input_data->AstId(bailout_id_);
778 ByteArray* translations = input_data->TranslationByteArray(); 777 ByteArray* translations = input_data->TranslationByteArray();
779 unsigned translation_index = 778 unsigned translation_index =
780 input_data->TranslationIndex(bailout_id_)->value(); 779 input_data->TranslationIndex(bailout_id_)->value();
781 780
782 // Do the input frame to output frame(s) translation. 781 // Do the input frame to output frame(s) translation.
783 TranslationIterator iterator(translations, translation_index); 782 TranslationIterator iterator(translations, translation_index);
(...skipping 2858 matching lines...) Expand 10 before | Expand all | Expand 10 after
3642 const char* Deoptimizer::GetDeoptReason(DeoptReason deopt_reason) { 3641 const char* Deoptimizer::GetDeoptReason(DeoptReason deopt_reason) {
3643 DCHECK(deopt_reason < kLastDeoptReason); 3642 DCHECK(deopt_reason < kLastDeoptReason);
3644 #define DEOPT_MESSAGES_TEXTS(C, T) T, 3643 #define DEOPT_MESSAGES_TEXTS(C, T) T,
3645 static const char* deopt_messages_[] = { 3644 static const char* deopt_messages_[] = {
3646 DEOPT_MESSAGES_LIST(DEOPT_MESSAGES_TEXTS)}; 3645 DEOPT_MESSAGES_LIST(DEOPT_MESSAGES_TEXTS)};
3647 #undef DEOPT_MESSAGES_TEXTS 3646 #undef DEOPT_MESSAGES_TEXTS
3648 return deopt_messages_[deopt_reason]; 3647 return deopt_messages_[deopt_reason];
3649 } 3648 }
3650 3649
3651 3650
3652 Deoptimizer::DeoptInfo Deoptimizer::GetDeoptInfo(Code* code, int bailout_id) { 3651 Deoptimizer::DeoptInfo Deoptimizer::GetDeoptInfo(Code* code, Address pc) {
3653 SourcePosition last_position = SourcePosition::Unknown(); 3652 SourcePosition last_position = SourcePosition::Unknown();
3654 Isolate* isolate = code->GetIsolate();
3655 Deoptimizer::DeoptReason last_reason = Deoptimizer::kNoReason; 3653 Deoptimizer::DeoptReason last_reason = Deoptimizer::kNoReason;
3656 int mask = RelocInfo::ModeMask(RelocInfo::DEOPT_REASON) | 3654 int mask = RelocInfo::ModeMask(RelocInfo::DEOPT_REASON) |
3657 RelocInfo::ModeMask(RelocInfo::POSITION) | 3655 RelocInfo::ModeMask(RelocInfo::POSITION);
3658 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY);
3659 for (RelocIterator it(code, mask); !it.done(); it.next()) { 3656 for (RelocIterator it(code, mask); !it.done(); it.next()) {
3660 RelocInfo* info = it.rinfo(); 3657 RelocInfo* info = it.rinfo();
3658 if (info->pc() >= pc) return DeoptInfo(last_position, NULL, last_reason);
3661 if (info->rmode() == RelocInfo::POSITION) { 3659 if (info->rmode() == RelocInfo::POSITION) {
3662 int raw_position = static_cast<int>(info->data()); 3660 int raw_position = static_cast<int>(info->data());
3663 last_position = raw_position ? SourcePosition::FromRaw(raw_position) 3661 last_position = raw_position ? SourcePosition::FromRaw(raw_position)
3664 : SourcePosition::Unknown(); 3662 : SourcePosition::Unknown();
3665 } else if (info->rmode() == RelocInfo::DEOPT_REASON) { 3663 } else if (info->rmode() == RelocInfo::DEOPT_REASON) {
3666 last_reason = static_cast<Deoptimizer::DeoptReason>(info->data()); 3664 last_reason = static_cast<Deoptimizer::DeoptReason>(info->data());
3667 } else if (last_reason != Deoptimizer::kNoReason) {
3668 if ((bailout_id ==
3669 Deoptimizer::GetDeoptimizationId(isolate, info->target_address(),
3670 Deoptimizer::EAGER)) ||
3671 (bailout_id ==
3672 Deoptimizer::GetDeoptimizationId(isolate, info->target_address(),
3673 Deoptimizer::SOFT)) ||
3674 (bailout_id ==
3675 Deoptimizer::GetDeoptimizationId(isolate, info->target_address(),
3676 Deoptimizer::LAZY))) {
3677 CHECK(RelocInfo::IsRuntimeEntry(info->rmode()));
3678 return DeoptInfo(last_position, NULL, last_reason);
3679 }
3680 } 3665 }
3681 } 3666 }
3682 return DeoptInfo(SourcePosition::Unknown(), NULL, Deoptimizer::kNoReason); 3667 return DeoptInfo(SourcePosition::Unknown(), NULL, Deoptimizer::kNoReason);
3683 } 3668 }
3684 } } // namespace v8::internal 3669 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/deoptimizer.h ('k') | src/log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698