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..8b8ac76ee51ea07710474ba3bdfa5ee827b57d29 100644 |
--- a/src/compiler/ast-graph-builder.cc |
+++ b/src/compiler/ast-graph-builder.cc |
@@ -1672,9 +1672,20 @@ void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) { |
} |
} |
- // Set the constructor to have fast properties. |
prototype = environment()->Pop(); |
literal = environment()->Pop(); |
+ |
+ // ES6 section 14.5.16 class expression evaluation, step 5 |
+ DCHECK(expr->constructor()->raw_name() != nullptr); |
+ if (!expr->constructor()->raw_name()->IsEmpty()) { |
+ Node* value = jsgraph()->Constant(expr->constructor()->name()); |
+ const Operator* op = |
+ javascript()->CallRuntime(Runtime::kDefineClassNameProperty); |
+ literal = NewNode(op, literal, value); |
+ PrepareFrameState(literal, BailoutId::None()); |
+ } |
+ |
+ // Set the constructor to have fast properties. |
const Operator* op = javascript()->CallRuntime(Runtime::kToFastProperties); |
literal = NewNode(op, literal); |