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 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 VisitForValueOrTheHole(expr->extends()); | 1555 VisitForValueOrTheHole(expr->extends()); |
1556 VisitForValue(expr->constructor()); | 1556 VisitForValue(expr->constructor()); |
1557 | 1557 |
1558 // Create node to instantiate a new class. | 1558 // Create node to instantiate a new class. |
1559 Node* constructor = environment()->Pop(); | 1559 Node* constructor = environment()->Pop(); |
1560 Node* extends = environment()->Pop(); | 1560 Node* extends = environment()->Pop(); |
1561 Node* name = environment()->Pop(); | 1561 Node* name = environment()->Pop(); |
1562 Node* script = jsgraph()->Constant(info()->script()); | 1562 Node* script = jsgraph()->Constant(info()->script()); |
1563 Node* start = jsgraph()->Constant(expr->start_position()); | 1563 Node* start = jsgraph()->Constant(expr->start_position()); |
1564 Node* end = jsgraph()->Constant(expr->end_position()); | 1564 Node* end = jsgraph()->Constant(expr->end_position()); |
1565 const Operator* opc = javascript()->CallRuntime(Runtime::kDefineClass, 6); | 1565 const Operator* opc = javascript()->CallRuntime( |
| 1566 is_strong(language_mode()) ? Runtime::kDefineClassStrong |
| 1567 : Runtime::kDefineClass, |
| 1568 6); |
1566 Node* literal = NewNode(opc, name, extends, constructor, script, start, end); | 1569 Node* literal = NewNode(opc, name, extends, constructor, script, start, end); |
1567 PrepareFrameState(literal, expr->CreateLiteralId(), | 1570 PrepareFrameState(literal, expr->CreateLiteralId(), |
1568 OutputFrameStateCombine::Push()); | 1571 OutputFrameStateCombine::Push()); |
1569 | 1572 |
1570 // The prototype is ensured to exist by Runtime_DefineClass. No access check | 1573 // The prototype is ensured to exist by Runtime_DefineClass. No access check |
1571 // is needed here since the constructor is created by the class literal. | 1574 // is needed here since the constructor is created by the class literal. |
1572 Node* proto = | 1575 Node* proto = |
1573 BuildLoadObjectField(literal, JSFunction::kPrototypeOrInitialMapOffset); | 1576 BuildLoadObjectField(literal, JSFunction::kPrototypeOrInitialMapOffset); |
1574 | 1577 |
1575 // The class literal and the prototype are both expected on the operand stack | 1578 // The class literal and the prototype are both expected on the operand stack |
(...skipping 2659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4235 // Phi does not exist yet, introduce one. | 4238 // Phi does not exist yet, introduce one. |
4236 value = NewPhi(inputs, value, control); | 4239 value = NewPhi(inputs, value, control); |
4237 value->ReplaceInput(inputs - 1, other); | 4240 value->ReplaceInput(inputs - 1, other); |
4238 } | 4241 } |
4239 return value; | 4242 return value; |
4240 } | 4243 } |
4241 | 4244 |
4242 } // namespace compiler | 4245 } // namespace compiler |
4243 } // namespace internal | 4246 } // namespace internal |
4244 } // namespace v8 | 4247 } // namespace v8 |
OLD | NEW |