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 | 1555 |
1556 // The class name is expected on the operand stack. | 1556 // The class name is expected on the operand stack. |
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* script = jsgraph()->Constant(info()->script()); | |
1566 Node* start = jsgraph()->Constant(expr->start_position()); | 1565 Node* start = jsgraph()->Constant(expr->start_position()); |
1567 Node* end = jsgraph()->Constant(expr->end_position()); | 1566 Node* end = jsgraph()->Constant(expr->end_position()); |
1568 const Operator* opc = javascript()->CallRuntime( | 1567 const Operator* opc = javascript()->CallRuntime( |
1569 is_strong(language_mode()) ? Runtime::kDefineClassStrong | 1568 is_strong(language_mode()) ? Runtime::kDefineClassStrong |
1570 : Runtime::kDefineClass, | 1569 : Runtime::kDefineClass, |
1571 6); | 1570 5); |
1572 Node* literal = NewNode(opc, name, extends, constructor, script, start, end); | 1571 Node* literal = NewNode(opc, name, extends, constructor, start, end); |
1573 PrepareFrameState(literal, expr->CreateLiteralId(), | 1572 PrepareFrameState(literal, expr->CreateLiteralId(), |
1574 OutputFrameStateCombine::Push()); | 1573 OutputFrameStateCombine::Push()); |
1575 | 1574 |
1576 // The prototype is ensured to exist by Runtime_DefineClass. No access check | 1575 // The prototype is ensured to exist by Runtime_DefineClass. No access check |
1577 // is needed here since the constructor is created by the class literal. | 1576 // is needed here since the constructor is created by the class literal. |
1578 Node* proto = | 1577 Node* proto = |
1579 BuildLoadObjectField(literal, JSFunction::kPrototypeOrInitialMapOffset); | 1578 BuildLoadObjectField(literal, JSFunction::kPrototypeOrInitialMapOffset); |
1580 | 1579 |
1581 // The class literal and the prototype are both expected on the operand stack | 1580 // The class literal and the prototype are both expected on the operand stack |
1582 // during evaluation of the method values. | 1581 // during evaluation of the method values. |
(...skipping 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4303 // Phi does not exist yet, introduce one. | 4302 // Phi does not exist yet, introduce one. |
4304 value = NewPhi(inputs, value, control); | 4303 value = NewPhi(inputs, value, control); |
4305 value->ReplaceInput(inputs - 1, other); | 4304 value->ReplaceInput(inputs - 1, other); |
4306 } | 4305 } |
4307 return value; | 4306 return value; |
4308 } | 4307 } |
4309 | 4308 |
4310 } // namespace compiler | 4309 } // namespace compiler |
4311 } // namespace internal | 4310 } // namespace internal |
4312 } // namespace v8 | 4311 } // namespace v8 |
OLD | NEW |