| 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 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1628 | 1628 |
| 1629 // Create node to instantiate a new closure. | 1629 // Create node to instantiate a new closure. |
| 1630 PretenureFlag pretenure = expr->pretenure() ? TENURED : NOT_TENURED; | 1630 PretenureFlag pretenure = expr->pretenure() ? TENURED : NOT_TENURED; |
| 1631 const Operator* op = javascript()->CreateClosure(shared_info, pretenure); | 1631 const Operator* op = javascript()->CreateClosure(shared_info, pretenure); |
| 1632 Node* value = NewNode(op); | 1632 Node* value = NewNode(op); |
| 1633 ast_context()->ProduceValue(expr, value); | 1633 ast_context()->ProduceValue(expr, value); |
| 1634 } | 1634 } |
| 1635 | 1635 |
| 1636 | 1636 |
| 1637 void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) { | 1637 void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) { |
| 1638 // Visit declarations and class literal in a block scope. | |
| 1639 if (expr->scope()->ContextLocalCount() > 0) { | |
| 1640 Node* context = BuildLocalBlockContext(expr->scope()); | |
| 1641 ContextScope scope(this, expr->scope(), context); | |
| 1642 VisitDeclarations(expr->scope()->declarations()); | |
| 1643 VisitClassLiteralContents(expr); | |
| 1644 } else { | |
| 1645 VisitDeclarations(expr->scope()->declarations()); | |
| 1646 VisitClassLiteralContents(expr); | |
| 1647 } | |
| 1648 } | |
| 1649 | |
| 1650 | |
| 1651 void AstGraphBuilder::VisitClassLiteralContents(ClassLiteral* expr) { | |
| 1652 VisitForValueOrTheHole(expr->extends()); | 1638 VisitForValueOrTheHole(expr->extends()); |
| 1653 VisitForValue(expr->constructor()); | 1639 VisitForValue(expr->constructor()); |
| 1654 | 1640 |
| 1655 // Create node to instantiate a new class. | 1641 // Create node to instantiate a new class. |
| 1656 Node* constructor = environment()->Pop(); | 1642 Node* constructor = environment()->Pop(); |
| 1657 Node* extends = environment()->Pop(); | 1643 Node* extends = environment()->Pop(); |
| 1658 Node* start = jsgraph()->Constant(expr->start_position()); | 1644 Node* start = jsgraph()->Constant(expr->start_position()); |
| 1659 Node* end = jsgraph()->Constant(expr->end_position()); | 1645 Node* end = jsgraph()->Constant(expr->end_position()); |
| 1660 const Operator* opc = javascript()->CallRuntime(Runtime::kDefineClass); | 1646 const Operator* opc = javascript()->CallRuntime(Runtime::kDefineClass); |
| 1661 Node* literal = NewNode(opc, extends, constructor, start, end); | 1647 Node* literal = NewNode(opc, extends, constructor, start, end); |
| (...skipping 2748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4410 // Phi does not exist yet, introduce one. | 4396 // Phi does not exist yet, introduce one. |
| 4411 value = NewPhi(inputs, value, control); | 4397 value = NewPhi(inputs, value, control); |
| 4412 value->ReplaceInput(inputs - 1, other); | 4398 value->ReplaceInput(inputs - 1, other); |
| 4413 } | 4399 } |
| 4414 return value; | 4400 return value; |
| 4415 } | 4401 } |
| 4416 | 4402 |
| 4417 } // namespace compiler | 4403 } // namespace compiler |
| 4418 } // namespace internal | 4404 } // namespace internal |
| 4419 } // namespace v8 | 4405 } // namespace v8 |
| OLD | NEW |