Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 985643003: [es6] Throw TypeError for computed static prototype property name (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleanup comment Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698