| 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/control-builders.h" | 8 #include "src/compiler/control-builders.h" |
| 9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
| 10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 UNIMPLEMENTED(); | 379 UNIMPLEMENTED(); |
| 380 } | 380 } |
| 381 } | 381 } |
| 382 | 382 |
| 383 | 383 |
| 384 void AstGraphBuilder::VisitFunctionDeclaration(FunctionDeclaration* decl) { | 384 void AstGraphBuilder::VisitFunctionDeclaration(FunctionDeclaration* decl) { |
| 385 Variable* variable = decl->proxy()->var(); | 385 Variable* variable = decl->proxy()->var(); |
| 386 switch (variable->location()) { | 386 switch (variable->location()) { |
| 387 case Variable::UNALLOCATED: { | 387 case Variable::UNALLOCATED: { |
| 388 Handle<SharedFunctionInfo> function = | 388 Handle<SharedFunctionInfo> function = |
| 389 Compiler::BuildFunctionInfo(decl->fun(), info()->script()); | 389 Compiler::BuildFunctionInfo(decl->fun(), info()->script(), info()); |
| 390 // Check for stack-overflow exception. | 390 // Check for stack-overflow exception. |
| 391 if (function.is_null()) return SetStackOverflow(); | 391 if (function.is_null()) return SetStackOverflow(); |
| 392 globals()->Add(variable->name(), zone()); | 392 globals()->Add(variable->name(), zone()); |
| 393 globals()->Add(function, zone()); | 393 globals()->Add(function, zone()); |
| 394 break; | 394 break; |
| 395 } | 395 } |
| 396 case Variable::PARAMETER: | 396 case Variable::PARAMETER: |
| 397 case Variable::LOCAL: { | 397 case Variable::LOCAL: { |
| 398 VisitForValue(decl->fun()); | 398 VisitForValue(decl->fun()); |
| 399 Node* value = environment()->Pop(); | 399 Node* value = environment()->Pop(); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 | 780 |
| 781 | 781 |
| 782 void AstGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { | 782 void AstGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { |
| 783 Node* context = current_context(); | 783 Node* context = current_context(); |
| 784 | 784 |
| 785 // Build a new shared function info if we cannot find one in the baseline | 785 // Build a new shared function info if we cannot find one in the baseline |
| 786 // code. We also have a stack overflow if the recursive compilation did. | 786 // code. We also have a stack overflow if the recursive compilation did. |
| 787 Handle<SharedFunctionInfo> shared_info = | 787 Handle<SharedFunctionInfo> shared_info = |
| 788 SearchSharedFunctionInfo(info()->shared_info()->code(), expr); | 788 SearchSharedFunctionInfo(info()->shared_info()->code(), expr); |
| 789 if (shared_info.is_null()) { | 789 if (shared_info.is_null()) { |
| 790 shared_info = Compiler::BuildFunctionInfo(expr, info()->script()); | 790 shared_info = Compiler::BuildFunctionInfo(expr, info()->script(), info()); |
| 791 CHECK(!shared_info.is_null()); // TODO(mstarzinger): Set stack overflow? | 791 CHECK(!shared_info.is_null()); // TODO(mstarzinger): Set stack overflow? |
| 792 } | 792 } |
| 793 | 793 |
| 794 // Create node to instantiate a new closure. | 794 // Create node to instantiate a new closure. |
| 795 Node* info = jsgraph()->Constant(shared_info); | 795 Node* info = jsgraph()->Constant(shared_info); |
| 796 Node* pretenure = expr->pretenure() ? jsgraph()->TrueConstant() | 796 Node* pretenure = expr->pretenure() ? jsgraph()->TrueConstant() |
| 797 : jsgraph()->FalseConstant(); | 797 : jsgraph()->FalseConstant(); |
| 798 Operator* op = javascript()->Runtime(Runtime::kNewClosure, 3); | 798 Operator* op = javascript()->Runtime(Runtime::kNewClosure, 3); |
| 799 Node* value = NewNode(op, context, info, pretenure); | 799 Node* value = NewNode(op, context, info, pretenure); |
| 800 ast_context()->ProduceValue(value); | 800 ast_context()->ProduceValue(value); |
| (...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1960 | 1960 |
| 1961 // Continue with the original environment. | 1961 // Continue with the original environment. |
| 1962 set_environment(continuation_env); | 1962 set_environment(continuation_env); |
| 1963 | 1963 |
| 1964 NewNode(common()->Continuation()); | 1964 NewNode(common()->Continuation()); |
| 1965 } | 1965 } |
| 1966 } | 1966 } |
| 1967 } | 1967 } |
| 1968 } | 1968 } |
| 1969 } // namespace v8::internal::compiler | 1969 } // namespace v8::internal::compiler |
| OLD | NEW |