| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_CONTROL_BUILDERS_H_ | 5 #ifndef V8_COMPILER_CONTROL_BUILDERS_H_ |
| 6 #define V8_COMPILER_CONTROL_BUILDERS_H_ | 6 #define V8_COMPILER_CONTROL_BUILDERS_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/compiler/graph-builder.h" | 10 #include "src/compiler/graph-builder.h" |
| 11 #include "src/compiler/node.h" | 11 #include "src/compiler/node.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 namespace compiler { | 15 namespace compiler { |
| 16 | 16 |
| 17 | |
| 18 // Base class for all control builders. Also provides a common interface for | 17 // Base class for all control builders. Also provides a common interface for |
| 19 // control builders to handle 'break' and 'continue' statements when they are | 18 // control builders to handle 'break' and 'continue' statements when they are |
| 20 // used to model breakable statements. | 19 // used to model breakable statements. |
| 21 class ControlBuilder { | 20 class ControlBuilder { |
| 22 public: | 21 public: |
| 23 explicit ControlBuilder(StructuredGraphBuilder* builder) | 22 explicit ControlBuilder(StructuredGraphBuilder* builder) |
| 24 : builder_(builder) {} | 23 : builder_(builder) {} |
| 25 virtual ~ControlBuilder() {} | 24 virtual ~ControlBuilder() {} |
| 26 | 25 |
| 27 // Interface for break and continue. | 26 // Interface for break and continue. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 42 | 41 |
| 43 // Tracks control flow for a conditional statement. | 42 // Tracks control flow for a conditional statement. |
| 44 class IfBuilder : public ControlBuilder { | 43 class IfBuilder : public ControlBuilder { |
| 45 public: | 44 public: |
| 46 explicit IfBuilder(StructuredGraphBuilder* builder) | 45 explicit IfBuilder(StructuredGraphBuilder* builder) |
| 47 : ControlBuilder(builder), | 46 : ControlBuilder(builder), |
| 48 then_environment_(NULL), | 47 then_environment_(NULL), |
| 49 else_environment_(NULL) {} | 48 else_environment_(NULL) {} |
| 50 | 49 |
| 51 // Primitive control commands. | 50 // Primitive control commands. |
| 52 void If(Node* condition); | 51 void If(Node* condition, BranchHint hint = BranchHint::kNone); |
| 53 void Then(); | 52 void Then(); |
| 54 void Else(); | 53 void Else(); |
| 55 void End(); | 54 void End(); |
| 56 | 55 |
| 57 private: | 56 private: |
| 58 Environment* then_environment_; // Environment after the 'then' body. | 57 Environment* then_environment_; // Environment after the 'then' body. |
| 59 Environment* else_environment_; // Environment for the 'else' body. | 58 Environment* else_environment_; // Environment for the 'else' body. |
| 60 }; | 59 }; |
| 61 | 60 |
| 62 | 61 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 virtual void Break(); | 134 virtual void Break(); |
| 136 | 135 |
| 137 private: | 136 private: |
| 138 Environment* break_environment_; // Environment after the block exits. | 137 Environment* break_environment_; // Environment after the block exits. |
| 139 }; | 138 }; |
| 140 } | 139 } |
| 141 } | 140 } |
| 142 } // namespace v8::internal::compiler | 141 } // namespace v8::internal::compiler |
| 143 | 142 |
| 144 #endif // V8_COMPILER_CONTROL_BUILDERS_H_ | 143 #endif // V8_COMPILER_CONTROL_BUILDERS_H_ |
| OLD | NEW |