diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc index ac5070869f..2c242cbe14 100644 --- a/src/compiler/ast-graph-builder.cc +++ b/src/compiler/ast-graph-builder.cc @@ -16,12 +16,10 @@ namespace v8 { namespace internal { namespace compiler { -AstGraphBuilder::AstGraphBuilder(CompilationInfo* info, JSGraph* jsgraph, - SourcePositionTable* source_positions) +AstGraphBuilder::AstGraphBuilder(CompilationInfo* info, JSGraph* jsgraph) : StructuredGraphBuilder(jsgraph->graph(), jsgraph->common()), info_(info), jsgraph_(jsgraph), - source_positions_(source_positions), globals_(0, info->zone()), breakable_(NULL), execution_context_(NULL) { @@ -55,13 +53,9 @@ bool AstGraphBuilder::CreateGraph() { Scope* scope = info()->scope(); DCHECK(graph() != NULL); - SourcePositionTable::Scope start_pos( - source_positions(), - SourcePosition(info()->shared_info()->start_position())); - // Set up the basic structure of the graph. - graph()->SetStart( - graph()->NewNode(common()->Start(info()->num_parameters()))); + int parameter_count = info()->num_parameters(); + graph()->SetStart(graph()->NewNode(common()->Start(parameter_count))); // Initialize the top-level environment. Environment env(this, scope, graph()->start()); @@ -98,10 +92,6 @@ bool AstGraphBuilder::CreateGraph() { VisitStatements(info()->function()->body()); if (HasStackOverflow()) return false; - SourcePositionTable::Scope end_pos( - source_positions(), - SourcePosition(info()->shared_info()->end_position() - 1)); - // Emit tracing call if requested to do so. if (FLAG_trace) { // TODO(mstarzinger): Only traces implicit return. @@ -1958,10 +1948,9 @@ Node* AstGraphBuilder::BuildBinaryOp(Node* left, Node* right, Token::Value op) { void AstGraphBuilder::BuildLazyBailout(Node* node, BailoutId ast_id) { if (OperatorProperties::CanLazilyDeoptimize(node->op())) { // The deopting node should have an outgoing control dependency. - DCHECK(GetControlDependency() == node); + DCHECK(environment()->GetControlDependency() == node); - StructuredGraphBuilder::Environment* continuation_env = - environment_internal(); + StructuredGraphBuilder::Environment* continuation_env = environment(); // Create environment for the deoptimization block, and build the block. StructuredGraphBuilder::Environment* deopt_env = CopyEnvironment(continuation_env); diff --git a/src/compiler/ast-graph-builder.h b/src/compiler/ast-graph-builder.h index ccdb7538a4..950529a842 100644 --- a/src/compiler/ast-graph-builder.h +++ b/src/compiler/ast-graph-builder.h @@ -25,8 +25,7 @@ class Graph; // of function inlining. class AstGraphBuilder : public StructuredGraphBuilder, public AstVisitor { public: - AstGraphBuilder(CompilationInfo* info, JSGraph* jsgraph, - SourcePositionTable* source_positions_); + AstGraphBuilder(CompilationInfo* info, JSGraph* jsgraph); // Creates a graph by visiting the entire AST. bool CreateGraph(); @@ -41,7 +40,8 @@ class AstGraphBuilder : public StructuredGraphBuilder, public AstVisitor { class Environment; Environment* environment() { - return reinterpret_cast(environment_internal()); + return reinterpret_cast( + StructuredGraphBuilder::environment()); } AstContext* ast_context() const { return ast_context_; } @@ -57,8 +57,6 @@ class AstGraphBuilder : public StructuredGraphBuilder, public AstVisitor { typedef StructuredGraphBuilder::Environment BaseEnvironment; virtual BaseEnvironment* CopyEnvironment(BaseEnvironment* env); - SourcePositionTable* source_positions() { return source_positions_; } - // TODO(mstarzinger): The pipeline only needs to be a friend to access the // function context. Remove as soon as the context is a parameter. friend class Pipeline; @@ -114,7 +112,6 @@ class AstGraphBuilder : public StructuredGraphBuilder, public AstVisitor { CompilationInfo* info_; AstContext* ast_context_; JSGraph* jsgraph_; - SourcePositionTable* source_positions_; // List of global declarations for functions and variables. ZoneList > globals_; diff --git a/src/compiler/control-builders.h b/src/compiler/control-builders.h index 9b604c1261..695282be8a 100644 --- a/src/compiler/control-builders.h +++ b/src/compiler/control-builders.h @@ -33,7 +33,7 @@ class ControlBuilder { typedef StructuredGraphBuilder::Environment Environment; Zone* zone() const { return builder_->zone(); } - Environment* environment() { return builder_->environment_internal(); } + Environment* environment() { return builder_->environment(); } void set_environment(Environment* env) { builder_->set_environment(env); } Builder* builder_; diff --git a/src/compiler/graph-builder.cc b/src/compiler/graph-builder.cc index e8345ac367..9c414f1bf9 100644 --- a/src/compiler/graph-builder.cc +++ b/src/compiler/graph-builder.cc @@ -56,15 +56,15 @@ Node* StructuredGraphBuilder::MakeNode(Operator* op, int value_input_count, *current_input++ = environment_->GetEffectDependency(); } if (has_control) { - *current_input++ = GetControlDependency(); + *current_input++ = environment_->GetControlDependency(); } result = graph()->NewNode(op, input_count_with_deps, buffer); if (has_effect) { environment_->UpdateEffectDependency(result); } if (OperatorProperties::HasControlOutput(result->op()) && - !environment_internal()->IsMarkedAsUnreachable()) { - UpdateControlDependency(result); + !environment()->IsMarkedAsUnreachable()) { + environment_->UpdateControlDependency(result); } } @@ -72,23 +72,13 @@ Node* StructuredGraphBuilder::MakeNode(Operator* op, int value_input_count, } -Node* StructuredGraphBuilder::GetControlDependency() { - return environment_->GetControlDependency(); -} - - -void StructuredGraphBuilder::UpdateControlDependency(Node* new_control) { - environment_->UpdateControlDependency(new_control); -} - - void StructuredGraphBuilder::UpdateControlDependencyToLeaveFunction( Node* exit) { - if (environment_internal()->IsMarkedAsUnreachable()) return; + if (environment()->IsMarkedAsUnreachable()) return; if (exit_control() != NULL) { exit = MergeControl(exit_control(), exit); } - environment_internal()->MarkAsUnreachable(); + environment()->MarkAsUnreachable(); set_exit_control(exit); } diff --git a/src/compiler/graph-builder.h b/src/compiler/graph-builder.h index ac42f6e7f6..fc90008554 100644 --- a/src/compiler/graph-builder.h +++ b/src/compiler/graph-builder.h @@ -109,7 +109,7 @@ class StructuredGraphBuilder : public GraphBuilder { virtual Node* MakeNode(Operator* op, int value_input_count, Node** value_inputs); - Environment* environment_internal() const { return environment_; } + Environment* environment() const { return environment_; } void set_environment(Environment* env) { environment_ = env; } Node* current_context() const { return current_context_; } @@ -135,12 +135,6 @@ class StructuredGraphBuilder : public GraphBuilder { // depends on the graph builder, but environments themselves are not virtual. virtual Environment* CopyEnvironment(Environment* env); - // Helper when creating node that depends on control. - Node* GetControlDependency(); - - // Helper when creating node that updates control. - void UpdateControlDependency(Node* new_control); - // Helper to indicate a node exits the function body. void UpdateControlDependencyToLeaveFunction(Node* exit); diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc index 1752882779..ca47b70bef 100644 --- a/src/compiler/pipeline.cc +++ b/src/compiler/pipeline.cc @@ -85,16 +85,25 @@ class AstGraphBuilderWithPositions : public AstGraphBuilder { public: explicit AstGraphBuilderWithPositions(CompilationInfo* info, JSGraph* jsgraph, SourcePositionTable* source_positions) - : AstGraphBuilder(info, jsgraph, source_positions) {} + : AstGraphBuilder(info, jsgraph), source_positions_(source_positions) {} + + bool CreateGraph() V8_OVERRIDE { + SourcePositionTable::Scope pos(source_positions_, + SourcePosition::Unknown()); + return AstGraphBuilder::CreateGraph(); + } #define DEF_VISIT(type) \ virtual void Visit##type(type* node) V8_OVERRIDE { \ - SourcePositionTable::Scope pos(source_positions(), \ + SourcePositionTable::Scope pos(source_positions_, \ SourcePosition(node->position())); \ AstGraphBuilder::Visit##type(node); \ } AST_NODE_LIST(DEF_VISIT) #undef DEF_VISIT + + private: + SourcePositionTable* source_positions_; }; diff --git a/test/cctest/compiler/simplified-graph-builder.h b/test/cctest/compiler/simplified-graph-builder.h index 26a265b18e..fa9161e171 100644 --- a/test/cctest/compiler/simplified-graph-builder.h +++ b/test/cctest/compiler/simplified-graph-builder.h @@ -49,7 +49,8 @@ class SimplifiedGraphBuilder MachineOperatorBuilder* machine() const { return machine_; } SimplifiedOperatorBuilder* simplified() const { return simplified_; } Environment* environment() { - return reinterpret_cast(environment_internal()); + return reinterpret_cast( + StructuredGraphBuilder::environment()); } // Initialize graph and builder. diff --git a/test/mjsunit/mjsunit.status b/test/mjsunit/mjsunit.status index 7728d5e4b0..b55bb4335d 100644 --- a/test/mjsunit/mjsunit.status +++ b/test/mjsunit/mjsunit.status @@ -66,8 +66,6 @@ # Some tests are over-restrictive about object layout. 'array-constructor-feedback': [PASS, NO_VARIANTS], 'array-feedback': [PASS, NO_VARIANTS], - 'fast-non-keyed': [PASS, NO_VARIANTS], - 'track-fields': [PASS, NO_VARIANTS], # Some tests are just too slow to run for now. 'big-object-literal': [PASS, NO_VARIANTS],