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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/compiler/ast-loop-assignment-analyzer.h" | 9 #include "src/compiler/ast-loop-assignment-analyzer.h" |
10 #include "src/compiler/control-builders.h" | 10 #include "src/compiler/control-builders.h" |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
605 if (stack_check) { | 605 if (stack_check) { |
606 Node* node = NewNode(javascript()->StackCheck()); | 606 Node* node = NewNode(javascript()->StackCheck()); |
607 PrepareFrameState(node, BailoutId::FunctionEntry()); | 607 PrepareFrameState(node, BailoutId::FunctionEntry()); |
608 } | 608 } |
609 | 609 |
610 // Visit statements in the function body. | 610 // Visit statements in the function body. |
611 VisitStatements(info()->literal()->body()); | 611 VisitStatements(info()->literal()->body()); |
612 | 612 |
613 // Emit tracing call if requested to do so. | 613 // Emit tracing call if requested to do so. |
614 if (FLAG_trace) { | 614 if (FLAG_trace) { |
615 // TODO(mstarzinger): Only traces implicit return. | 615 // TODO(mstarzinger): Only traces implicit return. |
Michael Starzinger
2016/02/01 18:33:16
Once the below comments about AstGraphBuilder::Bui
Benedikt Meurer
2016/02/02 05:01:41
Done.
| |
616 Node* return_value = jsgraph()->UndefinedConstant(); | 616 Node* return_value = jsgraph()->UndefinedConstant(); |
617 NewNode(javascript()->CallRuntime(Runtime::kTraceExit), return_value); | 617 NewNode(javascript()->CallRuntime(Runtime::kTraceExit), return_value); |
618 } | 618 } |
619 | 619 |
620 // Return 'undefined' in case we can fall off the end. | 620 // Return 'undefined' in case we can fall off the end. |
621 BuildReturn(jsgraph()->UndefinedConstant()); | 621 BuildReturn(jsgraph()->UndefinedConstant()); |
622 } | 622 } |
623 | 623 |
624 | 624 |
625 void AstGraphBuilder::ClearNonLiveSlotsInFrameStates() { | 625 void AstGraphBuilder::ClearNonLiveSlotsInFrameStates() { |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1196 | 1196 |
1197 | 1197 |
1198 void AstGraphBuilder::VisitBreakStatement(BreakStatement* stmt) { | 1198 void AstGraphBuilder::VisitBreakStatement(BreakStatement* stmt) { |
1199 execution_control()->BreakTo(stmt->target()); | 1199 execution_control()->BreakTo(stmt->target()); |
1200 } | 1200 } |
1201 | 1201 |
1202 | 1202 |
1203 void AstGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) { | 1203 void AstGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) { |
1204 VisitForValue(stmt->expression()); | 1204 VisitForValue(stmt->expression()); |
1205 Node* result = environment()->Pop(); | 1205 Node* result = environment()->Pop(); |
1206 if (FLAG_trace) { | |
1207 NewNode(javascript()->CallRuntime(Runtime::kTraceExit), result); | |
Michael Starzinger
2016/02/01 18:33:16
This needs to go into AstGraphBuilder::BuildReturn
Benedikt Meurer
2016/02/02 05:01:41
Done.
| |
1208 } | |
1206 execution_control()->ReturnValue(result); | 1209 execution_control()->ReturnValue(result); |
1207 } | 1210 } |
1208 | 1211 |
1209 | 1212 |
1210 void AstGraphBuilder::VisitWithStatement(WithStatement* stmt) { | 1213 void AstGraphBuilder::VisitWithStatement(WithStatement* stmt) { |
1211 VisitForValue(stmt->expression()); | 1214 VisitForValue(stmt->expression()); |
1212 Node* value = environment()->Pop(); | 1215 Node* value = environment()->Pop(); |
1213 Node* object = BuildToObject(value, stmt->ToObjectId()); | 1216 Node* object = BuildToObject(value, stmt->ToObjectId()); |
1214 const Operator* op = javascript()->CreateWithContext(); | 1217 const Operator* op = javascript()->CreateWithContext(); |
1215 Node* context = NewNode(op, object, GetFunctionClosureForContext()); | 1218 Node* context = NewNode(op, object, GetFunctionClosureForContext()); |
(...skipping 3124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4340 // Phi does not exist yet, introduce one. | 4343 // Phi does not exist yet, introduce one. |
4341 value = NewPhi(inputs, value, control); | 4344 value = NewPhi(inputs, value, control); |
4342 value->ReplaceInput(inputs - 1, other); | 4345 value->ReplaceInput(inputs - 1, other); |
4343 } | 4346 } |
4344 return value; | 4347 return value; |
4345 } | 4348 } |
4346 | 4349 |
4347 } // namespace compiler | 4350 } // namespace compiler |
4348 } // namespace internal | 4351 } // namespace internal |
4349 } // namespace v8 | 4352 } // namespace v8 |
OLD | NEW |