Index: src/compiler/ast-graph-builder.cc |
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc |
index 96809fc2dff053b92817c2ffd0bdf7ad66a819d5..8fb25bf3c359ae6e0ead9ad75a1aee633d2f8146 100644 |
--- a/src/compiler/ast-graph-builder.cc |
+++ b/src/compiler/ast-graph-builder.cc |
@@ -1402,6 +1402,17 @@ void AstGraphBuilder::VisitClassLiteralContents(ClassLiteral* expr) { |
VisitForValue(property->key()); |
environment()->Push( |
BuildToName(environment()->Pop(), expr->GetIdForProperty(i))); |
+ |
+ // 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. |
+ if (property->is_static() && property->is_computed_name()) { |
+ Node* name = environment()->Pop(); |
+ environment()->Push( |
+ BuildThrowIfStaticPrototype(name, expr->GetIdForProperty(i))); |
+ } |
+ |
VisitForValue(property->value()); |
Node* value = environment()->Pop(); |
Node* key = environment()->Pop(); |
@@ -2582,6 +2593,28 @@ Node* AstGraphBuilder::BuildHoleCheckThrow(Node* value, Variable* variable, |
} |
+Node* AstGraphBuilder::BuildThrowIfStaticPrototype(Node* name, |
+ BailoutId bailout_id) { |
+ IfBuilder prototype_check(this); |
+ Node* prototype_string = |
+ jsgraph()->Constant(isolate()->factory()->prototype_string()); |
+ Node* check = NewNode(javascript()->StrictEqual(), name, prototype_string); |
+ prototype_check.If(check); |
+ prototype_check.Then(); |
+ { |
+ const Operator* op = |
+ javascript()->CallRuntime(Runtime::kThrowStaticPrototypeError, 0); |
+ Node* call = NewNode(op); |
+ PrepareFrameState(call, bailout_id); |
+ environment()->Push(call); |
+ } |
+ prototype_check.Else(); |
+ environment()->Push(name); |
+ prototype_check.End(); |
+ return environment()->Pop(); |
+} |
+ |
+ |
Node* AstGraphBuilder::BuildVariableLoad(Variable* variable, |
BailoutId bailout_id, |
const VectorSlotPair& feedback, |