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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 442253002: Add deoptimization translations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing review comments. Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/code-generator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index 3ae5aa4079d78dee54465565f1da2bd2fbf09c64..53c548e8c41f6b62fcbc78cd686ae203fec5b6d1 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -172,9 +172,9 @@ AstGraphBuilder::Environment::Environment(AstGraphBuilder* builder,
parameters_node_(NULL),
locals_node_(NULL),
stack_node_(NULL),
- parameters_dirty_(false),
- locals_dirty_(false),
- stack_dirty_(false) {
+ parameters_dirty_(true),
+ locals_dirty_(true),
+ stack_dirty_(true) {
DCHECK_EQ(scope->num_parameters() + 1, parameters_count());
// Bind the receiver variable.
@@ -210,22 +210,40 @@ AstGraphBuilder::Environment::Environment(const Environment& copy)
Node* AstGraphBuilder::Environment::Checkpoint(BailoutId ast_id) {
- UNIMPLEMENTED(); // TODO(mstarzinger): Implementation below is incomplete.
if (parameters_dirty_) {
- Node** parameters = &values()->front();
- parameters_node_ = graph()->NewNode(NULL, parameters_count(), parameters);
+ Operator* op = common()->StateValues(parameters_count());
+ if (parameters_count() != 0) {
+ Node** parameters = &values()->front();
+ parameters_node_ = graph()->NewNode(op, parameters_count(), parameters);
+ } else {
+ parameters_node_ = graph()->NewNode(op);
+ }
parameters_dirty_ = false;
}
if (locals_dirty_) {
- Node** locals = &values()->at(parameters_count_);
- locals_node_ = graph()->NewNode(NULL, locals_count(), locals);
+ Operator* op = common()->StateValues(locals_count());
+ if (locals_count() != 0) {
+ Node** locals = &values()->at(parameters_count_);
+ locals_node_ = graph()->NewNode(op, locals_count(), locals);
+ } else {
+ locals_node_ = graph()->NewNode(op);
+ }
locals_dirty_ = false;
}
- FrameStateDescriptor descriptor(ast_id);
- // TODO(jarin): add environment to the node.
- Operator* op = common()->FrameState(descriptor);
+ if (stack_dirty_) {
+ Operator* op = common()->StateValues(stack_height());
+ if (stack_height() != 0) {
+ Node** stack = &values()->at(parameters_count_ + locals_count_);
+ stack_node_ = graph()->NewNode(op, stack_height(), stack);
+ } else {
+ stack_node_ = graph()->NewNode(op);
+ }
+ stack_dirty_ = false;
+ }
+
+ Operator* op = common()->FrameState(ast_id);
- return graph()->NewNode(op);
+ return graph()->NewNode(op, parameters_node_, locals_node_, stack_node_);
}
@@ -1963,8 +1981,7 @@ void AstGraphBuilder::BuildLazyBailout(Node* node, BailoutId ast_id) {
NewNode(common()->LazyDeoptimization());
- FrameStateDescriptor stateDescriptor(ast_id);
- Node* state_node = NewNode(common()->FrameState(stateDescriptor));
+ Node* state_node = environment()->Checkpoint(ast_id);
Node* deoptimize_node = NewNode(common()->Deoptimize(), state_node);
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/code-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698