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

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

Issue 517323002: Make FrameStates recursive (to be used for inlining). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix bug in GetParentCount Created 6 years, 3 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 | Annotate | Revision Log
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 #include "src/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/control-builders.h" 8 #include "src/compiler/control-builders.h"
9 #include "src/compiler/machine-operator.h" 9 #include "src/compiler/machine-operator.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 210 }
211 } 211 }
212 } 212 }
213 if (should_update) { 213 if (should_update) {
214 Operator* op = common()->StateValues(count); 214 Operator* op = common()->StateValues(count);
215 (*state_values) = graph()->NewNode(op, count, env_values); 215 (*state_values) = graph()->NewNode(op, count, env_values);
216 } 216 }
217 } 217 }
218 218
219 219
220 Node* AstGraphBuilder::Environment::Checkpoint(BailoutId ast_id) { 220 Node* AstGraphBuilder::Environment::Checkpoint(BailoutId ast_id, Node* parent) {
221 UpdateStateValues(&parameters_node_, 0, parameters_count()); 221 UpdateStateValues(&parameters_node_, 0, parameters_count());
222 UpdateStateValues(&locals_node_, parameters_count(), locals_count()); 222 UpdateStateValues(&locals_node_, parameters_count(), locals_count());
223 UpdateStateValues(&stack_node_, parameters_count() + locals_count(), 223 UpdateStateValues(&stack_node_, parameters_count() + locals_count(),
224 stack_height()); 224 stack_height());
225 225
226 Operator* op = common()->FrameState(ast_id); 226 Operator* op = common()->FrameState(ast_id);
227 227
228 return graph()->NewNode(op, parameters_node_, locals_node_, stack_node_); 228 return graph()->NewNode(op, parameters_node_, locals_node_, stack_node_,
229 parent);
229 } 230 }
230 231
231 232
232 AstGraphBuilder::AstContext::AstContext(AstGraphBuilder* own, 233 AstGraphBuilder::AstContext::AstContext(AstGraphBuilder* own,
233 Expression::Context kind) 234 Expression::Context kind)
234 : kind_(kind), owner_(own), outer_(own->ast_context()) { 235 : kind_(kind), owner_(own), outer_(own->ast_context()) {
235 owner()->set_ast_context(this); // Push. 236 owner()->set_ast_context(this); // Push.
236 #ifdef DEBUG 237 #ifdef DEBUG
237 original_height_ = environment()->stack_height(); 238 original_height_ = environment()->stack_height();
238 #endif 239 #endif
(...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after
2002 } 2003 }
2003 2004
2004 2005
2005 void AstGraphBuilder::PrepareFrameState(Node* node, BailoutId ast_id, 2006 void AstGraphBuilder::PrepareFrameState(Node* node, BailoutId ast_id,
2006 OutputFrameStateCombine combine) { 2007 OutputFrameStateCombine combine) {
2007 if (OperatorProperties::HasFrameStateInput(node->op())) { 2008 if (OperatorProperties::HasFrameStateInput(node->op())) {
2008 int frame_state_index = NodeProperties::GetFrameStateIndex(node); 2009 int frame_state_index = NodeProperties::GetFrameStateIndex(node);
2009 2010
2010 DCHECK(node->InputAt(frame_state_index)->op()->opcode() == IrOpcode::kDead); 2011 DCHECK(node->InputAt(frame_state_index)->op()->opcode() == IrOpcode::kDead);
2011 2012
2012 Node* frame_state_node = environment()->Checkpoint(ast_id); 2013 Node* frame_state_node =
2014 environment()->Checkpoint(ast_id, jsgraph()->UndefinedConstant());
2013 node->ReplaceInput(frame_state_index, frame_state_node); 2015 node->ReplaceInput(frame_state_index, frame_state_node);
2014 } 2016 }
2015 2017
2016 if (OperatorProperties::CanLazilyDeoptimize(node->op())) { 2018 if (OperatorProperties::CanLazilyDeoptimize(node->op())) {
2017 // The deopting node should have an outgoing control dependency. 2019 // The deopting node should have an outgoing control dependency.
2018 DCHECK(environment()->GetControlDependency() == node); 2020 DCHECK(environment()->GetControlDependency() == node);
2019 2021
2020 StructuredGraphBuilder::Environment* continuation_env = environment(); 2022 StructuredGraphBuilder::Environment* continuation_env = environment();
2021 // Create environment for the deoptimization block, and build the block. 2023 // Create environment for the deoptimization block, and build the block.
2022 StructuredGraphBuilder::Environment* deopt_env = 2024 StructuredGraphBuilder::Environment* deopt_env =
2023 CopyEnvironment(continuation_env); 2025 CopyEnvironment(continuation_env);
2024 set_environment(deopt_env); 2026 set_environment(deopt_env);
2025 2027
2026 if (combine == PUSH_OUTPUT) { 2028 if (combine == PUSH_OUTPUT) {
2027 environment()->Push(node); 2029 environment()->Push(node);
2028 } 2030 }
2029 2031
2030 NewNode(common()->LazyDeoptimization()); 2032 NewNode(common()->LazyDeoptimization());
2031 2033
2032 // TODO(jarin) If ast_id.IsNone(), perhaps we should generate an empty 2034 // TODO(jarin) If ast_id.IsNone(), perhaps we should generate an empty
2033 // deopt block and make sure there is no patch entry for this (so 2035 // deopt block and make sure there is no patch entry for this (so
2034 // that the deoptimizer dies when trying to deoptimize here). 2036 // that the deoptimizer dies when trying to deoptimize here).
2035 Node* state_node = environment()->Checkpoint(ast_id); 2037 Node* state_node =
2038 environment()->Checkpoint(ast_id, jsgraph()->UndefinedConstant());
2036 Node* deoptimize_node = NewNode(common()->Deoptimize(), state_node); 2039 Node* deoptimize_node = NewNode(common()->Deoptimize(), state_node);
2037 UpdateControlDependencyToLeaveFunction(deoptimize_node); 2040 UpdateControlDependencyToLeaveFunction(deoptimize_node);
2038 2041
2039 // Continue with the original environment. 2042 // Continue with the original environment.
2040 set_environment(continuation_env); 2043 set_environment(continuation_env);
2041 NewNode(common()->Continuation()); 2044 NewNode(common()->Continuation());
2042 } 2045 }
2043 } 2046 }
2044 2047
2045 } 2048 }
2046 } 2049 }
2047 } // namespace v8::internal::compiler 2050 } // namespace v8::internal::compiler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698