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/js-type-feedback.h" | 10 #include "src/compiler/js-type-feedback.h" |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 const Operator* op = | 495 const Operator* op = |
496 common()->Parameter(info()->num_parameters_including_this(), "%context"); | 496 common()->Parameter(info()->num_parameters_including_this(), "%context"); |
497 return NewNode(op, graph()->start()); | 497 return NewNode(op, graph()->start()); |
498 } | 498 } |
499 | 499 |
500 | 500 |
501 bool AstGraphBuilder::CreateGraph(bool constant_context, bool stack_check) { | 501 bool AstGraphBuilder::CreateGraph(bool constant_context, bool stack_check) { |
502 Scope* scope = info()->scope(); | 502 Scope* scope = info()->scope(); |
503 DCHECK(graph() != NULL); | 503 DCHECK(graph() != NULL); |
504 | 504 |
505 // Set up the basic structure of the graph. | 505 // Set up the basic structure of the graph. Outputs for {Start} are the formal |
506 int parameter_count = info()->num_parameters(); | 506 // parameters (including the receiver) plus context and closure. |
507 graph()->SetStart(graph()->NewNode(common()->Start(parameter_count))); | 507 int actual_parameter_count = info()->num_parameters_including_this() + 2; |
| 508 graph()->SetStart(graph()->NewNode(common()->Start(actual_parameter_count))); |
508 | 509 |
509 // Initialize the top-level environment. | 510 // Initialize the top-level environment. |
510 Environment env(this, scope, graph()->start()); | 511 Environment env(this, scope, graph()->start()); |
511 set_environment(&env); | 512 set_environment(&env); |
512 | 513 |
513 if (info()->is_osr()) { | 514 if (info()->is_osr()) { |
514 // Use OSR normal entry as the start of the top-level environment. | 515 // Use OSR normal entry as the start of the top-level environment. |
515 // It will be replaced with {Dead} after typing and optimizations. | 516 // It will be replaced with {Dead} after typing and optimizations. |
516 NewNode(common()->OsrNormalEntry()); | 517 NewNode(common()->OsrNormalEntry()); |
517 } | 518 } |
(...skipping 3652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4170 // Phi does not exist yet, introduce one. | 4171 // Phi does not exist yet, introduce one. |
4171 value = NewPhi(inputs, value, control); | 4172 value = NewPhi(inputs, value, control); |
4172 value->ReplaceInput(inputs - 1, other); | 4173 value->ReplaceInput(inputs - 1, other); |
4173 } | 4174 } |
4174 return value; | 4175 return value; |
4175 } | 4176 } |
4176 | 4177 |
4177 } // namespace compiler | 4178 } // namespace compiler |
4178 } // namespace internal | 4179 } // namespace internal |
4179 } // namespace v8 | 4180 } // namespace v8 |
OLD | NEW |