Reviewers: Toon Verwaest,

Message:
PTAL

Description:
[es6] Make sure we call add property when adding a new property

When setting a property using `super.prop = val` we need to use
add property if we are adding a new property and not set property.

BUG=493566
LOG=N
[email protected]

Please review this at https://codereview.chromium.org/1161073002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+9, -8 lines):
  M src/objects.cc
  A + test/mjsunit/es6/regress/regress-cr493566.js


Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 180eb63536c1f35bf5d07189478a81c55951d281..fad3d2e0264420b272408a91f9b71bbade6df13a 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -3333,7 +3333,8 @@ MaybeHandle<Object> Object::SetSuperProperty(LookupIterator* it,
       MaybeHandle<Object> result = SetPropertyInternal(
           &own_lookup, value, language_mode, store_mode, &found);
       if (found) return result;
-      return SetDataProperty(&own_lookup, value);
+      return AddDataProperty(&own_lookup, value, NONE, language_mode,
+                             store_mode);
     }
   }

Index: test/mjsunit/es6/regress/regress-cr493566.js
diff --git a/test/mjsunit/compiler/regress-469089.js b/test/mjsunit/es6/regress/regress-cr493566.js
similarity index 58%
copy from test/mjsunit/compiler/regress-469089.js
copy to test/mjsunit/es6/regress/regress-cr493566.js
index 6aff2b720305290570124cec0dd7a4a959f05694..0ae6ab0f441ce2682673815bf5ceeb08940fdd37 100644
--- a/test/mjsunit/compiler/regress-469089.js
+++ b/test/mjsunit/es6/regress/regress-cr493566.js
@@ -1,16 +1,16 @@
 // Copyright 2015 the V8 project authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
+"use strict";

-// Flags: --expose-gc
+var global = this;

 (function() {
-  var __v_6 = false;
-  function f(val, idx) {
-    if (idx === 1) {
-      gc();
-      __v_6 = (val === 0);
+  class A {
+    s() {
+      super.bla = 10;
     }
   }
-  f(.1, 1);
+  new A().s.call(global);
+  assertEquals(10, global.bla);
 })();


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to