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

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

Issue 929123002: Move DeadControl into the JSGraph so that it can be reused. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 ContextScope* execution_context_; 87 ContextScope* execution_context_;
88 88
89 // Nodes representing values in the activation record. 89 // Nodes representing values in the activation record.
90 SetOncePointer<Node> function_closure_; 90 SetOncePointer<Node> function_closure_;
91 SetOncePointer<Node> function_context_; 91 SetOncePointer<Node> function_context_;
92 92
93 // Temporary storage for building node input lists. 93 // Temporary storage for building node input lists.
94 int input_buffer_size_; 94 int input_buffer_size_;
95 Node** input_buffer_; 95 Node** input_buffer_;
96 96
97 // Node representing the control dependency for dead code.
98 SetOncePointer<Node> dead_control_;
99
100 // Merge of all control nodes that exit the function body. 97 // Merge of all control nodes that exit the function body.
101 Node* exit_control_; 98 Node* exit_control_;
102 99
103 // Result of loop assignment analysis performed before graph creation. 100 // Result of loop assignment analysis performed before graph creation.
104 LoopAssignmentAnalysis* loop_assignment_analysis_; 101 LoopAssignmentAnalysis* loop_assignment_analysis_;
105 102
106 // Growth increment for the temporary buffer used to construct input lists to 103 // Growth increment for the temporary buffer used to construct input lists to
107 // new nodes. 104 // new nodes.
108 static const int kInputBufferSizeIncrement = 64; 105 static const int kInputBufferSizeIncrement = 64;
109 106
110 Zone* local_zone() const { return local_zone_; } 107 Zone* local_zone() const { return local_zone_; }
111 Environment* environment() { return environment_; } 108 Environment* environment() { return environment_; }
112 AstContext* ast_context() const { return ast_context_; } 109 AstContext* ast_context() const { return ast_context_; }
113 ControlScope* execution_control() const { return execution_control_; } 110 ControlScope* execution_control() const { return execution_control_; }
114 ContextScope* execution_context() const { return execution_context_; } 111 ContextScope* execution_context() const { return execution_context_; }
115 CommonOperatorBuilder* common() const { return jsgraph_->common(); } 112 CommonOperatorBuilder* common() const { return jsgraph_->common(); }
116 CompilationInfo* info() const { return info_; } 113 CompilationInfo* info() const { return info_; }
117 LanguageMode language_mode() const; 114 LanguageMode language_mode() const;
118 JSGraph* jsgraph() { return jsgraph_; } 115 JSGraph* jsgraph() { return jsgraph_; }
119 Graph* graph() { return jsgraph_->graph(); } 116 Graph* graph() { return jsgraph_->graph(); }
120 Zone* graph_zone() { return graph()->zone(); } 117 Zone* graph_zone() { return graph()->zone(); }
121 JSOperatorBuilder* javascript() { return jsgraph_->javascript(); } 118 JSOperatorBuilder* javascript() { return jsgraph_->javascript(); }
122 ZoneVector<Handle<Object>>* globals() { return &globals_; } 119 ZoneVector<Handle<Object>>* globals() { return &globals_; }
123 Scope* current_scope() const; 120 Scope* current_scope() const;
124 Node* current_context() const; 121 Node* current_context() const;
125 Node* dead_control();
126 Node* exit_control() const { return exit_control_; } 122 Node* exit_control() const { return exit_control_; }
127 123
128 void set_environment(Environment* env) { environment_ = env; } 124 void set_environment(Environment* env) { environment_ = env; }
129 void set_ast_context(AstContext* ctx) { ast_context_ = ctx; } 125 void set_ast_context(AstContext* ctx) { ast_context_ = ctx; }
130 void set_execution_control(ControlScope* ctrl) { execution_control_ = ctrl; } 126 void set_execution_control(ControlScope* ctrl) { execution_control_ = ctrl; }
131 void set_execution_context(ContextScope* ctx) { execution_context_ = ctx; } 127 void set_execution_context(ContextScope* ctx) { execution_context_ = ctx; }
132 void set_exit_control(Node* exit) { exit_control_ = exit; } 128 void set_exit_control(Node* exit) { exit_control_ = exit; }
133 129
134 // Node creation helpers. 130 // Node creation helpers.
135 Node* NewNode(const Operator* op, bool incomplete = false) { 131 Node* NewNode(const Operator* op, bool incomplete = false) {
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 } 400 }
405 401
406 // Effect dependency tracked by this environment. 402 // Effect dependency tracked by this environment.
407 Node* GetEffectDependency() { return effect_dependency_; } 403 Node* GetEffectDependency() { return effect_dependency_; }
408 void UpdateEffectDependency(Node* dependency) { 404 void UpdateEffectDependency(Node* dependency) {
409 effect_dependency_ = dependency; 405 effect_dependency_ = dependency;
410 } 406 }
411 407
412 // Mark this environment as being unreachable. 408 // Mark this environment as being unreachable.
413 void MarkAsUnreachable() { 409 void MarkAsUnreachable() {
414 UpdateControlDependency(builder()->dead_control()); 410 UpdateControlDependency(builder()->jsgraph()->DeadControl());
415 } 411 }
416 bool IsMarkedAsUnreachable() { 412 bool IsMarkedAsUnreachable() {
417 return GetControlDependency()->opcode() == IrOpcode::kDead; 413 return GetControlDependency()->opcode() == IrOpcode::kDead;
418 } 414 }
419 415
420 // Merge another environment into this one. 416 // Merge another environment into this one.
421 void Merge(Environment* other); 417 void Merge(Environment* other);
422 418
423 // Copies this environment at a control-flow split point. 419 // Copies this environment at a control-flow split point.
424 Environment* CopyForConditional() { return Copy(); } 420 Environment* CopyForConditional() { return Copy(); }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 454
459 // Prepare environment to be used as loop header. 455 // Prepare environment to be used as loop header.
460 void PrepareForLoop(BitVector* assigned, bool is_osr = false); 456 void PrepareForLoop(BitVector* assigned, bool is_osr = false);
461 }; 457 };
462 458
463 } // namespace compiler 459 } // namespace compiler
464 } // namespace internal 460 } // namespace internal
465 } // namespace v8 461 } // namespace v8
466 462
467 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ 463 #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