Commit 66d76797 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[deoptimizer] Support materialization of closures.

This adds support to materialize JSFunction objects from deoptimization
information. By now we need to support this because TurboFan's escape
analysis can produce virtual (i.e. non-escaping) closures.

R=jarin@chromium.org

Review-Url: https://codereview.chromium.org/1998143002
Cr-Commit-Position: refs/heads/master@{#36400}
parent d77b332e
......@@ -3711,6 +3711,35 @@ Handle<Object> TranslatedState::MaterializeAt(int frame_index,
object->set_length(*length);
return object;
}
case JS_FUNCTION_TYPE: {
Handle<JSFunction> object =
isolate_->factory()->NewFunctionFromSharedFunctionInfo(
handle(isolate_->object_function()->shared()),
handle(isolate_->context()));
slot->value_ = object;
// We temporarily allocated a JSFunction for the {Object} function
// within the current context, to break cycles in the object graph.
// The correct function and context will be set below once available.
Handle<Object> properties = MaterializeAt(frame_index, value_index);
Handle<Object> elements = MaterializeAt(frame_index, value_index);
Handle<Object> prototype = MaterializeAt(frame_index, value_index);
Handle<Object> shared = MaterializeAt(frame_index, value_index);
Handle<Object> context = MaterializeAt(frame_index, value_index);
Handle<Object> literals = MaterializeAt(frame_index, value_index);
Handle<Object> entry = MaterializeAt(frame_index, value_index);
Handle<Object> next_link = MaterializeAt(frame_index, value_index);
object->ReplaceCode(*isolate_->builtins()->CompileLazy());
object->set_map(*map);
object->set_properties(FixedArray::cast(*properties));
object->set_elements(FixedArrayBase::cast(*elements));
object->set_prototype_or_initial_map(*prototype);
object->set_shared(SharedFunctionInfo::cast(*shared));
object->set_context(Context::cast(*context));
object->set_literals(LiteralsArray::cast(*literals));
CHECK(entry->IsNumber()); // Entry to compile lazy stub.
CHECK(next_link->IsUndefined());
return object;
}
case FIXED_ARRAY_TYPE: {
Handle<Object> lengthObject = MaterializeAt(frame_index, value_index);
int32_t length = 0;
......
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