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

Side by Side Diff: src/compiler/ast-graph-builder.h

Issue 1218873005: [turbofan] Context specialization is the job of the JSContextSpecialization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix mini-nit. Created 5 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
« no previous file with comments | « no previous file | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ast.h" 8 #include "src/ast.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/liveness-analyzer.h" 10 #include "src/compiler/liveness-analyzer.h"
(...skipping 17 matching lines...) Expand all
28 // underlying AST. The produced graph can either be compiled into a 28 // underlying AST. The produced graph can either be compiled into a
29 // stand-alone function or be wired into another graph for the purposes 29 // stand-alone function or be wired into another graph for the purposes
30 // of function inlining. 30 // of function inlining.
31 class AstGraphBuilder : public AstVisitor { 31 class AstGraphBuilder : public AstVisitor {
32 public: 32 public:
33 AstGraphBuilder(Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph, 33 AstGraphBuilder(Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph,
34 LoopAssignmentAnalysis* loop_assignment = NULL, 34 LoopAssignmentAnalysis* loop_assignment = NULL,
35 JSTypeFeedbackTable* js_type_feedback = NULL); 35 JSTypeFeedbackTable* js_type_feedback = NULL);
36 36
37 // Creates a graph by visiting the entire AST. 37 // Creates a graph by visiting the entire AST.
38 bool CreateGraph(bool constant_context, bool stack_check = true); 38 bool CreateGraph(bool stack_check = true);
39 39
40 // Helpers to create new control nodes. 40 // Helpers to create new control nodes.
41 Node* NewIfTrue() { return NewNode(common()->IfTrue()); } 41 Node* NewIfTrue() { return NewNode(common()->IfTrue()); }
42 Node* NewIfFalse() { return NewNode(common()->IfFalse()); } 42 Node* NewIfFalse() { return NewNode(common()->IfFalse()); }
43 Node* NewMerge() { return NewNode(common()->Merge(1), true); } 43 Node* NewMerge() { return NewNode(common()->Merge(1), true); }
44 Node* NewLoop() { return NewNode(common()->Loop(1), true); } 44 Node* NewLoop() { return NewNode(common()->Loop(1), true); }
45 Node* NewBranch(Node* condition, BranchHint hint = BranchHint::kNone) { 45 Node* NewBranch(Node* condition, BranchHint hint = BranchHint::kNone) {
46 return NewNode(common()->Branch(hint), condition); 46 return NewNode(common()->Branch(hint), condition);
47 } 47 }
48 48
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 143 }
144 144
145 void set_environment(Environment* env) { environment_ = env; } 145 void set_environment(Environment* env) { environment_ = env; }
146 void set_ast_context(AstContext* ctx) { ast_context_ = ctx; } 146 void set_ast_context(AstContext* ctx) { ast_context_ = ctx; }
147 void set_execution_control(ControlScope* ctrl) { execution_control_ = ctrl; } 147 void set_execution_control(ControlScope* ctrl) { execution_control_ = ctrl; }
148 void set_execution_context(ContextScope* ctx) { execution_context_ = ctx; } 148 void set_execution_context(ContextScope* ctx) { execution_context_ = ctx; }
149 149
150 // Create the main graph body by visiting the AST. 150 // Create the main graph body by visiting the AST.
151 void CreateGraphBody(bool stack_check); 151 void CreateGraphBody(bool stack_check);
152 152
153 // Create the node that represents the outer context of the function.
154 void CreateFunctionContext(bool constant_context);
155
156 // Get or create the node that represents the outer function closure. 153 // Get or create the node that represents the outer function closure.
157 Node* GetFunctionClosureForContext(); 154 Node* GetFunctionClosureForContext();
158 Node* GetFunctionClosure(); 155 Node* GetFunctionClosure();
159 156
157 // Get or create the node that represents the outer function context.
158 Node* GetFunctionContext();
159
160 // Node creation helpers. 160 // Node creation helpers.
161 Node* NewNode(const Operator* op, bool incomplete = false) { 161 Node* NewNode(const Operator* op, bool incomplete = false) {
162 return MakeNode(op, 0, static_cast<Node**>(NULL), incomplete); 162 return MakeNode(op, 0, static_cast<Node**>(NULL), incomplete);
163 } 163 }
164 164
165 Node* NewNode(const Operator* op, Node* n1) { 165 Node* NewNode(const Operator* op, Node* n1) {
166 return MakeNode(op, 1, &n1, false); 166 return MakeNode(op, 1, &n1, false);
167 } 167 }
168 168
169 Node* NewNode(const Operator* op, Node* n1, Node* n2) { 169 Node* NewNode(const Operator* op, Node* n1, Node* n2) {
(...skipping 25 matching lines...) Expand all
195 195
196 Node* NewNode(const Operator* op, int value_input_count, Node** value_inputs, 196 Node* NewNode(const Operator* op, int value_input_count, Node** value_inputs,
197 bool incomplete = false) { 197 bool incomplete = false) {
198 return MakeNode(op, value_input_count, value_inputs, incomplete); 198 return MakeNode(op, value_input_count, value_inputs, incomplete);
199 } 199 }
200 200
201 // Creates a new Phi node having {count} input values. 201 // Creates a new Phi node having {count} input values.
202 Node* NewPhi(int count, Node* input, Node* control); 202 Node* NewPhi(int count, Node* input, Node* control);
203 Node* NewEffectPhi(int count, Node* input, Node* control); 203 Node* NewEffectPhi(int count, Node* input, Node* control);
204 204
205 Node* NewOuterContextParam();
206
207 // Helpers for merging control, effect or value dependencies. 205 // Helpers for merging control, effect or value dependencies.
208 Node* MergeControl(Node* control, Node* other); 206 Node* MergeControl(Node* control, Node* other);
209 Node* MergeEffect(Node* value, Node* other, Node* control); 207 Node* MergeEffect(Node* value, Node* other, Node* control);
210 Node* MergeValue(Node* value, Node* other, Node* control); 208 Node* MergeValue(Node* value, Node* other, Node* control);
211 209
212 // The main node creation chokepoint. Adds context, frame state, effect, 210 // The main node creation chokepoint. Adds context, frame state, effect,
213 // and control dependencies depending on the operator. 211 // and control dependencies depending on the operator.
214 Node* MakeNode(const Operator* op, int value_input_count, Node** value_inputs, 212 Node* MakeNode(const Operator* op, int value_input_count, Node** value_inputs,
215 bool incomplete); 213 bool incomplete);
216 214
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 549
552 // Prepare environment to be used as loop header. 550 // Prepare environment to be used as loop header.
553 void PrepareForLoop(BitVector* assigned, bool is_osr = false); 551 void PrepareForLoop(BitVector* assigned, bool is_osr = false);
554 }; 552 };
555 553
556 } // namespace compiler 554 } // namespace compiler
557 } // namespace internal 555 } // namespace internal
558 } // namespace v8 556 } // namespace v8
559 557
560 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ 558 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698