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 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 // Build a new shared function info if we cannot find one in the baseline | 1469 // Build a new shared function info if we cannot find one in the baseline |
1470 // code. We also have a stack overflow if the recursive compilation did. | 1470 // code. We also have a stack overflow if the recursive compilation did. |
1471 expr->InitializeSharedInfo(handle(info()->shared_info()->code())); | 1471 expr->InitializeSharedInfo(handle(info()->shared_info()->code())); |
1472 Handle<SharedFunctionInfo> shared_info = expr->shared_info(); | 1472 Handle<SharedFunctionInfo> shared_info = expr->shared_info(); |
1473 if (shared_info.is_null()) { | 1473 if (shared_info.is_null()) { |
1474 shared_info = Compiler::BuildFunctionInfo(expr, info()->script(), info()); | 1474 shared_info = Compiler::BuildFunctionInfo(expr, info()->script(), info()); |
1475 CHECK(!shared_info.is_null()); // TODO(mstarzinger): Set stack overflow? | 1475 CHECK(!shared_info.is_null()); // TODO(mstarzinger): Set stack overflow? |
1476 } | 1476 } |
1477 | 1477 |
1478 // Create node to instantiate a new closure. | 1478 // Create node to instantiate a new closure. |
1479 Node* info = jsgraph()->Constant(shared_info); | 1479 PretenureFlag pretenure = expr->pretenure() ? TENURED : NOT_TENURED; |
1480 Node* pretenure = jsgraph()->BooleanConstant(expr->pretenure()); | 1480 const Operator* op = javascript()->CreateClosure(shared_info, pretenure); |
1481 const Operator* op = javascript()->CallRuntime(Runtime::kNewClosure, 3); | 1481 Node* value = NewNode(op, context); |
1482 Node* value = NewNode(op, context, info, pretenure); | |
1483 ast_context()->ProduceValue(value); | 1482 ast_context()->ProduceValue(value); |
1484 } | 1483 } |
1485 | 1484 |
1486 | 1485 |
1487 void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) { | 1486 void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) { |
1488 if (expr->scope() == NULL) { | 1487 if (expr->scope() == NULL) { |
1489 // Visit class literal in the same scope, no declarations. | 1488 // Visit class literal in the same scope, no declarations. |
1490 VisitClassLiteralContents(expr); | 1489 VisitClassLiteralContents(expr); |
1491 } else { | 1490 } else { |
1492 // Visit declarations and class literal in a block scope. | 1491 // Visit declarations and class literal in a block scope. |
(...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3583 // Phi does not exist yet, introduce one. | 3582 // Phi does not exist yet, introduce one. |
3584 value = NewPhi(inputs, value, control); | 3583 value = NewPhi(inputs, value, control); |
3585 value->ReplaceInput(inputs - 1, other); | 3584 value->ReplaceInput(inputs - 1, other); |
3586 } | 3585 } |
3587 return value; | 3586 return value; |
3588 } | 3587 } |
3589 | 3588 |
3590 } // namespace compiler | 3589 } // namespace compiler |
3591 } // namespace internal | 3590 } // namespace internal |
3592 } // namespace v8 | 3591 } // namespace v8 |
OLD | NEW |