Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/compiler/control-builders.h

Issue 2140673007: [turbofan] Introduce explicit loop exits markers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/compiler/ast-graph-builder.h" 8 #include "src/compiler/ast-graph-builder.h"
9 #include "src/compiler/node.h" 9 #include "src/compiler/node.h"
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 }; 56 };
57 57
58 58
59 // Tracks control flow for an iteration statement. 59 // Tracks control flow for an iteration statement.
60 class LoopBuilder final : public ControlBuilder { 60 class LoopBuilder final : public ControlBuilder {
61 public: 61 public:
62 explicit LoopBuilder(AstGraphBuilder* builder) 62 explicit LoopBuilder(AstGraphBuilder* builder)
63 : ControlBuilder(builder), 63 : ControlBuilder(builder),
64 loop_environment_(nullptr), 64 loop_environment_(nullptr),
65 continue_environment_(nullptr), 65 continue_environment_(nullptr),
66 break_environment_(nullptr) {} 66 break_environment_(nullptr),
67 assigned_(nullptr) {}
67 68
68 // Primitive control commands. 69 // Primitive control commands.
69 void BeginLoop(BitVector* assigned, bool is_osr = false); 70 void BeginLoop(BitVector* assigned, bool is_osr = false);
70 void Continue(); 71 void Continue();
71 void EndBody(); 72 void EndBody();
72 void EndLoop(); 73 void EndLoop();
73 74
74 // Primitive support for break. 75 // Primitive support for break.
75 void Break() final; 76 void Break() final;
76 77
78 // Loop exit support. Used to introduce explicit loop exit control
79 // node and variable markers.
80 void ExitLoop(Node** extra_value_to_rename = nullptr);
81
77 // Compound control commands for conditional break. 82 // Compound control commands for conditional break.
78 void BreakUnless(Node* condition); 83 void BreakUnless(Node* condition);
79 void BreakWhen(Node* condition); 84 void BreakWhen(Node* condition);
80 85
81 private: 86 private:
82 Environment* loop_environment_; // Environment of the loop header. 87 Environment* loop_environment_; // Environment of the loop header.
83 Environment* continue_environment_; // Environment after the loop body. 88 Environment* continue_environment_; // Environment after the loop body.
84 Environment* break_environment_; // Environment after the loop exits. 89 Environment* break_environment_; // Environment after the loop exits.
90 BitVector* assigned_; // Assigned values in the environment.
85 }; 91 };
86 92
87 93
88 // Tracks control flow for a switch statement. 94 // Tracks control flow for a switch statement.
89 class SwitchBuilder final : public ControlBuilder { 95 class SwitchBuilder final : public ControlBuilder {
90 public: 96 public:
91 explicit SwitchBuilder(AstGraphBuilder* builder, int case_count) 97 explicit SwitchBuilder(AstGraphBuilder* builder, int case_count)
92 : ControlBuilder(builder), 98 : ControlBuilder(builder),
93 body_environment_(nullptr), 99 body_environment_(nullptr),
94 label_environment_(nullptr), 100 label_environment_(nullptr),
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 Environment* finally_environment_; // Environment for the 'finally' body. 196 Environment* finally_environment_; // Environment for the 'finally' body.
191 Node* token_node_; // Node for token in 'finally' body. 197 Node* token_node_; // Node for token in 'finally' body.
192 Node* value_node_; // Node for value in 'finally' body. 198 Node* value_node_; // Node for value in 'finally' body.
193 }; 199 };
194 200
195 } // namespace compiler 201 } // namespace compiler
196 } // namespace internal 202 } // namespace internal
197 } // namespace v8 203 } // namespace v8
198 204
199 #endif // V8_COMPILER_CONTROL_BUILDERS_H_ 205 #endif // V8_COMPILER_CONTROL_BUILDERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698