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

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

Issue 981203003: Stack allocate lexical locals + hoist stack slots (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cleanup Created 5 years, 8 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/full-codegen.h » ('j') | src/parser.cc » ('J')
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 #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/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/js-type-feedback.h" 10 #include "src/compiler/js-type-feedback.h"
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 998
999 void AstGraphBuilder::VisitBlock(Block* stmt) { 999 void AstGraphBuilder::VisitBlock(Block* stmt) {
1000 BlockBuilder block(this); 1000 BlockBuilder block(this);
1001 ControlScopeForBreakable scope(this, stmt, &block); 1001 ControlScopeForBreakable scope(this, stmt, &block);
1002 if (stmt->labels() != NULL) block.BeginBlock(); 1002 if (stmt->labels() != NULL) block.BeginBlock();
1003 if (stmt->scope() == NULL) { 1003 if (stmt->scope() == NULL) {
1004 // Visit statements in the same scope, no declarations. 1004 // Visit statements in the same scope, no declarations.
1005 VisitStatements(stmt->statements()); 1005 VisitStatements(stmt->statements());
1006 } else { 1006 } else {
1007 // Visit declarations and statements in a block scope. 1007 // Visit declarations and statements in a block scope.
1008 Node* context = BuildLocalBlockContext(stmt->scope()); 1008 if (stmt->scope()->ContextLocalCount() > 0) {
1009 ContextScope scope(this, stmt->scope(), context); 1009 Node* context = BuildLocalBlockContext(stmt->scope());
1010 VisitDeclarations(stmt->scope()->declarations()); 1010 ContextScope scope(this, stmt->scope(), context);
1011 VisitStatements(stmt->statements()); 1011 VisitDeclarations(stmt->scope()->declarations());
1012 VisitStatements(stmt->statements());
1013 } else {
1014 VisitDeclarations(stmt->scope()->declarations());
1015 VisitStatements(stmt->statements());
1016 }
1012 } 1017 }
1013 if (stmt->labels() != NULL) block.EndBlock(); 1018 if (stmt->labels() != NULL) block.EndBlock();
1014 } 1019 }
1015 1020
1016 1021
1017 void AstGraphBuilder::VisitModuleStatement(ModuleStatement* stmt) { 1022 void AstGraphBuilder::VisitModuleStatement(ModuleStatement* stmt) {
1018 UNREACHABLE(); 1023 UNREACHABLE();
1019 } 1024 }
1020 1025
1021 1026
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 ast_context()->ProduceValue(value); 1461 ast_context()->ProduceValue(value);
1457 } 1462 }
1458 1463
1459 1464
1460 void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) { 1465 void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) {
1461 if (expr->scope() == NULL) { 1466 if (expr->scope() == NULL) {
1462 // Visit class literal in the same scope, no declarations. 1467 // Visit class literal in the same scope, no declarations.
1463 VisitClassLiteralContents(expr); 1468 VisitClassLiteralContents(expr);
1464 } else { 1469 } else {
1465 // Visit declarations and class literal in a block scope. 1470 // Visit declarations and class literal in a block scope.
1466 Node* context = BuildLocalBlockContext(expr->scope()); 1471 if (expr->scope()->ContextLocalCount() > 0) {
1467 ContextScope scope(this, expr->scope(), context); 1472 Node* context = BuildLocalBlockContext(expr->scope());
1468 VisitDeclarations(expr->scope()->declarations()); 1473 ContextScope scope(this, expr->scope(), context);
1469 VisitClassLiteralContents(expr); 1474 VisitDeclarations(expr->scope()->declarations());
1475 VisitClassLiteralContents(expr);
1476 } else {
1477 VisitDeclarations(expr->scope()->declarations());
1478 VisitClassLiteralContents(expr);
1479 }
1470 } 1480 }
1471 } 1481 }
1472 1482
1473 1483
1474 void AstGraphBuilder::VisitClassLiteralContents(ClassLiteral* expr) { 1484 void AstGraphBuilder::VisitClassLiteralContents(ClassLiteral* expr) {
1475 Node* class_name = expr->raw_name() ? jsgraph()->Constant(expr->name()) 1485 Node* class_name = expr->raw_name() ? jsgraph()->Constant(expr->name())
1476 : jsgraph()->UndefinedConstant(); 1486 : jsgraph()->UndefinedConstant();
1477 1487
1478 // The class name is expected on the operand stack. 1488 // The class name is expected on the operand stack.
1479 environment()->Push(class_name); 1489 environment()->Push(class_name);
(...skipping 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after
3550 // Phi does not exist yet, introduce one. 3560 // Phi does not exist yet, introduce one.
3551 value = NewPhi(inputs, value, control); 3561 value = NewPhi(inputs, value, control);
3552 value->ReplaceInput(inputs - 1, other); 3562 value->ReplaceInput(inputs - 1, other);
3553 } 3563 }
3554 return value; 3564 return value;
3555 } 3565 }
3556 3566
3557 } // namespace compiler 3567 } // namespace compiler
3558 } // namespace internal 3568 } // namespace internal
3559 } // namespace v8 3569 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/full-codegen.h » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698