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

Side by Side Diff: src/deoptimizer.cc

Issue 2161543002: [turbofan] Add support for eager/soft deoptimization reasons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Do the ports properly Created 4 years, 5 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/disassembler.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 // 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/deoptimizer.h" 5 #include "src/deoptimizer.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/ast/prettyprinter.h" 8 #include "src/ast/prettyprinter.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/disasm.h" 10 #include "src/disasm.h"
(...skipping 2718 matching lines...) Expand 10 before | Expand all | Expand 10 after
2729 } 2729 }
2730 2730
2731 // For interpreter frame, skip the accumulator. 2731 // For interpreter frame, skip the accumulator.
2732 if (frame_it->kind() == TranslatedFrame::kInterpretedFunction) { 2732 if (frame_it->kind() == TranslatedFrame::kInterpretedFunction) {
2733 stack_it++; 2733 stack_it++;
2734 } 2734 }
2735 CHECK(stack_it == frame_it->end()); 2735 CHECK(stack_it == frame_it->end());
2736 } 2736 }
2737 2737
2738 2738
2739 const char* Deoptimizer::GetDeoptReason(DeoptReason deopt_reason) {
2740 DCHECK(deopt_reason < kLastDeoptReason);
2741 #define DEOPT_MESSAGES_TEXTS(C, T) T,
2742 static const char* deopt_messages_[] = {
2743 DEOPT_MESSAGES_LIST(DEOPT_MESSAGES_TEXTS)};
2744 #undef DEOPT_MESSAGES_TEXTS
2745 return deopt_messages_[deopt_reason];
2746 }
2747
2748
2749 Deoptimizer::DeoptInfo Deoptimizer::GetDeoptInfo(Code* code, Address pc) { 2739 Deoptimizer::DeoptInfo Deoptimizer::GetDeoptInfo(Code* code, Address pc) {
2750 SourcePosition last_position = SourcePosition::Unknown(); 2740 SourcePosition last_position = SourcePosition::Unknown();
2751 Deoptimizer::DeoptReason last_reason = Deoptimizer::kNoReason; 2741 DeoptimizeReason last_reason = DeoptimizeReason::kNoReason;
2752 int last_deopt_id = Deoptimizer::DeoptInfo::kNoDeoptId; 2742 int last_deopt_id = Deoptimizer::DeoptInfo::kNoDeoptId;
2753 int mask = RelocInfo::ModeMask(RelocInfo::DEOPT_REASON) | 2743 int mask = RelocInfo::ModeMask(RelocInfo::DEOPT_REASON) |
2754 RelocInfo::ModeMask(RelocInfo::DEOPT_ID) | 2744 RelocInfo::ModeMask(RelocInfo::DEOPT_ID) |
2755 RelocInfo::ModeMask(RelocInfo::DEOPT_POSITION); 2745 RelocInfo::ModeMask(RelocInfo::DEOPT_POSITION);
2756 for (RelocIterator it(code, mask); !it.done(); it.next()) { 2746 for (RelocIterator it(code, mask); !it.done(); it.next()) {
2757 RelocInfo* info = it.rinfo(); 2747 RelocInfo* info = it.rinfo();
2758 if (info->pc() >= pc) { 2748 if (info->pc() >= pc) {
2759 return DeoptInfo(last_position, last_reason, last_deopt_id); 2749 return DeoptInfo(last_position, last_reason, last_deopt_id);
2760 } 2750 }
2761 if (info->rmode() == RelocInfo::DEOPT_POSITION) { 2751 if (info->rmode() == RelocInfo::DEOPT_POSITION) {
2762 int raw_position = static_cast<int>(info->data()); 2752 int raw_position = static_cast<int>(info->data());
2763 last_position = raw_position ? SourcePosition::FromRaw(raw_position) 2753 last_position = raw_position ? SourcePosition::FromRaw(raw_position)
2764 : SourcePosition::Unknown(); 2754 : SourcePosition::Unknown();
2765 } else if (info->rmode() == RelocInfo::DEOPT_ID) { 2755 } else if (info->rmode() == RelocInfo::DEOPT_ID) {
2766 last_deopt_id = static_cast<int>(info->data()); 2756 last_deopt_id = static_cast<int>(info->data());
2767 } else if (info->rmode() == RelocInfo::DEOPT_REASON) { 2757 } else if (info->rmode() == RelocInfo::DEOPT_REASON) {
2768 last_reason = static_cast<Deoptimizer::DeoptReason>(info->data()); 2758 last_reason = static_cast<DeoptimizeReason>(info->data());
2769 } 2759 }
2770 } 2760 }
2771 return DeoptInfo(SourcePosition::Unknown(), Deoptimizer::kNoReason, -1); 2761 return DeoptInfo(SourcePosition::Unknown(), DeoptimizeReason::kNoReason, -1);
2772 } 2762 }
2773 2763
2774 2764
2775 // static 2765 // static
2776 int Deoptimizer::ComputeSourcePosition(SharedFunctionInfo* shared, 2766 int Deoptimizer::ComputeSourcePosition(SharedFunctionInfo* shared,
2777 BailoutId node_id) { 2767 BailoutId node_id) {
2778 AbstractCode* abstract_code = shared->abstract_code(); 2768 AbstractCode* abstract_code = shared->abstract_code();
2779 int code_offset; 2769 int code_offset;
2780 if (abstract_code->IsBytecodeArray()) { 2770 if (abstract_code->IsBytecodeArray()) {
2781 // BailoutId points to the next bytecode in the bytecode aray. Subtract 2771 // BailoutId points to the next bytecode in the bytecode aray. Subtract
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
4013 CHECK(value_info->IsMaterializedObject()); 4003 CHECK(value_info->IsMaterializedObject());
4014 4004
4015 value_info->value_ = 4005 value_info->value_ =
4016 Handle<Object>(previously_materialized_objects->get(i), isolate_); 4006 Handle<Object>(previously_materialized_objects->get(i), isolate_);
4017 } 4007 }
4018 } 4008 }
4019 } 4009 }
4020 4010
4021 } // namespace internal 4011 } // namespace internal
4022 } // namespace v8 4012 } // namespace v8
OLDNEW
« no previous file with comments | « src/deoptimizer.h ('k') | src/disassembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698