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

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: win platform was fixed 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
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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 PrintF(trace_scope_->file(), "[deoptimizing (DEOPT %s): begin ", 763 PrintF(trace_scope_->file(), "[deoptimizing (DEOPT %s): begin ",
764 MessageFor(bailout_type_)); 764 MessageFor(bailout_type_));
765 PrintFunctionName(); 765 PrintFunctionName();
766 PrintF(trace_scope_->file(), 766 PrintF(trace_scope_->file(),
767 " (opt #%d) @%d, FP to SP delta: %d]\n", 767 " (opt #%d) @%d, FP to SP delta: %d]\n",
768 input_data->OptimizationId()->value(), 768 input_data->OptimizationId()->value(),
769 bailout_id_, 769 bailout_id_,
770 fp_to_sp_delta_); 770 fp_to_sp_delta_);
771 if (bailout_type_ == EAGER || bailout_type_ == SOFT || 771 if (bailout_type_ == EAGER || bailout_type_ == SOFT ||
772 (compiled_code_->is_hydrogen_stub())) { 772 (compiled_code_->is_hydrogen_stub())) {
773 compiled_code_->PrintDeoptLocation(trace_scope_->file(), bailout_id_); 773 compiled_code_->PrintDeoptLocation(trace_scope_->file(), from_);
774 } 774 }
775 } 775 }
776 776
777 BailoutId node_id = input_data->AstId(bailout_id_); 777 BailoutId node_id = input_data->AstId(bailout_id_);
778 ByteArray* translations = input_data->TranslationByteArray(); 778 ByteArray* translations = input_data->TranslationByteArray();
779 unsigned translation_index = 779 unsigned translation_index =
780 input_data->TranslationIndex(bailout_id_)->value(); 780 input_data->TranslationIndex(bailout_id_)->value();
781 781
782 // Do the input frame to output frame(s) translation. 782 // Do the input frame to output frame(s) translation.
783 TranslationIterator iterator(translations, translation_index); 783 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) { 3642 const char* Deoptimizer::GetDeoptReason(DeoptReason deopt_reason) {
3643 DCHECK(deopt_reason < kLastDeoptReason); 3643 DCHECK(deopt_reason < kLastDeoptReason);
3644 #define DEOPT_MESSAGES_TEXTS(C, T) T, 3644 #define DEOPT_MESSAGES_TEXTS(C, T) T,
3645 static const char* deopt_messages_[] = { 3645 static const char* deopt_messages_[] = {
3646 DEOPT_MESSAGES_LIST(DEOPT_MESSAGES_TEXTS)}; 3646 DEOPT_MESSAGES_LIST(DEOPT_MESSAGES_TEXTS)};
3647 #undef DEOPT_MESSAGES_TEXTS 3647 #undef DEOPT_MESSAGES_TEXTS
3648 return deopt_messages_[deopt_reason]; 3648 return deopt_messages_[deopt_reason];
3649 } 3649 }
3650 3650
3651 3651
3652 Deoptimizer::DeoptInfo Deoptimizer::GetDeoptInfo(Code* code, int bailout_id) { 3652 Deoptimizer::DeoptInfo Deoptimizer::GetDeoptInfo(Code* code, Address pc) {
3653 SourcePosition last_position = SourcePosition::Unknown(); 3653 SourcePosition last_position = SourcePosition::Unknown();
3654 Isolate* isolate = code->GetIsolate();
3655 Deoptimizer::DeoptReason last_reason = Deoptimizer::kNoReason; 3654 Deoptimizer::DeoptReason last_reason = Deoptimizer::kNoReason;
3656 int mask = RelocInfo::ModeMask(RelocInfo::DEOPT_REASON) | 3655 int mask = RelocInfo::ModeMask(RelocInfo::DEOPT_REASON) |
3657 RelocInfo::ModeMask(RelocInfo::POSITION) | 3656 RelocInfo::ModeMask(RelocInfo::POSITION);
3658 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY);
3659 for (RelocIterator it(code, mask); !it.done(); it.next()) { 3657 for (RelocIterator it(code, mask); !it.done(); it.next()) {
3660 RelocInfo* info = it.rinfo(); 3658 RelocInfo* info = it.rinfo();
3659 if (info->pc() >= pc) return DeoptInfo(last_position, NULL, last_reason);
3661 if (info->rmode() == RelocInfo::POSITION) { 3660 if (info->rmode() == RelocInfo::POSITION) {
3662 int raw_position = static_cast<int>(info->data()); 3661 int raw_position = static_cast<int>(info->data());
3663 last_position = raw_position ? SourcePosition::FromRaw(raw_position) 3662 last_position = raw_position ? SourcePosition::FromRaw(raw_position)
3664 : SourcePosition::Unknown(); 3663 : SourcePosition::Unknown();
3665 } else if (info->rmode() == RelocInfo::DEOPT_REASON) { 3664 } else if (info->rmode() == RelocInfo::DEOPT_REASON) {
3666 last_reason = static_cast<Deoptimizer::DeoptReason>(info->data()); 3665 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 } 3666 }
3681 } 3667 }
3682 return DeoptInfo(SourcePosition::Unknown(), NULL, Deoptimizer::kNoReason); 3668 return DeoptInfo(SourcePosition::Unknown(), NULL, Deoptimizer::kNoReason);
3683 } 3669 }
3684 } } // namespace v8::internal 3670 } } // namespace v8::internal
OLDNEW
« src/cpu-profiler.cc ('K') | « src/deoptimizer.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698