| Index: src/compiler/ast-graph-builder.cc
|
| diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
|
| index 4cf6dde9c1b474aa6539eb9a5d00ba9b4094f6ca..6e5e6d2cb3b084c1c9c36507d9aa8f2c16077c14 100644
|
| --- a/src/compiler/ast-graph-builder.cc
|
| +++ b/src/compiler/ast-graph-builder.cc
|
| @@ -1591,6 +1591,18 @@ void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) {
|
| OutputFrameStateCombine::Push());
|
| environment()->Push(literal);
|
|
|
| + // TODO(bakkot) This shouldn't be necessary; I just couldn't figure out how to
|
| + // invoke the function literal with appropriate home object and receiver
|
| + // (mainly because of FeedbackVector check failures which are totally opaque
|
| + // to me)
|
| + VariableProxy* static_initializer_proxy = expr->static_initializer_proxy();
|
| + if (static_initializer_proxy != nullptr) {
|
| + Variable* variable = static_initializer_proxy->var();
|
| + BuildVariableAssignment(variable, literal, Token::INIT,
|
| + CreateVectorSlotPair(FeedbackVectorSlot::Invalid()),
|
| + BailoutId::None()); // TODO(bakkot) tokens
|
| + }
|
| +
|
| // Load the "prototype" from the constructor.
|
| PrepareEagerCheckpoint(expr->CreateLiteralId());
|
| Handle<Name> name = isolate()->factory()->prototype_string();
|
| @@ -1603,6 +1615,22 @@ void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) {
|
| // Create nodes to store method values into the literal.
|
| for (int i = 0; i < expr->properties()->length(); i++) {
|
| ClassLiteral::Property* property = expr->properties()->at(i);
|
| +
|
| + if (property->kind() == ClassLiteral::Property::FIELD &&
|
| + !property->is_static()) {
|
| + // This just does the ToName call on the field name and stores it in a
|
| + // variable (a proxy for which is the value() of this property)
|
| + Variable* variable =
|
| + property->value()->AsVariableProxy()->var(); // TODO(bakkot) DCHECKs
|
| + VisitForValue(property->key());
|
| + Node* key = environment()->Pop();
|
| + BuildVariableAssignment(
|
| + variable, key, Token::INIT,
|
| + CreateVectorSlotPair(FeedbackVectorSlot::Invalid()),
|
| + BailoutId::None());
|
| + continue;
|
| + }
|
| +
|
| environment()->Push(environment()->Peek(property->is_static() ? 1 : 0));
|
|
|
| VisitForValue(property->key());
|
| @@ -1652,7 +1680,14 @@ void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) {
|
| break;
|
| }
|
| case ClassLiteral::Property::FIELD: {
|
| - UNREACHABLE();
|
| + DCHECK(property->is_static());
|
| + Node* attr = jsgraph()->Constant(DONT_ENUM);
|
| + Node* set_function_name =
|
| + jsgraph()->Constant(property->NeedsSetFunctionName());
|
| + const Operator* op =
|
| + javascript()->CallRuntime(Runtime::kDefineDataPropertyInLiteral);
|
| + Node* call = NewNode(op, receiver, key, value, attr, set_function_name);
|
| + PrepareFrameState(call, BailoutId::None());
|
| break;
|
| }
|
| }
|
|
|