Commit 279bc509 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[deoptimizer] Support virtual context in interpreted frame.

This adds support for dematerialized context values as part of an
interpreted frame (similar to an FCG frame). Both frame translations
should be kept in sync as much as possible.

R=rmcilroy@chromium.org
BUG=chromium:644728

Review-Url: https://codereview.chromium.org/2313343002
Cr-Commit-Position: refs/heads/master@{#39256}
parent 86f119b8
...@@ -942,11 +942,11 @@ void Deoptimizer::DoComputeJSFrame(TranslatedFrame* translated_frame, ...@@ -942,11 +942,11 @@ void Deoptimizer::DoComputeJSFrame(TranslatedFrame* translated_frame,
// so long as we don't inline functions that need local contexts. // so long as we don't inline functions that need local contexts.
output_offset -= kPointerSize; output_offset -= kPointerSize;
TranslatedFrame::iterator context_pos = value_iterator;
int context_input_index = input_index;
// When deoptimizing into a catch block, we need to take the context // When deoptimizing into a catch block, we need to take the context
// from just above the top of the operand stack (we push the context // from just above the top of the operand stack (we push the context
// at the entry of the try block). // at the entry of the try block).
TranslatedFrame::iterator context_pos = value_iterator;
int context_input_index = input_index;
if (goto_catch_handler) { if (goto_catch_handler) {
for (unsigned i = 0; i < height + 1; ++i) { for (unsigned i = 0; i < height + 1; ++i) {
context_pos++; context_pos++;
...@@ -1173,7 +1173,6 @@ void Deoptimizer::DoComputeInterpretedFrame(TranslatedFrame* translated_frame, ...@@ -1173,7 +1173,6 @@ void Deoptimizer::DoComputeInterpretedFrame(TranslatedFrame* translated_frame,
// For the bottommost output frame the context can be gotten from the input // For the bottommost output frame the context can be gotten from the input
// frame. For all subsequent output frames it can be gotten from the function // frame. For all subsequent output frames it can be gotten from the function
// so long as we don't inline functions that need local contexts. // so long as we don't inline functions that need local contexts.
Register context_reg = InterpretedFrame::context_register();
output_offset -= kPointerSize; output_offset -= kPointerSize;
// When deoptimizing into a catch block, we need to take the context // When deoptimizing into a catch block, we need to take the context
...@@ -1190,13 +1189,20 @@ void Deoptimizer::DoComputeInterpretedFrame(TranslatedFrame* translated_frame, ...@@ -1190,13 +1189,20 @@ void Deoptimizer::DoComputeInterpretedFrame(TranslatedFrame* translated_frame,
} }
// Read the context from the translations. // Read the context from the translations.
Object* context = context_pos->GetRawValue(); Object* context = context_pos->GetRawValue();
// The context should not be a placeholder for a materialized object.
CHECK(context != isolate_->heap()->arguments_marker());
value = reinterpret_cast<intptr_t>(context); value = reinterpret_cast<intptr_t>(context);
output_frame->SetContext(value); output_frame->SetContext(value);
if (is_topmost) output_frame->SetRegister(context_reg.code(), value); if (is_topmost) {
Register context_reg = InterpretedFrame::context_register();
output_frame->SetRegister(context_reg.code(), value);
}
WriteValueToOutput(context, context_input_index, frame_index, output_offset, WriteValueToOutput(context, context_input_index, frame_index, output_offset,
"context "); "context ");
if (context == isolate_->heap()->arguments_marker()) {
Address output_address =
reinterpret_cast<Address>(output_[frame_index]->GetTop()) +
output_offset;
values_to_materialize_.push_back({output_address, context_pos});
}
value_iterator++; value_iterator++;
input_index++; input_index++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment