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

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

Issue 1962723002: [turbofan] Implement top-level lookup slot declaration. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Skip timeouts. Created 4 years, 7 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 | « no previous file | src/full-codegen/arm/full-codegen-arm.cc » ('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 36a0ecea8dcaba5dbf79d390e13a4eda544b9e73..c89be45623c9d239873992d2feba39727163c1b6 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -1114,10 +1114,22 @@ void AstGraphBuilder::VisitVariableDeclaration(VariableDeclaration* decl) {
NewNode(op, current_context(), value);
}
break;
- case VariableLocation::LOOKUP:
- // TODO(mstarzinger): Implement this case.
- SetStackOverflow();
+ case VariableLocation::LOOKUP: {
+ Node* name = jsgraph()->Constant(variable->name());
+ // For variables we must not push an initial value (such as 'undefined')
+ // because we may have a (legal) redeclaration and we must not destroy
+ // the current value.
+ Node* value =
+ hole_init ? jsgraph()->TheHoleConstant()
+ : jsgraph()->ZeroConstant(); // Indicates no initial value.
+ Node* attr =
+ jsgraph()->Constant(variable->DeclarationPropertyAttributes());
+ const Operator* op =
+ javascript()->CallRuntime(Runtime::kDeclareLookupSlot);
+ Node* store = NewNode(op, name, value, attr);
+ PrepareFrameState(store, decl->proxy()->id());
break;
+ }
}
}
@@ -1149,10 +1161,18 @@ void AstGraphBuilder::VisitFunctionDeclaration(FunctionDeclaration* decl) {
NewNode(op, current_context(), value);
break;
}
- case VariableLocation::LOOKUP:
- // TODO(mstarzinger): Implement this case.
- SetStackOverflow();
+ case VariableLocation::LOOKUP: {
+ VisitForValue(decl->fun());
+ Node* value = environment()->Pop();
+ Node* name = jsgraph()->Constant(variable->name());
+ Node* attr =
+ jsgraph()->Constant(variable->DeclarationPropertyAttributes());
+ const Operator* op =
+ javascript()->CallRuntime(Runtime::kDeclareLookupSlot);
+ Node* store = NewNode(op, name, value, attr);
+ PrepareFrameState(store, decl->proxy()->id());
break;
+ }
}
}
« no previous file with comments | « no previous file | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698