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