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 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 } | 1636 } |
1637 } | 1637 } |
1638 | 1638 |
1639 // Transform both the class literal and the prototype to fast properties. | 1639 // Transform both the class literal and the prototype to fast properties. |
1640 const Operator* op = javascript()->CallRuntime(Runtime::kToFastProperties, 1); | 1640 const Operator* op = javascript()->CallRuntime(Runtime::kToFastProperties, 1); |
1641 NewNode(op, environment()->Pop()); // prototype | 1641 NewNode(op, environment()->Pop()); // prototype |
1642 NewNode(op, environment()->Pop()); // literal | 1642 NewNode(op, environment()->Pop()); // literal |
1643 if (is_strong(language_mode())) { | 1643 if (is_strong(language_mode())) { |
1644 // TODO(conradw): It would be more efficient to define the properties with | 1644 // TODO(conradw): It would be more efficient to define the properties with |
1645 // the right attributes the first time round. | 1645 // the right attributes the first time round. |
| 1646 // Freeze the prototype. |
| 1647 proto = |
| 1648 NewNode(javascript()->CallRuntime(Runtime::kObjectFreeze, 1), proto); |
| 1649 // Freezing the prototype should never deopt. |
| 1650 PrepareFrameState(proto, BailoutId::None()); |
| 1651 // Freeze the constructor. |
1646 literal = | 1652 literal = |
1647 NewNode(javascript()->CallRuntime(Runtime::kObjectFreeze, 1), literal); | 1653 NewNode(javascript()->CallRuntime(Runtime::kObjectFreeze, 1), literal); |
1648 // Freezing the class object should never deopt. | 1654 // Freezing the constructor should never deopt. |
1649 PrepareFrameState(literal, BailoutId::None()); | 1655 PrepareFrameState(literal, BailoutId::None()); |
1650 } | 1656 } |
1651 | 1657 |
1652 // Assign to class variable. | 1658 // Assign to class variable. |
1653 if (expr->scope() != NULL) { | 1659 if (expr->scope() != NULL) { |
1654 DCHECK_NOT_NULL(expr->class_variable_proxy()); | 1660 DCHECK_NOT_NULL(expr->class_variable_proxy()); |
1655 Variable* var = expr->class_variable_proxy()->var(); | 1661 Variable* var = expr->class_variable_proxy()->var(); |
1656 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 1662 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
1657 VectorSlotPair feedback = CreateVectorSlotPair( | 1663 VectorSlotPair feedback = CreateVectorSlotPair( |
1658 FLAG_vector_stores ? expr->GetNthSlot(store_slot_index++) | 1664 FLAG_vector_stores ? expr->GetNthSlot(store_slot_index++) |
(...skipping 2586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4245 // Phi does not exist yet, introduce one. | 4251 // Phi does not exist yet, introduce one. |
4246 value = NewPhi(inputs, value, control); | 4252 value = NewPhi(inputs, value, control); |
4247 value->ReplaceInput(inputs - 1, other); | 4253 value->ReplaceInput(inputs - 1, other); |
4248 } | 4254 } |
4249 return value; | 4255 return value; |
4250 } | 4256 } |
4251 | 4257 |
4252 } // namespace compiler | 4258 } // namespace compiler |
4253 } // namespace internal | 4259 } // namespace internal |
4254 } // namespace v8 | 4260 } // namespace v8 |
OLD | NEW |