OLD | NEW |
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/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 void AstGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) { | 1192 void AstGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) { |
1193 VisitForValue(stmt->expression()); | 1193 VisitForValue(stmt->expression()); |
1194 Node* result = environment()->Pop(); | 1194 Node* result = environment()->Pop(); |
1195 execution_control()->ReturnValue(result); | 1195 execution_control()->ReturnValue(result); |
1196 } | 1196 } |
1197 | 1197 |
1198 | 1198 |
1199 void AstGraphBuilder::VisitWithStatement(WithStatement* stmt) { | 1199 void AstGraphBuilder::VisitWithStatement(WithStatement* stmt) { |
1200 VisitForValue(stmt->expression()); | 1200 VisitForValue(stmt->expression()); |
1201 Node* value = environment()->Pop(); | 1201 Node* value = environment()->Pop(); |
| 1202 Node* object = BuildToObject(value, stmt->ToObjectId()); |
1202 const Operator* op = javascript()->CreateWithContext(); | 1203 const Operator* op = javascript()->CreateWithContext(); |
1203 Node* context = NewNode(op, value, GetFunctionClosureForContext()); | 1204 Node* context = NewNode(op, object, GetFunctionClosureForContext()); |
1204 PrepareFrameState(context, stmt->EntryId()); | 1205 PrepareFrameState(context, stmt->EntryId()); |
1205 VisitInScope(stmt->statement(), stmt->scope(), context); | 1206 VisitInScope(stmt->statement(), stmt->scope(), context); |
1206 } | 1207 } |
1207 | 1208 |
1208 | 1209 |
1209 void AstGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) { | 1210 void AstGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) { |
1210 ZoneList<CaseClause*>* clauses = stmt->cases(); | 1211 ZoneList<CaseClause*>* clauses = stmt->cases(); |
1211 SwitchBuilder compare_switch(this, clauses->length()); | 1212 SwitchBuilder compare_switch(this, clauses->length()); |
1212 ControlScopeForBreakable scope(this, stmt, &compare_switch); | 1213 ControlScopeForBreakable scope(this, stmt, &compare_switch); |
1213 compare_switch.BeginSwitch(); | 1214 compare_switch.BeginSwitch(); |
(...skipping 3090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4304 // Phi does not exist yet, introduce one. | 4305 // Phi does not exist yet, introduce one. |
4305 value = NewPhi(inputs, value, control); | 4306 value = NewPhi(inputs, value, control); |
4306 value->ReplaceInput(inputs - 1, other); | 4307 value->ReplaceInput(inputs - 1, other); |
4307 } | 4308 } |
4308 return value; | 4309 return value; |
4309 } | 4310 } |
4310 | 4311 |
4311 } // namespace compiler | 4312 } // namespace compiler |
4312 } // namespace internal | 4313 } // namespace internal |
4313 } // namespace v8 | 4314 } // namespace v8 |
OLD | NEW |