Commit fc241b90 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[turbofan] Graph building is independent of closure.

This changes the BytecodeGraphBuilder interface to make the fact that
graph construction is independent of a closure explicit. A valid graph
can be constructed by providing only the pair of statically known values
for SharedFunctionInfo and TypeFeedbackVector. This is in preparation of
inlining based on the SharedFunctionInfo.

R=jarin@chromium.org
BUG=v8:2206

Review-Url: https://codereview.chromium.org/2626623002
Cr-Commit-Position: refs/heads/master@{#42224}
parent e0a85031
......@@ -444,21 +444,25 @@ Node* BytecodeGraphBuilder::Environment::Checkpoint(
}
BytecodeGraphBuilder::BytecodeGraphBuilder(
Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph,
float invocation_frequency, SourcePositionTable* source_positions,
int inlining_id)
Zone* local_zone, Handle<SharedFunctionInfo> shared_info,
Handle<TypeFeedbackVector> feedback_vector, BailoutId osr_ast_id,
JSGraph* jsgraph, float invocation_frequency,
SourcePositionTable* source_positions, int inlining_id)
: local_zone_(local_zone),
jsgraph_(jsgraph),
invocation_frequency_(invocation_frequency),
bytecode_array_(handle(info->shared_info()->bytecode_array())),
bytecode_array_(handle(shared_info->bytecode_array())),
exception_handler_table_(
handle(HandlerTable::cast(bytecode_array()->handler_table()))),
feedback_vector_(handle(info->closure()->feedback_vector())),
feedback_vector_(feedback_vector),
frame_state_function_info_(common()->CreateFrameStateFunctionInfo(
FrameStateType::kInterpretedFunction,
bytecode_array()->parameter_count(),
bytecode_array()->register_count(), info->shared_info())),
osr_ast_id_(info->osr_ast_id()),
bytecode_array()->register_count(), shared_info)),
bytecode_iterator_(nullptr),
bytecode_analysis_(nullptr),
environment_(nullptr),
osr_ast_id_(osr_ast_id),
osr_loop_offset_(-1),
merge_environments_(local_zone),
exception_handlers_(local_zone),
......@@ -469,10 +473,7 @@ BytecodeGraphBuilder::BytecodeGraphBuilder(
is_liveness_analysis_enabled_(FLAG_analyze_environment_liveness),
state_values_cache_(jsgraph),
source_positions_(source_positions),
start_position_(info->shared_info()->start_position(), inlining_id) {
// Bytecode graph builder assumes deoptimziation is enabled.
DCHECK(info->is_deoptimization_enabled());
}
start_position_(shared_info->start_position(), inlining_id) {}
Node* BytecodeGraphBuilder::GetNewTarget() {
if (!new_target_.is_set()) {
......
......@@ -16,9 +16,6 @@
namespace v8 {
namespace internal {
class CompilationInfo;
namespace compiler {
class SourcePositionTable;
......@@ -27,8 +24,10 @@ class SourcePositionTable;
// interpreter bytecodes.
class BytecodeGraphBuilder {
public:
BytecodeGraphBuilder(Zone* local_zone, CompilationInfo* info,
JSGraph* jsgraph, float invocation_frequency,
BytecodeGraphBuilder(Zone* local_zone, Handle<SharedFunctionInfo> shared,
Handle<TypeFeedbackVector> feedback_vector,
BailoutId osr_ast_id, JSGraph* jsgraph,
float invocation_frequency,
SourcePositionTable* source_positions,
int inlining_id = SourcePosition::kNotInlined);
......
......@@ -489,7 +489,7 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
Zone zone(info_->isolate()->allocator(), ZONE_NAME);
ParseInfo parse_info(&zone, shared_info);
CompilationInfo info(&parse_info, function);
CompilationInfo info(&parse_info, Handle<JSFunction>::null());
if (info_->is_deoptimization_enabled()) info.MarkAsDeoptimizationEnabled();
info.MarkAsOptimizeFromBytecode();
......@@ -526,9 +526,10 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
{
// Run the BytecodeGraphBuilder to create the subgraph.
Graph::SubgraphScope scope(graph());
BytecodeGraphBuilder graph_builder(&zone, &info, jsgraph(),
call.frequency(), source_positions_,
inlining_id);
BytecodeGraphBuilder graph_builder(
&zone, shared_info, handle(function->feedback_vector()),
BailoutId::None(), jsgraph(), call.frequency(), source_positions_,
inlining_id);
graph_builder.CreateGraph(false);
// Extract the inlinee start/end nodes.
......
......@@ -745,9 +745,13 @@ struct GraphBuilderPhase {
bool succeeded = false;
if (data->info()->is_optimizing_from_bytecode()) {
BytecodeGraphBuilder graph_builder(temp_zone, data->info(),
data->jsgraph(), 1.0f,
data->source_positions());
// Bytecode graph builder assumes deoptimziation is enabled.
DCHECK(data->info()->is_deoptimization_enabled());
BytecodeGraphBuilder graph_builder(
temp_zone, data->info()->shared_info(),
handle(data->info()->closure()->feedback_vector()),
data->info()->osr_ast_id(), data->jsgraph(), 1.0f,
data->source_positions());
succeeded = graph_builder.CreateGraph();
} else {
AstGraphBuilderWithPositions graph_builder(
......
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