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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 Node* BuildHoleCheckSilent(Node* value, Node* for_hole, Node* not_hole); | 107 Node* BuildHoleCheckSilent(Node* value, Node* for_hole, Node* not_hole); |
108 Node* BuildHoleCheckThrow(Node* value, Variable* var, Node* not_hole, | 108 Node* BuildHoleCheckThrow(Node* value, Variable* var, Node* not_hole, |
109 BailoutId bailout_id); | 109 BailoutId bailout_id); |
110 | 110 |
111 // Builders for binary operations. | 111 // Builders for binary operations. |
112 Node* BuildBinaryOp(Node* left, Node* right, Token::Value op); | 112 Node* BuildBinaryOp(Node* left, Node* right, Token::Value op); |
113 | 113 |
114 // Builder for stack-check guards. | 114 // Builder for stack-check guards. |
115 Node* BuildStackCheck(); | 115 Node* BuildStackCheck(); |
116 | 116 |
117 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) OVERRIDE; | 117 #define DECLARE_VISIT(type) void Visit##type(type* node) OVERRIDE; |
118 // Visiting functions for AST nodes make this an AstVisitor. | 118 // Visiting functions for AST nodes make this an AstVisitor. |
119 AST_NODE_LIST(DECLARE_VISIT) | 119 AST_NODE_LIST(DECLARE_VISIT) |
120 #undef DECLARE_VISIT | 120 #undef DECLARE_VISIT |
121 | 121 |
122 // Visiting function for declarations list is overridden. | 122 // Visiting function for declarations list is overridden. |
123 void VisitDeclarations(ZoneList<Declaration*>* declarations) OVERRIDE; | 123 void VisitDeclarations(ZoneList<Declaration*>* declarations) OVERRIDE; |
124 | 124 |
125 private: | 125 private: |
126 CompilationInfo* info_; | 126 CompilationInfo* info_; |
127 AstContext* ast_context_; | 127 AstContext* ast_context_; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 AstGraphBuilder* owner_; | 340 AstGraphBuilder* owner_; |
341 AstContext* outer_; | 341 AstContext* outer_; |
342 }; | 342 }; |
343 | 343 |
344 | 344 |
345 // Context to evaluate expression for its side effects only. | 345 // Context to evaluate expression for its side effects only. |
346 class AstGraphBuilder::AstEffectContext FINAL : public AstContext { | 346 class AstGraphBuilder::AstEffectContext FINAL : public AstContext { |
347 public: | 347 public: |
348 explicit AstEffectContext(AstGraphBuilder* owner) | 348 explicit AstEffectContext(AstGraphBuilder* owner) |
349 : AstContext(owner, Expression::kEffect) {} | 349 : AstContext(owner, Expression::kEffect) {} |
350 virtual ~AstEffectContext(); | 350 ~AstEffectContext() FINAL; |
351 void ProduceValue(Node* value) OVERRIDE; | 351 void ProduceValue(Node* value) FINAL; |
352 Node* ConsumeValue() OVERRIDE; | 352 Node* ConsumeValue() FINAL; |
353 }; | 353 }; |
354 | 354 |
355 | 355 |
356 // Context to evaluate expression for its value (and side effects). | 356 // Context to evaluate expression for its value (and side effects). |
357 class AstGraphBuilder::AstValueContext FINAL : public AstContext { | 357 class AstGraphBuilder::AstValueContext FINAL : public AstContext { |
358 public: | 358 public: |
359 explicit AstValueContext(AstGraphBuilder* owner) | 359 explicit AstValueContext(AstGraphBuilder* owner) |
360 : AstContext(owner, Expression::kValue) {} | 360 : AstContext(owner, Expression::kValue) {} |
361 virtual ~AstValueContext(); | 361 ~AstValueContext() FINAL; |
362 void ProduceValue(Node* value) OVERRIDE; | 362 void ProduceValue(Node* value) FINAL; |
363 Node* ConsumeValue() OVERRIDE; | 363 Node* ConsumeValue() FINAL; |
364 }; | 364 }; |
365 | 365 |
366 | 366 |
367 // Context to evaluate expression for a condition value (and side effects). | 367 // Context to evaluate expression for a condition value (and side effects). |
368 class AstGraphBuilder::AstTestContext FINAL : public AstContext { | 368 class AstGraphBuilder::AstTestContext FINAL : public AstContext { |
369 public: | 369 public: |
370 explicit AstTestContext(AstGraphBuilder* owner) | 370 explicit AstTestContext(AstGraphBuilder* owner) |
371 : AstContext(owner, Expression::kTest) {} | 371 : AstContext(owner, Expression::kTest) {} |
372 virtual ~AstTestContext(); | 372 ~AstTestContext() FINAL; |
373 void ProduceValue(Node* value) OVERRIDE; | 373 void ProduceValue(Node* value) FINAL; |
374 Node* ConsumeValue() OVERRIDE; | 374 Node* ConsumeValue() FINAL; |
375 }; | 375 }; |
376 | 376 |
377 | 377 |
378 // Scoped class tracking breakable statements entered by the visitor. Allows to | 378 // Scoped class tracking breakable statements entered by the visitor. Allows to |
379 // properly 'break' and 'continue' iteration statements as well as to 'break' | 379 // properly 'break' and 'continue' iteration statements as well as to 'break' |
380 // from blocks within switch statements. | 380 // from blocks within switch statements. |
381 class AstGraphBuilder::BreakableScope BASE_EMBEDDED { | 381 class AstGraphBuilder::BreakableScope BASE_EMBEDDED { |
382 public: | 382 public: |
383 BreakableScope(AstGraphBuilder* owner, BreakableStatement* target, | 383 BreakableScope(AstGraphBuilder* owner, BreakableStatement* target, |
384 ControlBuilder* control, int drop_extra) | 384 ControlBuilder* control, int drop_extra) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 442 |
443 Scope* AstGraphBuilder::current_scope() const { | 443 Scope* AstGraphBuilder::current_scope() const { |
444 return execution_context_->scope(); | 444 return execution_context_->scope(); |
445 } | 445 } |
446 | 446 |
447 } // namespace compiler | 447 } // namespace compiler |
448 } // namespace internal | 448 } // namespace internal |
449 } // namespace v8 | 449 } // namespace v8 |
450 | 450 |
451 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 451 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ |
OLD | NEW |