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 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 environment()->Push(class_name); | 1557 environment()->Push(class_name); |
1558 VisitForValueOrTheHole(expr->extends()); | 1558 VisitForValueOrTheHole(expr->extends()); |
1559 VisitForValue(expr->constructor()); | 1559 VisitForValue(expr->constructor()); |
1560 | 1560 |
1561 // Create node to instantiate a new class. | 1561 // Create node to instantiate a new class. |
1562 Node* constructor = environment()->Pop(); | 1562 Node* constructor = environment()->Pop(); |
1563 Node* extends = environment()->Pop(); | 1563 Node* extends = environment()->Pop(); |
1564 Node* name = environment()->Pop(); | 1564 Node* name = environment()->Pop(); |
1565 Node* start = jsgraph()->Constant(expr->start_position()); | 1565 Node* start = jsgraph()->Constant(expr->start_position()); |
1566 Node* end = jsgraph()->Constant(expr->end_position()); | 1566 Node* end = jsgraph()->Constant(expr->end_position()); |
1567 const Operator* opc = javascript()->CallRuntime( | 1567 const Operator* opc = javascript()->CallRuntime(Runtime::kDefineClass, 5); |
1568 is_strong(language_mode()) ? Runtime::kDefineClassStrong | |
1569 : Runtime::kDefineClass, | |
1570 5); | |
1571 Node* literal = NewNode(opc, name, extends, constructor, start, end); | 1568 Node* literal = NewNode(opc, name, extends, constructor, start, end); |
1572 PrepareFrameState(literal, expr->CreateLiteralId(), | 1569 PrepareFrameState(literal, expr->CreateLiteralId(), |
1573 OutputFrameStateCombine::Push()); | 1570 OutputFrameStateCombine::Push()); |
1574 | 1571 |
1575 // The prototype is ensured to exist by Runtime_DefineClass. No access check | 1572 // The prototype is ensured to exist by Runtime_DefineClass. No access check |
1576 // is needed here since the constructor is created by the class literal. | 1573 // is needed here since the constructor is created by the class literal. |
1577 Node* proto = | 1574 Node* proto = |
1578 BuildLoadObjectField(literal, JSFunction::kPrototypeOrInitialMapOffset); | 1575 BuildLoadObjectField(literal, JSFunction::kPrototypeOrInitialMapOffset); |
1579 | 1576 |
1580 // The class literal and the prototype are both expected on the operand stack | 1577 // The class literal and the prototype are both expected on the operand stack |
(...skipping 2711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4292 // Phi does not exist yet, introduce one. | 4289 // Phi does not exist yet, introduce one. |
4293 value = NewPhi(inputs, value, control); | 4290 value = NewPhi(inputs, value, control); |
4294 value->ReplaceInput(inputs - 1, other); | 4291 value->ReplaceInput(inputs - 1, other); |
4295 } | 4292 } |
4296 return value; | 4293 return value; |
4297 } | 4294 } |
4298 | 4295 |
4299 } // namespace compiler | 4296 } // namespace compiler |
4300 } // namespace internal | 4297 } // namespace internal |
4301 } // namespace v8 | 4298 } // namespace v8 |
OLD | NEW |