| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_COMPILER_AST_GRAPH_BUILDER_H_ | 5 #ifndef V8_COMPILER_AST_GRAPH_BUILDER_H_ |
| 6 #define V8_COMPILER_AST_GRAPH_BUILDER_H_ | 6 #define V8_COMPILER_AST_GRAPH_BUILDER_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/ast.h" | 10 #include "src/ast.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 // Builder to create a local function context. | 74 // Builder to create a local function context. |
| 75 Node* BuildLocalFunctionContext(Node* context, Node* closure); | 75 Node* BuildLocalFunctionContext(Node* context, Node* closure); |
| 76 | 76 |
| 77 // Builder to create an arguments object if it is used. | 77 // Builder to create an arguments object if it is used. |
| 78 Node* BuildArgumentsObject(Variable* arguments); | 78 Node* BuildArgumentsObject(Variable* arguments); |
| 79 | 79 |
| 80 // Builders for variable load and assignment. | 80 // Builders for variable load and assignment. |
| 81 Node* BuildVariableAssignment(Variable* var, Node* value, Token::Value op, | 81 Node* BuildVariableAssignment(Variable* var, Node* value, Token::Value op, |
| 82 BailoutId bailout_id); | 82 BailoutId bailout_id); |
| 83 Node* BuildVariableDelete(Variable* var); | 83 Node* BuildVariableDelete(Variable* var, BailoutId bailout_id, |
| 84 OutputFrameStateCombine state_combine); |
| 84 Node* BuildVariableLoad(Variable* var, BailoutId bailout_id, | 85 Node* BuildVariableLoad(Variable* var, BailoutId bailout_id, |
| 85 ContextualMode mode = CONTEXTUAL); | 86 ContextualMode mode = CONTEXTUAL); |
| 86 | 87 |
| 87 // Builders for accessing the function context. | 88 // Builders for accessing the function context. |
| 88 Node* BuildLoadBuiltinsObject(); | 89 Node* BuildLoadBuiltinsObject(); |
| 89 Node* BuildLoadGlobalObject(); | 90 Node* BuildLoadGlobalObject(); |
| 90 Node* BuildLoadClosure(); | 91 Node* BuildLoadClosure(); |
| 91 Node* BuildLoadObjectField(Node* object, int offset); | 92 Node* BuildLoadObjectField(Node* object, int offset); |
| 92 | 93 |
| 93 // Builders for automatic type conversion. | 94 // Builders for automatic type conversion. |
| 94 Node* BuildToBoolean(Node* value); | 95 Node* BuildToBoolean(Node* value); |
| 95 | 96 |
| 96 // Builders for error reporting at runtime. | 97 // Builders for error reporting at runtime. |
| 97 Node* BuildThrowReferenceError(Variable* var); | 98 Node* BuildThrowReferenceError(Variable* var, BailoutId bailout_id); |
| 98 | 99 |
| 99 // Builders for dynamic hole-checks at runtime. | 100 // Builders for dynamic hole-checks at runtime. |
| 100 Node* BuildHoleCheckSilent(Node* value, Node* for_hole, Node* not_hole); | 101 Node* BuildHoleCheckSilent(Node* value, Node* for_hole, Node* not_hole); |
| 101 Node* BuildHoleCheckThrow(Node* value, Variable* var, Node* not_hole); | 102 Node* BuildHoleCheckThrow(Node* value, Variable* var, Node* not_hole, |
| 103 BailoutId bailout_id); |
| 102 | 104 |
| 103 // Builders for binary operations. | 105 // Builders for binary operations. |
| 104 Node* BuildBinaryOp(Node* left, Node* right, Token::Value op); | 106 Node* BuildBinaryOp(Node* left, Node* right, Token::Value op); |
| 105 | 107 |
| 106 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 108 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
| 107 // Visiting functions for AST nodes make this an AstVisitor. | 109 // Visiting functions for AST nodes make this an AstVisitor. |
| 108 AST_NODE_LIST(DECLARE_VISIT) | 110 AST_NODE_LIST(DECLARE_VISIT) |
| 109 #undef DECLARE_VISIT | 111 #undef DECLARE_VISIT |
| 110 | 112 |
| 111 // Visiting function for declarations list is overridden. | 113 // Visiting function for declarations list is overridden. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 168 |
| 167 // Dispatched from VisitBinaryOperation. | 169 // Dispatched from VisitBinaryOperation. |
| 168 void VisitComma(BinaryOperation* expr); | 170 void VisitComma(BinaryOperation* expr); |
| 169 void VisitLogicalExpression(BinaryOperation* expr); | 171 void VisitLogicalExpression(BinaryOperation* expr); |
| 170 void VisitArithmeticExpression(BinaryOperation* expr); | 172 void VisitArithmeticExpression(BinaryOperation* expr); |
| 171 | 173 |
| 172 // Dispatched from VisitForInStatement. | 174 // Dispatched from VisitForInStatement. |
| 173 void VisitForInAssignment(Expression* expr, Node* value); | 175 void VisitForInAssignment(Expression* expr, Node* value); |
| 174 | 176 |
| 175 // Builds deoptimization for a given node. | 177 // Builds deoptimization for a given node. |
| 176 void PrepareFrameState(Node* node, BailoutId ast_id, | 178 void PrepareFrameState( |
| 177 OutputFrameStateCombine combine = kIgnoreOutput); | 179 Node* node, BailoutId ast_id, |
| 180 OutputFrameStateCombine combine = OutputFrameStateCombine::Ignore()); |
| 178 | 181 |
| 179 OutputFrameStateCombine StateCombineFromAstContext(); | 182 OutputFrameStateCombine StateCombineFromAstContext(); |
| 180 | 183 |
| 181 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 184 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| 182 DISALLOW_COPY_AND_ASSIGN(AstGraphBuilder); | 185 DISALLOW_COPY_AND_ASSIGN(AstGraphBuilder); |
| 183 }; | 186 }; |
| 184 | 187 |
| 185 | 188 |
| 186 // The abstract execution environment for generated code consists of | 189 // The abstract execution environment for generated code consists of |
| 187 // parameter variables, local variables and the operand stack. The | 190 // parameter variables, local variables and the operand stack. The |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // decides how the evaluation result is passed up the visitor. | 284 // decides how the evaluation result is passed up the visitor. |
| 282 class AstGraphBuilder::AstContext BASE_EMBEDDED { | 285 class AstGraphBuilder::AstContext BASE_EMBEDDED { |
| 283 public: | 286 public: |
| 284 bool IsEffect() const { return kind_ == Expression::kEffect; } | 287 bool IsEffect() const { return kind_ == Expression::kEffect; } |
| 285 bool IsValue() const { return kind_ == Expression::kValue; } | 288 bool IsValue() const { return kind_ == Expression::kValue; } |
| 286 bool IsTest() const { return kind_ == Expression::kTest; } | 289 bool IsTest() const { return kind_ == Expression::kTest; } |
| 287 | 290 |
| 288 // Determines how to combine the frame state with the value | 291 // Determines how to combine the frame state with the value |
| 289 // that is about to be plugged into this AstContext. | 292 // that is about to be plugged into this AstContext. |
| 290 OutputFrameStateCombine GetStateCombine() { | 293 OutputFrameStateCombine GetStateCombine() { |
| 291 return IsEffect() ? kIgnoreOutput : kPushOutput; | 294 return IsEffect() ? OutputFrameStateCombine::Ignore() |
| 295 : OutputFrameStateCombine::Push(); |
| 292 } | 296 } |
| 293 | 297 |
| 294 // Plug a node into this expression context. Call this function in tail | 298 // Plug a node into this expression context. Call this function in tail |
| 295 // position in the Visit functions for expressions. | 299 // position in the Visit functions for expressions. |
| 296 virtual void ProduceValue(Node* value) = 0; | 300 virtual void ProduceValue(Node* value) = 0; |
| 297 | 301 |
| 298 // Unplugs a node from this expression context. Call this to retrieve the | 302 // Unplugs a node from this expression context. Call this to retrieve the |
| 299 // result of another Visit function that already plugged the context. | 303 // result of another Visit function that already plugged the context. |
| 300 virtual Node* ConsumeValue() = 0; | 304 virtual Node* ConsumeValue() = 0; |
| 301 | 305 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 }; | 425 }; |
| 422 | 426 |
| 423 Scope* AstGraphBuilder::current_scope() const { | 427 Scope* AstGraphBuilder::current_scope() const { |
| 424 return execution_context_->scope(); | 428 return execution_context_->scope(); |
| 425 } | 429 } |
| 426 } | 430 } |
| 427 } | 431 } |
| 428 } // namespace v8::internal::compiler | 432 } // namespace v8::internal::compiler |
| 429 | 433 |
| 430 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 434 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ |
| OLD | NEW |