Index: src/compiler/ast-graph-builder.cc |
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc |
index 6cf419fc95808f193ec72a5aad7170a20a483bcd..7c93166ac7d97cb4bc783d2a79cae31ce7f77f9f 100644 |
--- a/src/compiler/ast-graph-builder.cc |
+++ b/src/compiler/ast-graph-builder.cc |
@@ -1383,6 +1383,20 @@ 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(); |
+ const Operator* op = |
+ javascript()->CallRuntime(Runtime::kThrowIfStaticPrototype, 1); |
arv (Not doing code reviews)
2015/03/06 11:51:29
I'm tempted to do the `if (name === 'prototype') {
Michael Starzinger
2015/03/06 13:05:18
I would be fine with having the comparison inline
Dmitry Lomov (no reviews)
2015/03/09 14:46:04
I think inline comparison is better overall since
|
+ Node* maybe_throw = NewNode(op, name); |
+ PrepareFrameState(maybe_throw, expr->GetIdForProperty(i)); |
+ environment()->Push(maybe_throw); |
+ } |
+ |
VisitForValue(property->value()); |
Node* value = environment()->Pop(); |
Node* key = environment()->Pop(); |