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

Unified Diff: src/deoptimizer.cc

Issue 1707133003: [Interpreter] Fix deopt when accumulator needs to be materialized. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments and add test Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/code-generator.cc ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/deoptimizer.cc
diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc
index a44d15fbef1626dc6e99400439cf59d5bcb40d98..634f072b3aa2255d84b040e080c02d9087d02c36 100644
--- a/src/deoptimizer.cc
+++ b/src/deoptimizer.cc
@@ -1271,23 +1271,28 @@ void Deoptimizer::DoComputeInterpretedFrame(int frame_index,
"bytecode offset ");
// Translate the rest of the interpreter registers in the frame.
- for (unsigned i = 0; i < height; ++i) {
+ for (unsigned i = 0; i < height - 1; ++i) {
output_offset -= kPointerSize;
WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index,
output_offset);
}
- CHECK_EQ(0u, output_offset);
- // Set the accumulator register. If we are lazy deopting to a catch handler,
- // we set the accumulator to the exception (which lives in the result
- // register).
- intptr_t accumulator_value =
- goto_catch_handler
- ? input_->GetRegister(FullCodeGenerator::result_register().code())
- : reinterpret_cast<intptr_t>(value_iterator->GetRawValue());
- output_frame->SetRegister(kInterpreterAccumulatorRegister.code(),
- accumulator_value);
- value_iterator++;
+ // Put the accumulator on the stack. It will be popped by the
+ // InterpreterNotifyDeopt builtin (possibly after materialization).
+ output_offset -= kPointerSize;
+ if (goto_catch_handler) {
+ // If we are lazy deopting to a catch handler, we set the accumulator to
+ // the exception (which lives in the result register).
+ intptr_t accumulator_value =
+ input_->GetRegister(FullCodeGenerator::result_register().code());
+ WriteValueToOutput(reinterpret_cast<Object*>(accumulator_value), 0,
+ frame_index, output_offset, "accumulator ");
+ value_iterator++;
+ } else {
+ WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index,
+ output_offset);
+ }
+ CHECK_EQ(0u, output_offset);
Builtins* builtins = isolate_->builtins();
Code* dispatch_builtin =
@@ -2569,8 +2574,10 @@ DeoptimizedFrameInfo::DeoptimizedFrameInfo(TranslatedState* state,
// Get the expression stack.
int stack_height = frame_it->height();
- if (frame_it->kind() == TranslatedFrame::kFunction) {
+ if (frame_it->kind() == TranslatedFrame::kFunction ||
+ frame_it->kind() == TranslatedFrame::kInterpretedFunction) {
// For full-code frames, we should not count the context.
+ // For interpreter frames, we should not count the accumulator.
// TODO(jarin): Clean up the indexing in translated frames.
stack_height--;
}
@@ -2582,7 +2589,7 @@ DeoptimizedFrameInfo::DeoptimizedFrameInfo(TranslatedState* state,
}
// For interpreter frame, skip the accumulator.
- if (parameter_frame->kind() == TranslatedFrame::kInterpretedFunction) {
+ if (frame_it->kind() == TranslatedFrame::kInterpretedFunction) {
stack_it++;
}
CHECK(stack_it == frame_it->end());
@@ -2949,8 +2956,8 @@ int TranslatedFrame::GetValueCount() {
case kInterpretedFunction: {
int parameter_count =
raw_shared_info_->internal_formal_parameter_count() + 1;
- // + 3 for function, context and accumulator.
- return height_ + parameter_count + 3;
+ // + 2 for function and context.
+ return height_ + parameter_count + 2;
}
case kGetter:
« no previous file with comments | « src/compiler/code-generator.cc ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698