Reviewers: Dan Ehrenberg,

Description:
Version 4.6.85.12 (cherry-pick)

Merged 233d62f8e306e56d5ed0597b008c205700e744bd

[es6] Fix computed property names in nested literals

BUG=v8:4387
LOG=N
[email protected]

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

Base URL: https://chromium.googlesource.com/v8/[email protected]

Affected files (+58, -1 lines):
  M include/v8-version.h
  M src/ast.cc
  M test/mjsunit/es6/computed-property-names.js


Index: include/v8-version.h
diff --git a/include/v8-version.h b/include/v8-version.h
index dc790f1cae6016e74bfba82aa86af7d840065c26..c98e51fffd5896d0689b0a201c3fa6ea7a488a24 100644
--- a/include/v8-version.h
+++ b/include/v8-version.h
@@ -11,7 +11,7 @@
 #define V8_MAJOR_VERSION 4
 #define V8_MINOR_VERSION 6
 #define V8_BUILD_NUMBER 85
-#define V8_PATCH_LEVEL 11
+#define V8_PATCH_LEVEL 12

 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
Index: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index 624d462323a9574c278af3e01a240976509239ac..c61c29bf524ba300573958b13b96b1921e3fc1cd 100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -446,6 +446,7 @@ void ObjectLiteral::BuildConstantProperties(Isolate* isolate) {

     if (position == boilerplate_properties_ * 2) {
       DCHECK(property->is_computed_name());
+      is_simple = false;
       break;
     }
     DCHECK(!property->is_computed_name());
Index: test/mjsunit/es6/computed-property-names.js
diff --git a/test/mjsunit/es6/computed-property-names.js b/test/mjsunit/es6/computed-property-names.js index 80a047cc9cd3491aca0d9d9bacd390329e08606a..d75278cfe3f9759759dc334776df831c6ff0697c 100644
--- a/test/mjsunit/es6/computed-property-names.js
+++ b/test/mjsunit/es6/computed-property-names.js
@@ -298,3 +298,59 @@ function ID(x) {
     };
   }, MyError);
 })();
+
+
+(function TestNestedLiterals() {
+  var array = [
+    42,
+    { a: 'A',
+      ['b']: 'B',
+      c: 'C',
+      [ID('d')]: 'D',
+    },
+    43,
+  ];
+  assertEquals(42, array[0]);
+  assertEquals(43, array[2]);
+  assertEquals('A', array[1].a);
+  assertEquals('B', array[1].b);
+  assertEquals('C', array[1].c);
+  assertEquals('D', array[1].d);
+  var object = {
+    outer: 42,
+    inner: {
+      a: 'A',
+      ['b']: 'B',
+      c: 'C',
+      [ID('d')]: 'D',
+    },
+    outer2: 43,
+  };
+  assertEquals(42, object.outer);
+  assertEquals(43, object.outer2);
+  assertEquals('A', object.inner.a);
+  assertEquals('B', object.inner.b);
+  assertEquals('C', object.inner.c);
+  assertEquals('D', object.inner.d);
+  var object = {
+    outer: 42,
+    array: [
+      43,
+      { a: 'A',
+        ['b']: 'B',
+        c: 'C',
+        [ID('d')]: 'D',
+      },
+      44,
+    ],
+    outer2: 45
+  };
+  assertEquals(42, object.outer);
+  assertEquals(45, object.outer2);
+  assertEquals(43, object.array[0]);
+  assertEquals(44, object.array[2]);
+  assertEquals('A', object.array[1].a);
+  assertEquals('B', object.array[1].b);
+  assertEquals('C', object.array[1].c);
+  assertEquals('D', object.array[1].d);
+})();


--
--
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