Index: src/compiler/ast-graph-builder.cc |
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc |
index 161a33a10d4ac8663c2e57e81b99a737b8468cfc..f2b64d0b146b4c5825b2f71f95306783a2bc58ac 100644 |
--- a/src/compiler/ast-graph-builder.cc |
+++ b/src/compiler/ast-graph-builder.cc |
@@ -1625,8 +1625,8 @@ void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) { |
// The static prototype property is read only. We handle the non computed |
// property name case in the parser. Since this is the only case where we |
- // need to check for an own read only property we special case this so we do |
- // not need to do this for every property. |
+ // need to check for an own read only property we special case this so we |
+ // do not need to do this for every property. |
if (property->is_static() && property->is_computed_name()) { |
Node* check = BuildThrowIfStaticPrototype(environment()->Pop(), |
expr->GetIdForProperty(i)); |
@@ -1672,8 +1672,22 @@ void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) { |
} |
} |
- // Set the constructor to have fast properties. |
prototype = environment()->Pop(); |
+ |
+ // Install a "name" property if missing. |
+ if (!expr->has_name_static_property() && |
+ !expr->constructor()->raw_name()->IsEmpty()) { |
+ literal = environment()->Pop(); |
+ const Operator* op = |
+ javascript()->CallRuntime(Runtime::kInstallClassNameAccessor); |
+ literal = |
+ NewNode(op, literal, |
+ jsgraph()->BooleanConstant(expr->has_static_computed_names())); |
Toon Verwaest
2016/11/29 12:27:47
The standard way is to call a different runtime fu
|
+ PrepareFrameState(literal, BailoutId::None()); |
+ environment()->Push(literal); |
+ } |
+ |
+ // Set the constructor to have fast properties. |
literal = environment()->Pop(); |
const Operator* op = javascript()->CallRuntime(Runtime::kToFastProperties); |
literal = NewNode(op, literal); |