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

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

Issue 1399893002: [es7] implement |do| expressions proposal (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix AST numbering issue + add simple TF impl Created 5 years, 2 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
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index f2e10ecfe5354e71c159f151c40dd48fccfb48a7..8e98ea4d04f71c0f4180685eb87091ac90aa47db 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -1657,6 +1657,28 @@ void AstGraphBuilder::VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) {
}
+void AstGraphBuilder::VisitDoExpression(DoExpression* expr) {
+ BlockBuilder block(this);
+ ControlScopeForBreakable scope(
+ this, reinterpret_cast<BreakableStatement*>(expr), &block);
+ // Visit declarations and statements in a block scope.
+ if (expr->scope()->NeedsContext()) {
+ Node* context = BuildLocalBlockContext(expr->scope());
+ ContextScope scope(this, expr->scope(), context);
+ VisitDeclarations(expr->scope()->declarations());
+ VisitStatements(expr->statements());
+ } else {
+ VisitDeclarations(expr->scope()->declarations());
+ VisitStatements(expr->statements());
+ }
+ if (expr->result()->is_assigned()) {
rossberg 2015/10/12 13:52:39 It's better to avoid this case distinction in back
caitp (gmail) 2015/10/12 18:22:59 Done. It seems like it could potentially save a b
rossberg 2015/10/13 10:44:32 Such an optimsation comes for free with SSA form.
+ VisitVariableProxy(expr->result());
+ } else {
+ ast_context()->ProduceValue(jsgraph()->UndefinedConstant());
+ }
+}
+
+
void AstGraphBuilder::VisitConditional(Conditional* expr) {
IfBuilder compare_if(this);
VisitForTest(expr->condition());

Powered by Google App Engine
This is Rietveld 408576698