| Index: src/compiler/ast-graph-builder.cc
|
| diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
|
| index 68cf58905f87e1f62e0d2186409657ba29861d39..f213de56cdc23a942271b0bd33a18684cb6f4177 100644
|
| --- a/src/compiler/ast-graph-builder.cc
|
| +++ b/src/compiler/ast-graph-builder.cc
|
| @@ -1659,6 +1659,39 @@ void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) {
|
| }
|
| }
|
|
|
| + // ES6 section 14.5.16 class expression evaluation, step 5
|
| + DCHECK(!expr->constructor()->name().is_null());
|
| + // abort if 'name' is undefined
|
| + if (expr->constructor()->name()->length() != 0) {
|
| + // if "name" is already defined, exit
|
| + environment()->Push(environment()->Peek(1)); // literal
|
| + Node* receiver = environment()->Pop();
|
| + Node* key = jsgraph()->Constant(isolate()->factory()->name_string());
|
| + IfBuilder has_name(this);
|
| + const Operator* has_name_op =
|
| + javascript()->CallRuntime(Runtime::kObjectHasOwnProperty);
|
| + Node* has_name_call = NewNode(has_name_op, receiver, key);
|
| + PrepareFrameState(has_name_call, BailoutId::None());
|
| + has_name.If(has_name_call, BranchHint::kFalse);
|
| + has_name.Then();
|
| + has_name.Else();
|
| + {
|
| + // define "name" property
|
| + environment()->Push(environment()->Peek(1)); // literal
|
| + Node* receiver = environment()->Pop();
|
| + Node* key = jsgraph()->Constant(isolate()->factory()->name_string());
|
| + Node* value = jsgraph()->Constant(expr->constructor()->name());
|
| + Node* attr = jsgraph()->Constant(DONT_ENUM | READ_ONLY);
|
| + Node* set_function_name = jsgraph()->Constant(0);
|
| + const Operator* define_name_op =
|
| + javascript()->CallRuntime(Runtime::kDefineDataPropertyInLiteral);
|
| + Node* define_name_call = NewNode(define_name_op, receiver, key, value,
|
| + attr, set_function_name);
|
| + PrepareFrameState(define_name_call, BailoutId::None());
|
| + }
|
| + has_name.End();
|
| + }
|
| +
|
| // Set the constructor to have fast properties.
|
| prototype = environment()->Pop();
|
| literal = environment()->Pop();
|
|
|