From 113037d9f32d70602ab79a5d1b75c949a89ac49d Mon Sep 17 00:00:00 2001 From: "chunyang.dai" Date: Mon, 23 Mar 2015 01:50:16 -0700 Subject: [PATCH] X87: [es6] Throw TypeError for computed static prototype property name port 8d946b9c3f6ea42dd5232c0529be4d47798b06aa (r27106). original commit message: [es6] Throw TypeError for computed static prototype property name The prototype of a class constructor function is read only. When we set computed property names we were ignoring this and we were overriding the property. Since the prototype is the only possible own read only property on the constructor function object we special case this so we do not have to check this for every property in the class literal. BUG= Review URL: https://codereview.chromium.org/1028983002 Cr-Commit-Position: refs/heads/master@{#27356} --- src/x87/full-codegen-x87.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/x87/full-codegen-x87.cc b/src/x87/full-codegen-x87.cc index 4d97441..d375975 100644 --- a/src/x87/full-codegen-x87.cc +++ b/src/x87/full-codegen-x87.cc @@ -2482,6 +2482,16 @@ void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { __ push(Operand(esp, 0)); // prototype } EmitPropertyKey(property, lit->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()) { + __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); + __ push(eax); + } + VisitForStackValue(value); EmitSetHomeObjectIfNeeded(value, 2); -- 2.7.4