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

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

Issue 2533283002: [fullcodegen] Remove with-statement support. (Closed)
Patch Set: Created 4 years 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 | « src/compiler/ast-graph-builder.h ('k') | src/full-codegen/full-codegen.h » ('j') | no next file with comments »
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/ast/compile-time-value.h" 7 #include "src/ast/compile-time-value.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/compilation-info.h" 9 #include "src/compilation-info.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 1054
1055 1055
1056 void AstGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) { 1056 void AstGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) {
1057 VisitForValue(stmt->expression()); 1057 VisitForValue(stmt->expression());
1058 Node* result = environment()->Pop(); 1058 Node* result = environment()->Pop();
1059 execution_control()->ReturnValue(result); 1059 execution_control()->ReturnValue(result);
1060 } 1060 }
1061 1061
1062 1062
1063 void AstGraphBuilder::VisitWithStatement(WithStatement* stmt) { 1063 void AstGraphBuilder::VisitWithStatement(WithStatement* stmt) {
1064 VisitForValue(stmt->expression()); 1064 // Dynamic scoping is supported only by going through Ignition first.
1065 Node* value = environment()->Pop(); 1065 UNREACHABLE();
1066 Node* object = BuildToObject(value, stmt->ToObjectId());
1067 Handle<ScopeInfo> scope_info = stmt->scope()->scope_info();
1068 const Operator* op = javascript()->CreateWithContext(scope_info);
1069 Node* context = NewNode(op, object, GetFunctionClosureForContext());
1070 PrepareFrameState(context, stmt->EntryId());
1071 VisitInScope(stmt->statement(), stmt->scope(), context);
1072 } 1066 }
1073 1067
1074 1068
1075 void AstGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) { 1069 void AstGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
1076 ZoneList<CaseClause*>* clauses = stmt->cases(); 1070 ZoneList<CaseClause*>* clauses = stmt->cases();
1077 SwitchBuilder compare_switch(this, clauses->length()); 1071 SwitchBuilder compare_switch(this, clauses->length());
1078 ControlScopeForBreakable scope(this, stmt, &compare_switch); 1072 ControlScopeForBreakable scope(this, stmt, &compare_switch);
1079 compare_switch.BeginSwitch(); 1073 compare_switch.BeginSwitch();
1080 int default_index = -1; 1074 int default_index = -1;
1081 1075
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
2468 globals()->clear(); 2462 globals()->clear();
2469 } 2463 }
2470 2464
2471 2465
2472 void AstGraphBuilder::VisitIfNotNull(Statement* stmt) { 2466 void AstGraphBuilder::VisitIfNotNull(Statement* stmt) {
2473 if (stmt == nullptr) return; 2467 if (stmt == nullptr) return;
2474 Visit(stmt); 2468 Visit(stmt);
2475 } 2469 }
2476 2470
2477 2471
2478 void AstGraphBuilder::VisitInScope(Statement* stmt, Scope* s, Node* context) {
2479 ContextScope scope(this, s, context);
2480 DCHECK(s->declarations()->is_empty());
2481 Visit(stmt);
2482 }
2483
2484 void AstGraphBuilder::VisitIterationBody(IterationStatement* stmt, 2472 void AstGraphBuilder::VisitIterationBody(IterationStatement* stmt,
2485 LoopBuilder* loop, 2473 LoopBuilder* loop,
2486 BailoutId stack_check_id) { 2474 BailoutId stack_check_id) {
2487 ControlScopeForIteration scope(this, stmt, loop); 2475 ControlScopeForIteration scope(this, stmt, loop);
2488 if (FLAG_turbo_loop_stackcheck || !info()->shared_info()->asm_function()) { 2476 if (FLAG_turbo_loop_stackcheck || !info()->shared_info()->asm_function()) {
2489 Node* node = NewNode(javascript()->StackCheck()); 2477 Node* node = NewNode(javascript()->StackCheck());
2490 PrepareFrameState(node, stack_check_id); 2478 PrepareFrameState(node, stack_check_id);
2491 } 2479 }
2492 Visit(stmt->body()); 2480 Visit(stmt->body());
2493 } 2481 }
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
3633 float invocation_frequency, LoopAssignmentAnalysis* loop_assignment, 3621 float invocation_frequency, LoopAssignmentAnalysis* loop_assignment,
3634 SourcePositionTable* source_positions, int inlining_id) 3622 SourcePositionTable* source_positions, int inlining_id)
3635 : AstGraphBuilder(local_zone, info, jsgraph, invocation_frequency, 3623 : AstGraphBuilder(local_zone, info, jsgraph, invocation_frequency,
3636 loop_assignment), 3624 loop_assignment),
3637 source_positions_(source_positions), 3625 source_positions_(source_positions),
3638 start_position_(info->shared_info()->start_position(), inlining_id) {} 3626 start_position_(info->shared_info()->start_position(), inlining_id) {}
3639 3627
3640 } // namespace compiler 3628 } // namespace compiler
3641 } // namespace internal 3629 } // namespace internal
3642 } // namespace v8 3630 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/full-codegen/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698