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 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 | 1511 |
1512 // Create node to instantiate a new class. | 1512 // Create node to instantiate a new class. |
1513 Node* constructor = environment()->Pop(); | 1513 Node* constructor = environment()->Pop(); |
1514 Node* extends = environment()->Pop(); | 1514 Node* extends = environment()->Pop(); |
1515 Node* name = environment()->Pop(); | 1515 Node* name = environment()->Pop(); |
1516 Node* script = jsgraph()->Constant(info()->script()); | 1516 Node* script = jsgraph()->Constant(info()->script()); |
1517 Node* start = jsgraph()->Constant(expr->start_position()); | 1517 Node* start = jsgraph()->Constant(expr->start_position()); |
1518 Node* end = jsgraph()->Constant(expr->end_position()); | 1518 Node* end = jsgraph()->Constant(expr->end_position()); |
1519 const Operator* opc = javascript()->CallRuntime(Runtime::kDefineClass, 6); | 1519 const Operator* opc = javascript()->CallRuntime(Runtime::kDefineClass, 6); |
1520 Node* literal = NewNode(opc, name, extends, constructor, script, start, end); | 1520 Node* literal = NewNode(opc, name, extends, constructor, script, start, end); |
| 1521 PrepareFrameState(literal, expr->CreateLiteralId(), |
| 1522 OutputFrameStateCombine::Push()); |
1521 | 1523 |
1522 // The prototype is ensured to exist by Runtime_DefineClass. No access check | 1524 // The prototype is ensured to exist by Runtime_DefineClass. No access check |
1523 // is needed here since the constructor is created by the class literal. | 1525 // is needed here since the constructor is created by the class literal. |
1524 Node* proto = | 1526 Node* proto = |
1525 BuildLoadObjectField(literal, JSFunction::kPrototypeOrInitialMapOffset); | 1527 BuildLoadObjectField(literal, JSFunction::kPrototypeOrInitialMapOffset); |
1526 | 1528 |
1527 // The class literal and the prototype are both expected on the operand stack | 1529 // The class literal and the prototype are both expected on the operand stack |
1528 // during evaluation of the method values. | 1530 // during evaluation of the method values. |
1529 environment()->Push(literal); | 1531 environment()->Push(literal); |
1530 environment()->Push(proto); | 1532 environment()->Push(proto); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 NewNode(op, environment()->Pop()); // prototype | 1589 NewNode(op, environment()->Pop()); // prototype |
1588 NewNode(op, environment()->Pop()); // literal | 1590 NewNode(op, environment()->Pop()); // literal |
1589 | 1591 |
1590 // Assign to class variable. | 1592 // Assign to class variable. |
1591 if (expr->scope() != NULL) { | 1593 if (expr->scope() != NULL) { |
1592 DCHECK_NOT_NULL(expr->class_variable_proxy()); | 1594 DCHECK_NOT_NULL(expr->class_variable_proxy()); |
1593 Variable* var = expr->class_variable_proxy()->var(); | 1595 Variable* var = expr->class_variable_proxy()->var(); |
1594 BuildVariableAssignment(var, literal, Token::INIT_CONST, BailoutId::None()); | 1596 BuildVariableAssignment(var, literal, Token::INIT_CONST, BailoutId::None()); |
1595 } | 1597 } |
1596 | 1598 |
1597 PrepareFrameState(literal, expr->id(), ast_context()->GetStateCombine()); | |
1598 ast_context()->ProduceValue(literal); | 1599 ast_context()->ProduceValue(literal); |
1599 } | 1600 } |
1600 | 1601 |
1601 | 1602 |
1602 void AstGraphBuilder::VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) { | 1603 void AstGraphBuilder::VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) { |
1603 UNREACHABLE(); | 1604 UNREACHABLE(); |
1604 } | 1605 } |
1605 | 1606 |
1606 | 1607 |
1607 void AstGraphBuilder::VisitConditional(Conditional* expr) { | 1608 void AstGraphBuilder::VisitConditional(Conditional* expr) { |
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3579 // Phi does not exist yet, introduce one. | 3580 // Phi does not exist yet, introduce one. |
3580 value = NewPhi(inputs, value, control); | 3581 value = NewPhi(inputs, value, control); |
3581 value->ReplaceInput(inputs - 1, other); | 3582 value->ReplaceInput(inputs - 1, other); |
3582 } | 3583 } |
3583 return value; | 3584 return value; |
3584 } | 3585 } |
3585 | 3586 |
3586 } // namespace compiler | 3587 } // namespace compiler |
3587 } // namespace internal | 3588 } // namespace internal |
3588 } // namespace v8 | 3589 } // namespace v8 |
OLD | NEW |