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/machine-operator.h" | 11 #include "src/compiler/machine-operator.h" |
11 #include "src/compiler/node-matchers.h" | 12 #include "src/compiler/node-matchers.h" |
12 #include "src/compiler/node-properties.h" | 13 #include "src/compiler/node-properties.h" |
13 #include "src/compiler/operator-properties.h" | 14 #include "src/compiler/operator-properties.h" |
14 #include "src/full-codegen.h" | 15 #include "src/full-codegen.h" |
15 #include "src/parser.h" | 16 #include "src/parser.h" |
16 #include "src/scopes.h" | 17 #include "src/scopes.h" |
17 | 18 |
18 namespace v8 { | 19 namespace v8 { |
19 namespace internal { | 20 namespace internal { |
20 namespace compiler { | 21 namespace compiler { |
21 | 22 |
22 AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info, | 23 AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info, |
23 JSGraph* jsgraph, LoopAssignmentAnalysis* loop) | 24 JSGraph* jsgraph, LoopAssignmentAnalysis* loop) |
24 : StructuredGraphBuilder(jsgraph->isolate(), local_zone, jsgraph->graph(), | 25 : StructuredGraphBuilder(jsgraph->isolate(), local_zone, jsgraph->graph(), |
25 jsgraph->common()), | 26 jsgraph->common()), |
26 info_(info), | 27 info_(info), |
27 jsgraph_(jsgraph), | 28 jsgraph_(jsgraph), |
28 globals_(0, local_zone), | 29 globals_(0, local_zone), |
29 breakable_(NULL), | 30 breakable_(NULL), |
30 execution_context_(NULL), | 31 execution_context_(NULL), |
31 loop_assignment_analysis_(loop) { | 32 loop_assignment_analysis_(loop) { |
32 InitializeAstVisitor(info->isolate(), local_zone); | 33 InitializeAstVisitor(info->isolate(), local_zone); |
33 } | 34 } |
34 | 35 |
35 | 36 |
36 Node* AstGraphBuilder::GetFunctionClosure() { | 37 Node* AstGraphBuilder::GetFunctionClosure() { |
37 if (!function_closure_.is_set()) { | 38 if (!function_closure_.is_set()) { |
38 // Parameter -1 is special for the function closure | 39 const Operator* op = |
39 const Operator* op = common()->Parameter(-1); | 40 common()->Parameter(Linkage::kJSFunctionCallClosureParamIndex); |
40 Node* node = NewNode(op, graph()->start()); | 41 Node* node = NewNode(op, graph()->start()); |
41 function_closure_.set(node); | 42 function_closure_.set(node); |
42 } | 43 } |
43 return function_closure_.get(); | 44 return function_closure_.get(); |
44 } | 45 } |
45 | 46 |
46 | 47 |
47 Node* AstGraphBuilder::GetFunctionContext() { | 48 Node* AstGraphBuilder::GetFunctionContext() { |
48 if (!function_context_.is_set()) { | 49 if (!function_context_.is_set()) { |
49 // Parameter (arity + 1) is special for the outer context of the function | 50 // Parameter (arity + 1) is special for the outer context of the function |
(...skipping 2389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2439 | 2440 |
2440 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( | 2441 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( |
2441 IterationStatement* stmt) { | 2442 IterationStatement* stmt) { |
2442 if (loop_assignment_analysis_ == NULL) return NULL; | 2443 if (loop_assignment_analysis_ == NULL) return NULL; |
2443 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt); | 2444 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt); |
2444 } | 2445 } |
2445 | 2446 |
2446 } // namespace compiler | 2447 } // namespace compiler |
2447 } // namespace internal | 2448 } // namespace internal |
2448 } // namespace v8 | 2449 } // namespace v8 |
OLD | NEW |