namespace compiler {
class ControlBuilder;
-class LoopBuilder;
class Graph;
+class LoopAssignmentAnalysis;
+class LoopBuilder;
// The AstGraphBuilder produces a high-level IR graph, based on an
// underlying AST. The produced graph can either be compiled into a
// of function inlining.
class AstGraphBuilder : public StructuredGraphBuilder, public AstVisitor {
public:
- AstGraphBuilder(CompilationInfo* info, JSGraph* jsgraph);
+ AstGraphBuilder(Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph);
// Creates a graph by visiting the entire AST.
bool CreateGraph();
// Support for control flow builders. The concrete type of the environment
// depends on the graph builder, but environments themselves are not virtual.
typedef StructuredGraphBuilder::Environment BaseEnvironment;
- virtual BaseEnvironment* CopyEnvironment(BaseEnvironment* env);
+ virtual BaseEnvironment* CopyEnvironment(BaseEnvironment* env) OVERRIDE;
// TODO(mstarzinger): The pipeline only needs to be a friend to access the
// function context. Remove as soon as the context is a parameter.
// Builders for variable load and assignment.
Node* BuildVariableAssignment(Variable* var, Node* value, Token::Value op,
BailoutId bailout_id);
- Node* BuildVariableDelete(Variable* var);
+ Node* BuildVariableDelete(Variable* var, BailoutId bailout_id,
+ OutputFrameStateCombine state_combine);
Node* BuildVariableLoad(Variable* var, BailoutId bailout_id,
+ const VectorSlotPair& feedback,
ContextualMode mode = CONTEXTUAL);
// Builders for accessing the function context.
Node* BuildToBoolean(Node* value);
// Builders for error reporting at runtime.
- Node* BuildThrowReferenceError(Variable* var);
+ Node* BuildThrowReferenceError(Variable* var, BailoutId bailout_id);
// Builders for dynamic hole-checks at runtime.
Node* BuildHoleCheckSilent(Node* value, Node* for_hole, Node* not_hole);
- Node* BuildHoleCheckThrow(Node* value, Variable* var, Node* not_hole);
+ Node* BuildHoleCheckThrow(Node* value, Variable* var, Node* not_hole,
+ BailoutId bailout_id);
// Builders for binary operations.
Node* BuildBinaryOp(Node* left, Node* right, Token::Value op);
-#define DECLARE_VISIT(type) virtual void Visit##type(type* node);
+ // Builder for stack-check guards.
+ Node* BuildStackCheck();
+
+#define DECLARE_VISIT(type) virtual void Visit##type(type* node) OVERRIDE;
// Visiting functions for AST nodes make this an AstVisitor.
AST_NODE_LIST(DECLARE_VISIT)
#undef DECLARE_VISIT
// Visiting function for declarations list is overridden.
- virtual void VisitDeclarations(ZoneList<Declaration*>* declarations);
+ virtual void VisitDeclarations(ZoneList<Declaration*>* declarations) OVERRIDE;
private:
CompilationInfo* info_;
SetOncePointer<Node> function_closure_;
SetOncePointer<Node> function_context_;
- CompilationInfo* info() { return info_; }
- StrictMode strict_mode() { return info()->strict_mode(); }
+ // Result of loop assignment analysis performed before graph creation.
+ LoopAssignmentAnalysis* loop_assignment_analysis_;
+
+ CompilationInfo* info() const { return info_; }
+ inline StrictMode strict_mode() const;
JSGraph* jsgraph() { return jsgraph_; }
JSOperatorBuilder* javascript() { return jsgraph_->javascript(); }
ZoneList<Handle<Object> >* globals() { return &globals_; }
// Current scope during visitation.
inline Scope* current_scope() const;
+ // Named and keyed loads require a VectorSlotPair for successful lowering.
+ VectorSlotPair CreateVectorSlotPair(FeedbackVectorICSlot slot) const;
+
// Process arguments to a call by popping {arity} elements off the operand
// stack and build a call node using the given call operator.
Node* ProcessArguments(const Operator* op, int arity);
void VisitIfNotNull(Statement* stmt);
// Visit expressions.
+ void Visit(Expression* expr);
void VisitForTest(Expression* expr);
void VisitForEffect(Expression* expr);
void VisitForValue(Expression* expr);
void VisitForInAssignment(Expression* expr, Node* value);
// Builds deoptimization for a given node.
- void PrepareFrameState(Node* node, BailoutId ast_id,
- OutputFrameStateCombine combine = kIgnoreOutput);
+ void PrepareFrameState(
+ Node* node, BailoutId ast_id,
+ OutputFrameStateCombine combine = OutputFrameStateCombine::Ignore());
- OutputFrameStateCombine StateCombineFromAstContext();
+ BitVector* GetVariablesAssignedInLoop(IterationStatement* stmt);
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
DISALLOW_COPY_AND_ASSIGN(AstGraphBuilder);
// Determines how to combine the frame state with the value
// that is about to be plugged into this AstContext.
OutputFrameStateCombine GetStateCombine() {
- return IsEffect() ? kIgnoreOutput : kPushOutput;
+ return IsEffect() ? OutputFrameStateCombine::Ignore()
+ : OutputFrameStateCombine::Push();
}
// Plug a node into this expression context. Call this function in tail
Scope* AstGraphBuilder::current_scope() const {
return execution_context_->scope();
}
-}
-}
-} // namespace v8::internal::compiler
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
#endif // V8_COMPILER_AST_GRAPH_BUILDER_H_