summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/computed-property-names
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/computed-property-names')
-rw-r--r--js/src/tests/test262/language/computed-property-names/basics/browser.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/basics/number.js29
-rw-r--r--js/src/tests/test262/language/computed-property-names/basics/shell.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/basics/string.js28
-rw-r--r--js/src/tests/test262/language/computed-property-names/basics/symbol.js36
-rw-r--r--js/src/tests/test262/language/computed-property-names/browser.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/accessor/browser.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/accessor/getter-duplicates.js49
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/accessor/getter.js15
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/accessor/setter-duplicates.js57
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/accessor/setter.js17
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/accessor/shell.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/browser.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/method/browser.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/method/constructor-can-be-generator.js12
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/method/constructor-can-be-getter.js12
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/method/constructor-can-be-setter.js12
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/method/constructor-duplicate-1.js13
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/method/constructor-duplicate-2.js13
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/method/constructor-duplicate-3.js13
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/method/constructor.js19
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/method/generator.js25
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/method/number.js32
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/method/shell.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/method/string.js30
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/method/symbol.js37
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/shell.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/static/browser.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/static/generator-constructor.js13
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/static/generator-prototype.js15
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/static/getter-constructor.js13
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/static/getter-prototype.js15
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/static/method-constructor.js13
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/static/method-number-order.js70
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/static/method-number.js74
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/static/method-prototype.js16
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/static/method-string-order.js70
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/static/method-string.js74
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/static/method-symbol-order.js81
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/static/method-symbol.js81
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/static/setter-constructor.js13
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/static/setter-prototype.js16
-rw-r--r--js/src/tests/test262/language/computed-property-names/class/static/shell.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/accessor/browser.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/accessor/getter-duplicates.js49
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/accessor/getter-super.js48
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/accessor/getter.js15
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/accessor/setter-duplicates.js57
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/accessor/setter-super.js37
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/accessor/setter.js18
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/accessor/shell.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/browser.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/method/browser.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/method/generator.js20
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/method/number.js29
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/method/shell.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/method/string.js29
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/method/super.js32
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/method/symbol.js36
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/property/browser.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/property/number-duplicates.js52
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/property/shell.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/object/shell.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/shell.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/to-name-side-effects/browser.js0
-rw-r--r--js/src/tests/test262/language/computed-property-names/to-name-side-effects/class.js47
-rw-r--r--js/src/tests/test262/language/computed-property-names/to-name-side-effects/numbers-class.js50
-rw-r--r--js/src/tests/test262/language/computed-property-names/to-name-side-effects/numbers-object.js41
-rw-r--r--js/src/tests/test262/language/computed-property-names/to-name-side-effects/object.js38
-rw-r--r--js/src/tests/test262/language/computed-property-names/to-name-side-effects/shell.js0
70 files changed, 1611 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/computed-property-names/basics/browser.js b/js/src/tests/test262/language/computed-property-names/basics/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/basics/browser.js
diff --git a/js/src/tests/test262/language/computed-property-names/basics/number.js b/js/src/tests/test262/language/computed-property-names/basics/number.js
new file mode 100644
index 0000000000..264918d0c0
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/basics/number.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property names can be a number
+includes: [compareArray.js]
+---*/
+
+function ID(x) {
+ return x;
+}
+
+var object = {
+ a: 'A',
+ [1]: 'B',
+ c: 'C',
+ [ID(2)]: 'D',
+};
+assert.sameValue(object.a, 'A', "The value of `object.a` is `'A'`. Defined in `object` as `a: 'A'`");
+assert.sameValue(object[1], 'B', "The value of `object[1]` is `'B'`. Defined in `object` as `[1]: 'B'`");
+assert.sameValue(object.c, 'C', "The value of `object.c` is `'C'`. Defined in `object` as `c: 'C'`");
+assert.sameValue(object[2], 'D', "The value of `object[2]` is `'D'`. Defined in `object` as `[ID(2)]: 'D'`");
+assert.compareArray(
+ Object.getOwnPropertyNames(object),
+ ['1', '2', 'a', 'c']
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/basics/shell.js b/js/src/tests/test262/language/computed-property-names/basics/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/basics/shell.js
diff --git a/js/src/tests/test262/language/computed-property-names/basics/string.js b/js/src/tests/test262/language/computed-property-names/basics/string.js
new file mode 100644
index 0000000000..f4cc83a088
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/basics/string.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property names can be a string
+includes: [compareArray.js]
+---*/
+function ID(x) {
+ return x;
+}
+
+var object = {
+ a: 'A',
+ ['b']: 'B',
+ c: 'C',
+ [ID('d')]: 'D',
+};
+assert.sameValue(object.a, 'A', "The value of `object.a` is `'A'`. Defined in `object` as `a: 'A'`");
+assert.sameValue(object.b, 'B', "The value of `object.b` is `'B'`. Defined in `object` as `['b']: 'B'`");
+assert.sameValue(object.c, 'C', "The value of `object.c` is `'C'`. Defined in `object` as `c: 'C'`");
+assert.sameValue(object.d, 'D', "The value of `object.d` is `'D'`. Defined in `object` as `[ID('d')]: 'D'`");
+assert.compareArray(
+ Object.getOwnPropertyNames(object),
+ ['a', 'b', 'c', 'd']
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/basics/symbol.js b/js/src/tests/test262/language/computed-property-names/basics/symbol.js
new file mode 100644
index 0000000000..75d857f4c4
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/basics/symbol.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property names can be a symbol
+includes: [compareArray.js]
+features: [Symbol]
+---*/
+
+function ID(x) {
+ return x;
+}
+
+var sym1 = Symbol();
+var sym2 = Symbol();
+var object = {
+ a: 'A',
+ [sym1]: 'B',
+ c: 'C',
+ [ID(sym2)]: 'D',
+};
+assert.sameValue(object.a, 'A', "The value of `object.a` is `'A'`. Defined in `object` as `a: 'A'`");
+assert.sameValue(object[sym1], 'B', "The value of `object[sym1]` is `'B'`. Defined in `object` as `[sym1]: 'B'`");
+assert.sameValue(object.c, 'C', "The value of `object.c` is `'C'`. Defined in `object` as `c: 'C'`");
+assert.sameValue(object[sym2], 'D', "The value of `object[sym2]` is `'D'`. Defined in `object` as `[ID(sym2)]: 'D'`");
+assert.compareArray(
+ Object.getOwnPropertyNames(object),
+ ['a', 'c']
+);
+assert.compareArray(
+ Object.getOwnPropertySymbols(object),
+ [sym1, sym2]
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/browser.js b/js/src/tests/test262/language/computed-property-names/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/browser.js
diff --git a/js/src/tests/test262/language/computed-property-names/class/accessor/browser.js b/js/src/tests/test262/language/computed-property-names/class/accessor/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/accessor/browser.js
diff --git a/js/src/tests/test262/language/computed-property-names/class/accessor/getter-duplicates.js b/js/src/tests/test262/language/computed-property-names/class/accessor/getter-duplicates.js
new file mode 100644
index 0000000000..9cc193b0e8
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/accessor/getter-duplicates.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ In a class, duplicate computed property getter names produce only a single property of
+ that name, whose value is the value of the last property of that name.
+---*/
+class C {
+ get ['a']() {
+ return 'A';
+ }
+}
+assert.sameValue(new C().a, 'A', "The value of `new C().a` is `'A'`");
+
+class C2 {
+ get b() {
+ throw new Test262Error("The first `b` getter definition in `C2` is unreachable");
+ }
+ get ['b']() {
+ return 'B';
+ }
+}
+assert.sameValue(new C2().b, 'B', "The value of `new C2().b` is `'B'`");
+
+class C3 {
+ get c() {
+ throw new Test262Error("The first `c` getter definition in `C3` is unreachable");
+ }
+ get ['c']() {
+ throw new Test262Error("The second `c` getter definition in `C3` is unreachable");
+ }
+ get ['c']() {
+ return 'C';
+ }
+}
+assert.sameValue(new C3().c, 'C', "The value of `new C3().c` is `'C'`");
+
+class C4 {
+ get ['d']() {
+ throw new Test262Error("The first `d` getter definition in `C4` is unreachable");
+ }
+ get d() {
+ return 'D';
+ }
+}
+assert.sameValue(new C4().d, 'D', "The value of `new C4().d` is `'D'`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/accessor/getter.js b/js/src/tests/test262/language/computed-property-names/class/accessor/getter.js
new file mode 100644
index 0000000000..a00fba0aa3
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/accessor/getter.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ Computed property names for getters
+---*/
+class C {
+ get ['a']() {
+ return 'A';
+ }
+}
+assert.sameValue(new C().a, 'A', "The value of `new C().a` is `'A'`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/accessor/setter-duplicates.js b/js/src/tests/test262/language/computed-property-names/class/accessor/setter-duplicates.js
new file mode 100644
index 0000000000..f42801874e
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/accessor/setter-duplicates.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ In a class, duplicate computed property setter names produce only a single property of
+ that name, whose value is the value of the last property of that name.
+---*/
+var calls = 0;
+class C {
+ set ['a'](_) {
+ calls++;
+ }
+}
+new C().a = 'A';
+assert.sameValue(calls, 1, "The value of `calls` is `1`, after executing `new C().a = 'A';`");
+
+calls = 0;
+class C2 {
+ set b(_) {
+ throw new Test262Error("The first `b` setter definition in `C2` is unreachable");
+ }
+ set ['b'](_) {
+ calls++;
+ }
+}
+new C2().b = 'B';
+assert.sameValue(calls, 1, "The value of `calls` is `1`, after executing `new C2().b = 'B';`");
+
+calls = 0;
+class C3 {
+ set c(_) {
+ throw new Test262Error("The first `c` setter definition in `C3` is unreachable");
+ }
+ set ['c'](_) {
+ throw new Test262Error("The second `c` setter definition in `C3` is unreachable");
+ }
+ set ['c'](_) {
+ calls++
+ }
+}
+new C3().c = 'C';
+assert.sameValue(calls, 1, "The value of `calls` is `1`, after executing `new C3().c = 'C';`");
+
+calls = 0;
+class C4 {
+ set ['d'](_) {
+ throw new Test262Error("The first `d` setter definition in `C4` is unreachable");
+ }
+ set d(_) {
+ calls++
+ }
+}
+new C4().d = 'D';
+assert.sameValue(calls, 1, "The value of `calls` is `1`, after executing `new C4().d = 'D';`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/accessor/setter.js b/js/src/tests/test262/language/computed-property-names/class/accessor/setter.js
new file mode 100644
index 0000000000..0d1c0cc42b
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/accessor/setter.js
@@ -0,0 +1,17 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ Computed property names for setters
+---*/
+var calls = 0;
+class C {
+ set ['a'](_) {
+ calls++;
+ }
+}
+new C().a = 'A';
+assert.sameValue(calls, 1, "The value of `calls` is `1`, after executing `new C().a = 'A';`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/accessor/shell.js b/js/src/tests/test262/language/computed-property-names/class/accessor/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/accessor/shell.js
diff --git a/js/src/tests/test262/language/computed-property-names/class/browser.js b/js/src/tests/test262/language/computed-property-names/class/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/browser.js
diff --git a/js/src/tests/test262/language/computed-property-names/class/method/browser.js b/js/src/tests/test262/language/computed-property-names/class/method/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/method/browser.js
diff --git a/js/src/tests/test262/language/computed-property-names/class/method/constructor-can-be-generator.js b/js/src/tests/test262/language/computed-property-names/class/method/constructor-can-be-generator.js
new file mode 100644
index 0000000000..61e2a36607
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/method/constructor-can-be-generator.js
@@ -0,0 +1,12 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5.3
+description: >
+ computed property generator method names can be called "constructor"
+---*/
+class C4 {
+ *['constructor']() {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/method/constructor-can-be-getter.js b/js/src/tests/test262/language/computed-property-names/class/method/constructor-can-be-getter.js
new file mode 100644
index 0000000000..aab8a295a8
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/method/constructor-can-be-getter.js
@@ -0,0 +1,12 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5.3
+description: >
+ computed property getter names can be called "constructor"
+---*/
+class C4 {
+ get ['constructor']() {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/method/constructor-can-be-setter.js b/js/src/tests/test262/language/computed-property-names/class/method/constructor-can-be-setter.js
new file mode 100644
index 0000000000..a44fd56306
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/method/constructor-can-be-setter.js
@@ -0,0 +1,12 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5.3
+description: >
+ computed property setter names can be called "constructor"
+---*/
+class C4 {
+ set ['constructor'](_) {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/method/constructor-duplicate-1.js b/js/src/tests/test262/language/computed-property-names/class/method/constructor-duplicate-1.js
new file mode 100644
index 0000000000..7e35a35658
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/method/constructor-duplicate-1.js
@@ -0,0 +1,13 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property names can be "constructor"
+---*/
+class C {
+ constructor() {}
+ ['constructor']() {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/method/constructor-duplicate-2.js b/js/src/tests/test262/language/computed-property-names/class/method/constructor-duplicate-2.js
new file mode 100644
index 0000000000..9974c81deb
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/method/constructor-duplicate-2.js
@@ -0,0 +1,13 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property names can be "constructor"
+---*/
+class C {
+ ['constructor']() {}
+ constructor() {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/method/constructor-duplicate-3.js b/js/src/tests/test262/language/computed-property-names/class/method/constructor-duplicate-3.js
new file mode 100644
index 0000000000..48db7a2bdc
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/method/constructor-duplicate-3.js
@@ -0,0 +1,13 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property names can be "constructor"
+---*/
+class C {
+ ['constructor']() {}
+ ['constructor']() {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/method/constructor.js b/js/src/tests/test262/language/computed-property-names/class/method/constructor.js
new file mode 100644
index 0000000000..7b45364ff3
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/method/constructor.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property names can be "constructor"
+---*/
+class C {
+ ['constructor']() {
+ return 1;
+ }
+}
+assert(
+ C !== C.prototype.constructor,
+ "The result of `C !== C.prototype.constructor` is `true`"
+);
+assert.sameValue(new C().constructor(), 1, "`new C().constructor()` returns `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/method/generator.js b/js/src/tests/test262/language/computed-property-names/class/method/generator.js
new file mode 100644
index 0000000000..cfd471bc8c
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/method/generator.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property names can be used as the name of a generator method in a class
+includes: [compareArray.js]
+---*/
+class C {
+ *['a']() {
+ yield 1;
+ yield 2;
+ }
+}
+assert.sameValue(
+ Object.keys(C.prototype).length,
+ 0,
+ "The value of `Object.keys(C.prototype).length` is `0`"
+);
+assert.compareArray(
+ Object.getOwnPropertyNames(C.prototype),
+ ['constructor', 'a']
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/method/number.js b/js/src/tests/test262/language/computed-property-names/class/method/number.js
new file mode 100644
index 0000000000..e9ee5e12bc
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/method/number.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property class method names can be a number
+includes: [compareArray.js]
+---*/
+
+function ID(x) {
+ return x;
+}
+
+class C {
+ a() { return 'A'; }
+ [1]() { return 'B'; }
+ c() { return 'C'; }
+ [ID(2)]() { return 'D'; }
+}
+assert.sameValue(new C().a(), 'A', "`new C().a()` returns `'A'`, from `a() { return 'A'; }`");
+assert.sameValue(new C()[1](), 'B', "`new C()[1]()` returns `'B'`, from `[1]() { return 'B'; }`");
+assert.sameValue(new C().c(), 'C', "`new C().c()` returns `'C'`, from `c() { return 'C'; }`");
+assert.sameValue(new C()[2](), 'D', "`new C()[2]()` returns `'D'`, from `[ID(2)]() { return 'D'; }`");
+
+assert.sameValue(Object.keys(C.prototype).length, 0, "No enum keys from C.prototype");
+
+assert.compareArray(
+ Object.getOwnPropertyNames(C.prototype),
+ ['1', '2', 'constructor', 'a', 'c']
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/method/shell.js b/js/src/tests/test262/language/computed-property-names/class/method/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/method/shell.js
diff --git a/js/src/tests/test262/language/computed-property-names/class/method/string.js b/js/src/tests/test262/language/computed-property-names/class/method/string.js
new file mode 100644
index 0000000000..c152bc6c03
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/method/string.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property class method names can be a string
+includes: [compareArray.js]
+---*/
+
+function ID(x) {
+ return x;
+}
+
+class C {
+ a() { return 'A'}
+ ['b']() { return 'B'; }
+ c() { return 'C'; }
+ [ID('d')]() { return 'D'; }
+}
+assert.sameValue(new C().a(), 'A', "`new C().a()` returns `'A'`. Defined as `a() { return 'A'}`");
+assert.sameValue(new C().b(), 'B', "`new C().b()` returns `'B'`. Defined as `['b']() { return 'B'; }`");
+assert.sameValue(new C().c(), 'C', "`new C().c()` returns `'C'`. Defined as `c() { return 'C'; }`");
+assert.sameValue(new C().d(), 'D', "`new C().d()` returns `'D'`. Defined as `[ID('d')]() { return 'D'; }`");
+assert.sameValue(Object.keys(C.prototype).length, 0, "No enum keys from C.prototype");
+assert.compareArray(
+ Object.getOwnPropertyNames(C.prototype),
+ ['constructor', 'a', 'b', 'c', 'd']
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/method/symbol.js b/js/src/tests/test262/language/computed-property-names/class/method/symbol.js
new file mode 100644
index 0000000000..07bac0c9cd
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/method/symbol.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property class method names can be a symbol
+includes: [compareArray.js]
+features: [Symbol]
+---*/
+
+function ID(x) {
+ return x;
+}
+
+var sym1 = Symbol();
+var sym2 = Symbol();
+class C {
+ a() { return 'A'; }
+ [sym1]() { return 'B'; }
+ c() { return 'C'; }
+ [ID(sym2)]() { return 'D'; }
+}
+assert.sameValue(new C().a(), 'A', "`new C().a()` returns `'A'`. Defined as `a() { return 'A'; }`");
+assert.sameValue(new C()[sym1](), 'B', "`new C()[sym1]()` returns `'B'`. Defined as `[sym1]() { return 'B'; }`");
+assert.sameValue(new C().c(), 'C', "`new C().c()` returns `'C'`. Defined as `c() { return 'C'; }`");
+assert.sameValue(new C()[sym2](), 'D', "`new C()[sym2]()` returns `'D'`. Defined as `[ID(sym2)]() { return 'D'; }`");
+assert.sameValue(Object.keys(C.prototype).length, 0, "No enum keys from C.prototype");
+assert.compareArray(
+ Object.getOwnPropertyNames(C.prototype),
+ ['constructor', 'a', 'c']
+);
+assert.compareArray(
+ Object.getOwnPropertySymbols(C.prototype),
+ [sym1, sym2]
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/shell.js b/js/src/tests/test262/language/computed-property-names/class/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/shell.js
diff --git a/js/src/tests/test262/language/computed-property-names/class/static/browser.js b/js/src/tests/test262/language/computed-property-names/class/static/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/static/browser.js
diff --git a/js/src/tests/test262/language/computed-property-names/class/static/generator-constructor.js b/js/src/tests/test262/language/computed-property-names/class/static/generator-constructor.js
new file mode 100644
index 0000000000..ce81441d1a
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/static/generator-constructor.js
@@ -0,0 +1,13 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ In a class, computed property names for static
+ generators can be named "constructor"
+---*/
+class C {
+ static *['constructor']() {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/static/generator-prototype.js b/js/src/tests/test262/language/computed-property-names/class/static/generator-prototype.js
new file mode 100644
index 0000000000..7c3924caba
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/static/generator-prototype.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5.14
+description: >
+ In a class, computed property names for static
+ generators that are named "prototype" throw a TypeError
+---*/
+assert.throws(TypeError, function() {
+ class C {
+ static *['prototype']() {}
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/static/getter-constructor.js b/js/src/tests/test262/language/computed-property-names/class/static/getter-constructor.js
new file mode 100644
index 0000000000..7a12e11a55
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/static/getter-constructor.js
@@ -0,0 +1,13 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ In a class, computed property names for static
+ getters can be named "constructor"
+---*/
+class C {
+ static get ['constructor']() {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/static/getter-prototype.js b/js/src/tests/test262/language/computed-property-names/class/static/getter-prototype.js
new file mode 100644
index 0000000000..6f149b09dc
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/static/getter-prototype.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5.14
+description: >
+ In a class, computed property names for static
+ getters that are named "prototype" throw a TypeError
+---*/
+assert.throws(TypeError, function() {
+ class C {
+ static get ['prototype']() {}
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/static/method-constructor.js b/js/src/tests/test262/language/computed-property-names/class/static/method-constructor.js
new file mode 100644
index 0000000000..4250ccd8e5
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/static/method-constructor.js
@@ -0,0 +1,13 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ In a class, computed property names for static
+ methods can be named "constructor"
+---*/
+class C {
+ static ['constructor']() {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/static/method-number-order.js b/js/src/tests/test262/language/computed-property-names/class/static/method-number-order.js
new file mode 100644
index 0000000000..88bf48b833
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/static/method-number-order.js
@@ -0,0 +1,70 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ In a class, static computed property method names can be a number
+info: |
+ Set order: "length", "name", "prototype", static methods
+
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 11. Let constructorInfo be ! DefineMethod of constructor with arguments proto and constructorParent.
+ 12. Let F be constructorInfo.[[Closure]].
+ 13. Perform SetFunctionName(F, className).
+ 14. Perform MakeConstructor(F, false, proto).
+ ...
+ 19. Else, let methods be NonConstructorMethodDefinitions of ClassBody.
+ 20. For each ClassElement m in order from methods, do
+ a. If IsStatic of m is false, then
+ ...
+ b. Else,
+ i. Let status be PropertyDefinitionEvaluation of m with arguments F and false.
+ ...
+
+ ---
+
+ Object.getOwnPropertyNames ( O )
+
+ 1. Return ? GetOwnPropertyKeys(O, string).
+
+ Runtime Semantics: GetOwnPropertyKeys ( O, type )
+
+ 1. Let obj be ? ToObject(O).
+ 2. Let keys be ? obj.[[OwnPropertyKeys]]().
+ 3. Let nameList be a new empty List.
+ 4. For each element nextKey of keys in List order, do
+ a. If Type(nextKey) is Symbol and type is symbol or Type(nextKey) is String and type is string, then
+ i. Append nextKey as the last element of nameList.
+ 5. Return CreateArrayFromList(nameList).
+
+ [[OwnPropertyKeys]] ( )
+
+ 1. Return ! OrdinaryOwnPropertyKeys(O).
+
+ OrdinaryOwnPropertyKeys ( O )
+
+ 1. Let keys be a new empty List.
+ 2. For each own property key P of O such that P is an array index, in ascending numeric index order, do
+ a. Add P as the last element of keys.
+ 3. For each own property key P of O such that Type(P) is String and P is not an array index, in ascending chronological order of property creation, do
+ a. Add P as the last element of keys.
+ 4. For each own property key P of O such that Type(P) is Symbol, in ascending chronological order of property creation, do
+ a. Add P as the last element of keys.
+ 5. Return keys.
+includes: [compareArray.js]
+---*/
+
+class C {
+ static a() { return 'A'; }
+ static [1]() { return 'B'; }
+ static c() { return 'C'; }
+ static [2]() { return 'D'; }
+}
+assert.compareArray(
+ Object.getOwnPropertyNames(C),
+ ['1', '2', 'length', 'name', 'prototype', 'a', 'c']
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/static/method-number.js b/js/src/tests/test262/language/computed-property-names/class/static/method-number.js
new file mode 100644
index 0000000000..22e5fc593f
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/static/method-number.js
@@ -0,0 +1,74 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ In a class, static computed property method names can be a number
+info: |
+ Set order: "length", "name", "prototype", static methods
+
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 11. Let constructorInfo be ! DefineMethod of constructor with arguments proto and constructorParent.
+ 12. Let F be constructorInfo.[[Closure]].
+ 13. Perform SetFunctionName(F, className).
+ 14. Perform MakeConstructor(F, false, proto).
+ ...
+ 19. Else, let methods be NonConstructorMethodDefinitions of ClassBody.
+ 20. For each ClassElement m in order from methods, do
+ a. If IsStatic of m is false, then
+ ...
+ b. Else,
+ i. Let status be PropertyDefinitionEvaluation of m with arguments F and false.
+ ...
+
+ ---
+
+ Object.getOwnPropertyNames ( O )
+
+ 1. Return ? GetOwnPropertyKeys(O, string).
+
+ Runtime Semantics: GetOwnPropertyKeys ( O, type )
+
+ 1. Let obj be ? ToObject(O).
+ 2. Let keys be ? obj.[[OwnPropertyKeys]]().
+ 3. Let nameList be a new empty List.
+ 4. For each element nextKey of keys in List order, do
+ a. If Type(nextKey) is Symbol and type is symbol or Type(nextKey) is String and type is string, then
+ i. Append nextKey as the last element of nameList.
+ 5. Return CreateArrayFromList(nameList).
+
+ [[OwnPropertyKeys]] ( )
+
+ 1. Return ! OrdinaryOwnPropertyKeys(O).
+
+ OrdinaryOwnPropertyKeys ( O )
+
+ 1. Let keys be a new empty List.
+ 2. For each own property key P of O such that P is an array index, in ascending numeric index order, do
+ a. Add P as the last element of keys.
+ 3. For each own property key P of O such that Type(P) is String and P is not an array index, in ascending chronological order of property creation, do
+ a. Add P as the last element of keys.
+ 4. For each own property key P of O such that Type(P) is Symbol, in ascending chronological order of property creation, do
+ a. Add P as the last element of keys.
+ 5. Return keys.
+includes: [compareArray.js]
+---*/
+
+class C {
+ static a() { return 'A'; }
+ static [1]() { return 'B'; }
+ static c() { return 'C'; }
+ static [2]() { return 'D'; }
+}
+assert.sameValue(C.a(), 'A', "`C.a()` returns `'A'`. Defined as `static a() { return 'A'; }`");
+assert.sameValue(C[1](), 'B', "`C[1]()` returns `'B'`. Defined as `static [1]() { return 'B'; }`");
+assert.sameValue(C.c(), 'C', "`C.c()` returns `'C'`. Defined as `static c() { return 'C'; }`");
+assert.sameValue(C[2](), 'D', "`C[2]()` returns `'D'`. Defined as `static [2]() { return 'D'; }`");
+assert.compareArray(
+ Object.keys(C),
+ []
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/static/method-prototype.js b/js/src/tests/test262/language/computed-property-names/class/static/method-prototype.js
new file mode 100644
index 0000000000..517d81ee4b
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/static/method-prototype.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5.14
+description: >
+ In a class, computed property names for static
+ methods that are named "prototype" throw a TypeError
+---*/
+
+assert.throws(TypeError, function() {
+ class C {
+ static ['prototype']() {}
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/static/method-string-order.js b/js/src/tests/test262/language/computed-property-names/class/static/method-string-order.js
new file mode 100644
index 0000000000..7ac43319ab
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/static/method-string-order.js
@@ -0,0 +1,70 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ In a class, static computed property method names can be a string
+info: |
+ Set order: "length", "name", "prototype", static methods
+
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 11. Let constructorInfo be ! DefineMethod of constructor with arguments proto and constructorParent.
+ 12. Let F be constructorInfo.[[Closure]].
+ 13. Perform SetFunctionName(F, className).
+ 14. Perform MakeConstructor(F, false, proto).
+ ...
+ 19. Else, let methods be NonConstructorMethodDefinitions of ClassBody.
+ 20. For each ClassElement m in order from methods, do
+ a. If IsStatic of m is false, then
+ ...
+ b. Else,
+ i. Let status be PropertyDefinitionEvaluation of m with arguments F and false.
+ ...
+
+ ---
+
+ Object.getOwnPropertyNames ( O )
+
+ 1. Return ? GetOwnPropertyKeys(O, string).
+
+ Runtime Semantics: GetOwnPropertyKeys ( O, type )
+
+ 1. Let obj be ? ToObject(O).
+ 2. Let keys be ? obj.[[OwnPropertyKeys]]().
+ 3. Let nameList be a new empty List.
+ 4. For each element nextKey of keys in List order, do
+ a. If Type(nextKey) is Symbol and type is symbol or Type(nextKey) is String and type is string, then
+ i. Append nextKey as the last element of nameList.
+ 5. Return CreateArrayFromList(nameList).
+
+ [[OwnPropertyKeys]] ( )
+
+ 1. Return ! OrdinaryOwnPropertyKeys(O).
+
+ OrdinaryOwnPropertyKeys ( O )
+
+ 1. Let keys be a new empty List.
+ 2. For each own property key P of O such that P is an array index, in ascending numeric index order, do
+ a. Add P as the last element of keys.
+ 3. For each own property key P of O such that Type(P) is String and P is not an array index, in ascending chronological order of property creation, do
+ a. Add P as the last element of keys.
+ 4. For each own property key P of O such that Type(P) is Symbol, in ascending chronological order of property creation, do
+ a. Add P as the last element of keys.
+ 5. Return keys.
+includes: [compareArray.js]
+---*/
+
+class C {
+ static a() { return 'A'}
+ static ['b']() { return 'B'; }
+ static c() { return 'C'; }
+ static ['d']() { return 'D'; }
+}
+assert.compareArray(
+ Object.getOwnPropertyNames(C),
+ ['length', 'name', 'prototype', 'a', 'b', 'c', 'd']
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/static/method-string.js b/js/src/tests/test262/language/computed-property-names/class/static/method-string.js
new file mode 100644
index 0000000000..0c0fdf8718
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/static/method-string.js
@@ -0,0 +1,74 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ In a class, static computed property method names can be a string
+info: |
+ Set order: "length", "name", "prototype", static methods
+
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 11. Let constructorInfo be ! DefineMethod of constructor with arguments proto and constructorParent.
+ 12. Let F be constructorInfo.[[Closure]].
+ 13. Perform SetFunctionName(F, className).
+ 14. Perform MakeConstructor(F, false, proto).
+ ...
+ 19. Else, let methods be NonConstructorMethodDefinitions of ClassBody.
+ 20. For each ClassElement m in order from methods, do
+ a. If IsStatic of m is false, then
+ ...
+ b. Else,
+ i. Let status be PropertyDefinitionEvaluation of m with arguments F and false.
+ ...
+
+ ---
+
+ Object.getOwnPropertyNames ( O )
+
+ 1. Return ? GetOwnPropertyKeys(O, string).
+
+ Runtime Semantics: GetOwnPropertyKeys ( O, type )
+
+ 1. Let obj be ? ToObject(O).
+ 2. Let keys be ? obj.[[OwnPropertyKeys]]().
+ 3. Let nameList be a new empty List.
+ 4. For each element nextKey of keys in List order, do
+ a. If Type(nextKey) is Symbol and type is symbol or Type(nextKey) is String and type is string, then
+ i. Append nextKey as the last element of nameList.
+ 5. Return CreateArrayFromList(nameList).
+
+ [[OwnPropertyKeys]] ( )
+
+ 1. Return ! OrdinaryOwnPropertyKeys(O).
+
+ OrdinaryOwnPropertyKeys ( O )
+
+ 1. Let keys be a new empty List.
+ 2. For each own property key P of O such that P is an array index, in ascending numeric index order, do
+ a. Add P as the last element of keys.
+ 3. For each own property key P of O such that Type(P) is String and P is not an array index, in ascending chronological order of property creation, do
+ a. Add P as the last element of keys.
+ 4. For each own property key P of O such that Type(P) is Symbol, in ascending chronological order of property creation, do
+ a. Add P as the last element of keys.
+ 5. Return keys.
+includes: [compareArray.js]
+---*/
+
+class C {
+ static a() { return 'A'}
+ static ['b']() { return 'B'; }
+ static c() { return 'C'; }
+ static ['d']() { return 'D'; }
+}
+assert.sameValue(C.a(), 'A', "`C.a()` returns `'A'`. Defined as `static a() { return 'A'}`");
+assert.sameValue(C.b(), 'B', "`C.b()` returns `'B'`. Defined as `static ['b']() { return 'B'; }`");
+assert.sameValue(C.c(), 'C', "`C.c()` returns `'C'`. Defined as `static c() { return 'C'; }`");
+assert.sameValue(C.d(), 'D', "`C.d()` returns `'D'`. Defined as `static ['d']() { return 'D'; }`");
+assert.compareArray(
+ Object.keys(C),
+ []
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/static/method-symbol-order.js b/js/src/tests/test262/language/computed-property-names/class/static/method-symbol-order.js
new file mode 100644
index 0000000000..639013ed38
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/static/method-symbol-order.js
@@ -0,0 +1,81 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ In a class, static computed property method names can be a symbol
+info: |
+ Set order: "length", "name", "prototype", static methods
+
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 11. Let constructorInfo be ! DefineMethod of constructor with arguments proto and constructorParent.
+ 12. Let F be constructorInfo.[[Closure]].
+ 13. Perform SetFunctionName(F, className).
+ 14. Perform MakeConstructor(F, false, proto).
+ ...
+ 19. Else, let methods be NonConstructorMethodDefinitions of ClassBody.
+ 20. For each ClassElement m in order from methods, do
+ a. If IsStatic of m is false, then
+ ...
+ b. Else,
+ i. Let status be PropertyDefinitionEvaluation of m with arguments F and false.
+ ...
+
+ ---
+
+ Object.getOwnPropertyNames ( O )
+
+ 1. Return ? GetOwnPropertyKeys(O, string).
+
+ Object.getOwnPropertySymbols ( O )
+
+ 1. Return ? GetOwnPropertyKeys(O, symbol).
+
+ Runtime Semantics: GetOwnPropertyKeys ( O, type )
+
+ 1. Let obj be ? ToObject(O).
+ 2. Let keys be ? obj.[[OwnPropertyKeys]]().
+ 3. Let nameList be a new empty List.
+ 4. For each element nextKey of keys in List order, do
+ a. If Type(nextKey) is Symbol and type is symbol or Type(nextKey) is String and type is string, then
+ i. Append nextKey as the last element of nameList.
+ 5. Return CreateArrayFromList(nameList).
+
+ [[OwnPropertyKeys]] ( )
+
+ 1. Return ! OrdinaryOwnPropertyKeys(O).
+
+ OrdinaryOwnPropertyKeys ( O )
+
+ 1. Let keys be a new empty List.
+ 2. For each own property key P of O such that P is an array index, in ascending numeric index order, do
+ a. Add P as the last element of keys.
+ 3. For each own property key P of O such that Type(P) is String and P is not an array index, in ascending chronological order of property creation, do
+ a. Add P as the last element of keys.
+ 4. For each own property key P of O such that Type(P) is Symbol, in ascending chronological order of property creation, do
+ a. Add P as the last element of keys.
+ 5. Return keys.
+includes: [compareArray.js]
+features: [Symbol]
+---*/
+
+var sym1 = Symbol();
+var sym2 = Symbol();
+class C {
+ static a() { return 'A'; }
+ static [sym1]() { return 'B'; }
+ static c() { return 'C'; }
+ static [sym2]() { return 'D'; }
+}
+assert.compareArray(
+ Object.getOwnPropertyNames(C),
+ ['length', 'name', 'prototype', 'a', 'c']
+);
+assert.compareArray(
+ Object.getOwnPropertySymbols(C),
+ [sym1, sym2]
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/static/method-symbol.js b/js/src/tests/test262/language/computed-property-names/class/static/method-symbol.js
new file mode 100644
index 0000000000..5811db0a36
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/static/method-symbol.js
@@ -0,0 +1,81 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ In a class, static computed property method names can be a symbol
+info: |
+ Set order: "length", "name", "prototype", static methods
+
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 11. Let constructorInfo be ! DefineMethod of constructor with arguments proto and constructorParent.
+ 12. Let F be constructorInfo.[[Closure]].
+ 13. Perform SetFunctionName(F, className).
+ 14. Perform MakeConstructor(F, false, proto).
+ ...
+ 19. Else, let methods be NonConstructorMethodDefinitions of ClassBody.
+ 20. For each ClassElement m in order from methods, do
+ a. If IsStatic of m is false, then
+ ...
+ b. Else,
+ i. Let status be PropertyDefinitionEvaluation of m with arguments F and false.
+ ...
+
+ ---
+
+ Object.getOwnPropertyNames ( O )
+
+ 1. Return ? GetOwnPropertyKeys(O, string).
+
+ Object.getOwnPropertySymbols ( O )
+
+ 1. Return ? GetOwnPropertyKeys(O, symbol).
+
+ Runtime Semantics: GetOwnPropertyKeys ( O, type )
+
+ 1. Let obj be ? ToObject(O).
+ 2. Let keys be ? obj.[[OwnPropertyKeys]]().
+ 3. Let nameList be a new empty List.
+ 4. For each element nextKey of keys in List order, do
+ a. If Type(nextKey) is Symbol and type is symbol or Type(nextKey) is String and type is string, then
+ i. Append nextKey as the last element of nameList.
+ 5. Return CreateArrayFromList(nameList).
+
+ [[OwnPropertyKeys]] ( )
+
+ 1. Return ! OrdinaryOwnPropertyKeys(O).
+
+ OrdinaryOwnPropertyKeys ( O )
+
+ 1. Let keys be a new empty List.
+ 2. For each own property key P of O such that P is an array index, in ascending numeric index order, do
+ a. Add P as the last element of keys.
+ 3. For each own property key P of O such that Type(P) is String and P is not an array index, in ascending chronological order of property creation, do
+ a. Add P as the last element of keys.
+ 4. For each own property key P of O such that Type(P) is Symbol, in ascending chronological order of property creation, do
+ a. Add P as the last element of keys.
+ 5. Return keys.
+includes: [compareArray.js]
+features: [Symbol]
+---*/
+
+var sym1 = Symbol();
+var sym2 = Symbol();
+class C {
+ static a() { return 'A'; }
+ static [sym1]() { return 'B'; }
+ static c() { return 'C'; }
+ static [sym2]() { return 'D'; }
+}
+assert.sameValue(C.a(), 'A', "`C.a()` returns `'A'`. Defined as `static a() { return 'A'; }`");
+assert.sameValue(C[sym1](), 'B', "`C[sym1]()` returns `'B'`. Defined as `static [sym1]() { return 'B'; }`");
+assert.sameValue(C.c(), 'C', "`C.c()` returns `'C'`. Defined as `static c() { return 'C'; }`");
+assert.sameValue(C[sym2](), 'D', "`C[sym2]()` returns `'D'`. Defined as `static [sym2]() { return 'D'; }`");
+assert.compareArray(
+ Object.keys(C),
+ []
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/static/setter-constructor.js b/js/src/tests/test262/language/computed-property-names/class/static/setter-constructor.js
new file mode 100644
index 0000000000..fbbb825b14
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/static/setter-constructor.js
@@ -0,0 +1,13 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ In a class, computed property names for static
+ setters can be named "constructor"
+---*/
+class C {
+ static set ['constructor'](x) {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/static/setter-prototype.js b/js/src/tests/test262/language/computed-property-names/class/static/setter-prototype.js
new file mode 100644
index 0000000000..c18bd5a253
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/static/setter-prototype.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5.14
+description: >
+ In a class, computed property names for static
+ setters that are named "prototype" throw a TypeError
+---*/
+
+assert.throws(TypeError, function() {
+ class C {
+ static set ['prototype'](x) {}
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/class/static/shell.js b/js/src/tests/test262/language/computed-property-names/class/static/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/class/static/shell.js
diff --git a/js/src/tests/test262/language/computed-property-names/object/accessor/browser.js b/js/src/tests/test262/language/computed-property-names/object/accessor/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/accessor/browser.js
diff --git a/js/src/tests/test262/language/computed-property-names/object/accessor/getter-duplicates.js b/js/src/tests/test262/language/computed-property-names/object/accessor/getter-duplicates.js
new file mode 100644
index 0000000000..aad4df1f90
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/accessor/getter-duplicates.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ In an object, duplicate computed property getter names produce only a single property of
+ that name, whose value is the value of the last property of that name.
+---*/
+var A = {
+ get ['a']() {
+ return 'A';
+ }
+};
+assert.sameValue(A.a, 'A', "The value of `A.a` is `'A'`");
+
+var B = {
+ get b() {
+ throw new Test262Error("The `b` getter definition in `B` is unreachable");
+ },
+ get ['b']() {
+ return 'B';
+ }
+};
+assert.sameValue(B.b, 'B', "The value of `B.b` is `'B'`");
+
+var C = {
+ get c() {
+ throw new Test262Error("The `c` getter definition in `C` is unreachable");
+ },
+ get ['c']() {
+ throw new Test262Error("The `['c']` getter definition in `C` is unreachable");
+ },
+ get ['c']() {
+ return 'C';
+ }
+};
+assert.sameValue(C.c, 'C', "The value of `C.c` is `'C'`");
+
+var D = {
+ get ['d']() {
+ throw new Test262Error("The `['d']` getter definition in `D` is unreachable");
+ },
+ get d() {
+ return 'D';
+ }
+};
+assert.sameValue(D.d, 'D', "The value of `D.d` is `'D'`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/object/accessor/getter-super.js b/js/src/tests/test262/language/computed-property-names/object/accessor/getter-super.js
new file mode 100644
index 0000000000..5835827edb
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/accessor/getter-super.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property getters can call super methods
+---*/
+
+function ID(x) {
+ return x;
+}
+
+var proto = {
+ m() {
+ return ' proto m';
+ }
+};
+var object = {
+ get ['a']() { return 'a' + super.m(); },
+ get [ID('b')]() { return 'b' + super.m(); },
+ get [0]() { return '0' + super.m(); },
+ get [ID(1)]() { return '1' + super.m(); },
+};
+
+Object.setPrototypeOf(object, proto);
+
+assert.sameValue(
+ object.a,
+ 'a proto m',
+ "The value of `object.a` is `'a proto m'`. Defined as `get ['a']() { return 'a' + super.m(); }`"
+);
+assert.sameValue(
+ object.b,
+ 'b proto m',
+ "The value of `object.b` is `'b proto m'`. Defined as `get [ID('b')]() { return 'b' + super.m(); }`"
+);
+assert.sameValue(
+ object[0],
+ '0 proto m',
+ "The value of `object[0]` is `'0 proto m'`. Defined as `get [0]() { return '0' + super.m(); }`"
+);
+assert.sameValue(
+ object[1],
+ '1 proto m',
+ "The value of `object[1]` is `'1 proto m'`. Defined as `get [ID(1)]() { return '1' + super.m(); }`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/object/accessor/getter.js b/js/src/tests/test262/language/computed-property-names/object/accessor/getter.js
new file mode 100644
index 0000000000..2125ee6139
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/accessor/getter.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ Computed property names for getters
+---*/
+var A = {
+ get ["a"]() {
+ return "A";
+ }
+};
+assert.sameValue(A.a, "A", "The value of `A.a` is `'A'`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/object/accessor/setter-duplicates.js b/js/src/tests/test262/language/computed-property-names/object/accessor/setter-duplicates.js
new file mode 100644
index 0000000000..e31896f391
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/accessor/setter-duplicates.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ In an object, duplicate computed property getter names produce only a single property of
+ that name, whose value is the value of the last property of that name.
+---*/
+var calls = 0;
+var A = {
+ set ['a'](_) {
+ calls++;
+ }
+};
+A.a = 'A';
+assert.sameValue(calls, 1, "The value of `calls` is `1`");
+
+calls = 0;
+var B = {
+ set b(_) {
+ throw new Test262Error("The `b` setter definition in `B` is unreachable");
+ },
+ set ['b'](_) {
+ calls++;
+ }
+};
+B.b = 'B';
+assert.sameValue(calls, 1, "The value of `calls` is `1`");
+
+calls = 0;
+var C = {
+ set c(_) {
+ throw new Test262Error("The `c` setter definition in `C` is unreachable");
+ },
+ set ['c'](_) {
+ throw new Test262Error("The first `['c']` setter definition in `C` is unreachable");
+ },
+ set ['c'](_) {
+ calls++
+ }
+};
+C.c = 'C';
+assert.sameValue(calls, 1, "The value of `calls` is `1`");
+
+calls = 0;
+var D = {
+ set ['d'](_) {
+ throw new Test262Error("The `['d']` setter definition in `D` is unreachable");
+ },
+ set d(_) {
+ calls++
+ }
+};
+D.d = 'D';
+assert.sameValue(calls, 1, "The value of `calls` is `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/object/accessor/setter-super.js b/js/src/tests/test262/language/computed-property-names/object/accessor/setter-super.js
new file mode 100644
index 0000000000..2fdba56bf9
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/accessor/setter-super.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property setters can call super methods
+---*/
+
+function ID(x) {
+ return x;
+}
+
+var value;
+var proto = {
+ m(name, v) {
+ value = name + ' ' + v;
+ }
+};
+var object = {
+ set ['a'](v) { super.m('a', v); },
+ set [ID('b')](v) { super.m('b', v); },
+ set [0](v) { super.m('0', v); },
+ set [ID(1)](v) { super.m('1', v); },
+};
+
+Object.setPrototypeOf(object, proto);
+
+object.a = 2;
+assert.sameValue(value, 'a 2', "The value of `value` is `'a 2'`, after executing `object.a = 2;`");
+object.b = 3;
+assert.sameValue(value, 'b 3', "The value of `value` is `'b 3'`, after executing `object.b = 3;`");
+object[0] = 4;
+assert.sameValue(value, '0 4', "The value of `value` is `'0 4'`, after executing `object[0] = 4;`");
+object[1] = 5;
+assert.sameValue(value, '1 5', "The value of `value` is `'1 5'`, after executing `object[1] = 5;`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/object/accessor/setter.js b/js/src/tests/test262/language/computed-property-names/object/accessor/setter.js
new file mode 100644
index 0000000000..cb0b327dcf
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/accessor/setter.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ In an object, duplicate computed property getter names produce only a single property of
+ that name, whose value is the value of the last property of that name.
+---*/
+var calls = 0;
+var A = {
+ set ['a'](_) {
+ calls++;
+ }
+};
+A.a = 'A';
+assert.sameValue(calls, 1, "The value of `calls` is `1`, after executing `A.a = 'A';`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/object/accessor/shell.js b/js/src/tests/test262/language/computed-property-names/object/accessor/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/accessor/shell.js
diff --git a/js/src/tests/test262/language/computed-property-names/object/browser.js b/js/src/tests/test262/language/computed-property-names/object/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/browser.js
diff --git a/js/src/tests/test262/language/computed-property-names/object/method/browser.js b/js/src/tests/test262/language/computed-property-names/object/method/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/method/browser.js
diff --git a/js/src/tests/test262/language/computed-property-names/object/method/generator.js b/js/src/tests/test262/language/computed-property-names/object/method/generator.js
new file mode 100644
index 0000000000..f52d807bcb
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/method/generator.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property names can be used as the name of a generator method in an object
+includes: [compareArray.js]
+---*/
+var object = {
+ *['a']() {
+ yield 1;
+ yield 2;
+ }
+};
+assert.compareArray(
+ Object.keys(object),
+ ['a']
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/object/method/number.js b/js/src/tests/test262/language/computed-property-names/object/method/number.js
new file mode 100644
index 0000000000..446f6f4a77
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/method/number.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property method names can be a number
+includes: [compareArray.js]
+---*/
+
+function ID(x) {
+ return x;
+}
+
+var object = {
+ a() { return 'A'; },
+ [1]() { return 'B'; },
+ c() { return 'C'; },
+ [ID(2)]() { return 'D'; },
+};
+assert.sameValue(object.a(), 'A', "`object.a()` returns `'A'`. Defined as `a() { return 'A'; }`");
+assert.sameValue(object[1](), 'B', "`object[1]()` returns `'B'`. Defined as `[1]() { return 'B'; }`");
+assert.sameValue(object.c(), 'C', "`object.c()` returns `'C'`. Defined as `c() { return 'C'; }`");
+assert.sameValue(object[2](), 'D', "`object[2]()` returns `'D'`. Defined as `[ID(2)]() { return 'D'; }`");
+assert.compareArray(
+ Object.getOwnPropertyNames(object),
+ ['1', '2', 'a', 'c']
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/object/method/shell.js b/js/src/tests/test262/language/computed-property-names/object/method/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/method/shell.js
diff --git a/js/src/tests/test262/language/computed-property-names/object/method/string.js b/js/src/tests/test262/language/computed-property-names/object/method/string.js
new file mode 100644
index 0000000000..fc165ffbe4
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/method/string.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property method names can be a string
+includes: [compareArray.js]
+---*/
+
+function ID(x) {
+ return x;
+}
+
+var object = {
+ a() { return 'A'},
+ ['b']() { return 'B'; },
+ c() { return 'C'; },
+ [ID('d')]() { return 'D'; },
+};
+assert.sameValue(object.a(), 'A', "`object.a()` returns `'A'`. Defined as `a() { return 'A'}`");
+assert.sameValue(object.b(), 'B', "`object.b()` returns `'B'`. Defined as `['b']() { return 'B'; }`");
+assert.sameValue(object.c(), 'C', "`object.c()` returns `'C'`. Defined as `c() { return 'C'; }`");
+assert.sameValue(object.d(), 'D', "`object.d()` returns `'D'`. Defined as `[ID('d')]() { return 'D'; }`");
+assert.compareArray(
+ Object.getOwnPropertyNames(object),
+ ['a', 'b', 'c', 'd']
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/object/method/super.js b/js/src/tests/test262/language/computed-property-names/object/method/super.js
new file mode 100644
index 0000000000..3f7484e318
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/method/super.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property methods can call super methods
+---*/
+
+function ID(x) {
+ return x;
+}
+
+var proto = {
+ m() {
+ return ' proto m';
+ }
+};
+var object = {
+ ['a']() { return 'a' + super.m(); },
+ [ID('b')]() { return 'b' + super.m(); },
+ [0]() { return '0' + super.m(); },
+ [ID(1)]() { return '1' + super.m(); },
+};
+
+Object.setPrototypeOf(object, proto);
+
+assert.sameValue(object.a(), 'a proto m', "`object.a()` returns `'a proto m'`, after executing `Object.setPrototypeOf(object, proto);`");
+assert.sameValue(object.b(), 'b proto m', "`object.b()` returns `'b proto m'`, after executing `Object.setPrototypeOf(object, proto);`");
+assert.sameValue(object[0](), '0 proto m', "`object[0]()` returns `'0 proto m'`, after executing `Object.setPrototypeOf(object, proto);`");
+assert.sameValue(object[1](), '1 proto m', "`object[1]()` returns `'1 proto m'`, after executing `Object.setPrototypeOf(object, proto);`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/object/method/symbol.js b/js/src/tests/test262/language/computed-property-names/object/method/symbol.js
new file mode 100644
index 0000000000..6cef8af585
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/method/symbol.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property method names can be a symbol
+includes: [compareArray.js]
+features: [Symbol]
+---*/
+
+function ID(x) {
+ return x;
+}
+
+var sym1 = Symbol();
+var sym2 = Symbol();
+var object = {
+ a() { return 'A'; },
+ [sym1]() { return 'B'; },
+ c() { return 'C'; },
+ [ID(sym2)]() { return 'D'; },
+};
+assert.sameValue(object.a(), 'A', "`object.a()` returns `'A'`. Defined as `a() { return 'A'; }`");
+assert.sameValue(object[sym1](), 'B', "`object[sym1]()` returns `'B'`. Defined as `[sym1]() { return 'B'; }`");
+assert.sameValue(object.c(), 'C', "`object.c()` returns `'C'`. Defined as `c() { return 'C'; }`");
+assert.sameValue(object[sym2](), 'D', "`object[sym2]()` returns `'D'`. Defined as `[ID(sym2)]() { return 'D'; }`");
+assert.compareArray(
+ Object.getOwnPropertyNames(object),
+ ['a', 'c']
+);
+assert.compareArray(
+ Object.getOwnPropertySymbols(object),
+ [sym1, sym2]
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/object/property/browser.js b/js/src/tests/test262/language/computed-property-names/object/property/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/property/browser.js
diff --git a/js/src/tests/test262/language/computed-property-names/object/property/number-duplicates.js b/js/src/tests/test262/language/computed-property-names/object/property/number-duplicates.js
new file mode 100644
index 0000000000..8f0ec366d7
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/property/number-duplicates.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ computed property names can be numbers
+---*/
+var object = {
+ [1.2]: 'A',
+ [1e55]: 'B',
+ [0.000001]: 'C',
+ [-0]: 'D',
+ [Infinity]: 'E',
+ [-Infinity]: 'F',
+ [NaN]: 'G',
+};
+assert.sameValue(
+ object['1.2'],
+ 'A',
+ "The value of `object['1.2']` is `'A'`. Defined as `[1.2]: 'A'`"
+);
+assert.sameValue(
+ object['1e+55'],
+ 'B',
+ "The value of `object['1e+55']` is `'B'`. Defined as `[1e55]: 'B'`"
+);
+assert.sameValue(
+ object['0.000001'],
+ 'C',
+ "The value of `object['0.000001']` is `'C'`. Defined as `[0.000001]: 'C'`"
+);
+assert.sameValue(
+ object[0],
+ 'D',
+ "The value of `object[0]` is `'D'`. Defined as `[-0]: 'D'`"
+);
+assert.sameValue(object[Infinity],
+ 'E',
+ "The value of `object[Infinity]` is `'E'`. Defined as `[Infinity]: 'E'`"
+);
+assert.sameValue(
+ object[-Infinity],
+ 'F',
+ "The value of `object[-Infinity]` is `'F'`. Defined as `[-Infinity]: 'F'`"
+);
+assert.sameValue(
+ object[NaN],
+ 'G',
+ "The value of `object[NaN]` is `'G'`. Defined as `[NaN]: 'G'`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/object/property/shell.js b/js/src/tests/test262/language/computed-property-names/object/property/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/property/shell.js
diff --git a/js/src/tests/test262/language/computed-property-names/object/shell.js b/js/src/tests/test262/language/computed-property-names/object/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/object/shell.js
diff --git a/js/src/tests/test262/language/computed-property-names/shell.js b/js/src/tests/test262/language/computed-property-names/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/shell.js
diff --git a/js/src/tests/test262/language/computed-property-names/to-name-side-effects/browser.js b/js/src/tests/test262/language/computed-property-names/to-name-side-effects/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/to-name-side-effects/browser.js
diff --git a/js/src/tests/test262/language/computed-property-names/to-name-side-effects/class.js b/js/src/tests/test262/language/computed-property-names/to-name-side-effects/class.js
new file mode 100644
index 0000000000..8d78ca0852
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/to-name-side-effects/class.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ to name, accessor side effects 3
+includes: [compareArray.js]
+---*/
+var counter = 0;
+var key1ToString = [];
+var key2ToString = [];
+var key1 = {
+ toString: function() {
+ key1ToString.push(counter);
+ counter += 1;
+ return 'b';
+ }
+};
+var key2 = {
+ toString: function() {
+ key2ToString.push(counter);
+ counter += 1;
+ return 'd';
+ }
+};
+class C {
+ a() { return 'A'; }
+ [key1]() { return 'B'; }
+ c() { return 'C'; }
+ [key2]() { return 'D'; }
+}
+
+assert.compareArray(key1ToString, [0], "order set for key1");
+assert.compareArray(key2ToString, [1], "order set for key2");
+
+assert.sameValue(counter, 2, "The value of `counter` is `2`");
+assert.sameValue(new C().a(), 'A', "`new C().a()` returns `'A'`. Defined as `a() { return 'A'; }`");
+assert.sameValue(new C().b(), 'B', "`new C().b()` returns `'B'`. Defined as `[key1]() { return 'B'; }`");
+assert.sameValue(new C().c(), 'C', "`new C().c()` returns `'C'`. Defined as `c() { return 'C'; }`");
+assert.sameValue(new C().d(), 'D', "`new C().d()` returns `'D'`. Defined as `[key2]() { return 'D'; }`");
+assert.sameValue(Object.keys(C.prototype).length, 0, "No enum keys from C.prototype");
+assert(
+ compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'b', 'c', 'd']),
+ "`compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'b', 'c', 'd'])` returns `true`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/to-name-side-effects/numbers-class.js b/js/src/tests/test262/language/computed-property-names/to-name-side-effects/numbers-class.js
new file mode 100644
index 0000000000..1c8128aa1e
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/to-name-side-effects/numbers-class.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ to name, accessor side effects numbers 2
+includes: [compareArray.js]
+---*/
+var counter = 0;
+var key1vof = [];
+var key2vof = [];
+var key1 = {
+ valueOf: function() {
+ key1vof.push(counter);
+ counter += 1;
+ return 1;
+ },
+ toString: null
+};
+var key2 = {
+ valueOf: function() {
+ key2vof.push(counter);
+ counter += 1;
+ return 2;
+ },
+ toString: null
+};
+
+class C {
+ a() { return 'A'; }
+ [key1]() { return 'B'; }
+ c() { return 'C'; }
+ [key2]() { return 'D'; }
+}
+
+assert.compareArray(key1vof, [0], "order set for key1");
+assert.compareArray(key2vof, [1], "order set for key2");
+
+assert.sameValue(counter, 2, "The value of `counter` is `2`");
+assert.sameValue(new C().a(), 'A', "`new C().a()` returns `'A'`. Defined as `a() { return 'A'; }`");
+assert.sameValue(new C()[1](), 'B', "`new C()[1]()` returns `'B'`. Defined as `[key1]() { return 'B'; }`");
+assert.sameValue(new C().c(), 'C', "`new C().c()` returns `'C'`. Defined as `c() { return 'C'; }`");
+assert.sameValue(new C()[2](), 'D', "`new C()[2]()` returns `'D'`. Defined as `[key2]() { return 'D'; }`");
+assert.sameValue(Object.keys(C.prototype).length, 0, "No enum keys from C.prototype");
+assert(
+ compareArray(Object.getOwnPropertyNames(C.prototype), ['1', '2', 'constructor', 'a', 'c']),
+ "`compareArray(Object.getOwnPropertyNames(C.prototype), ['1', '2', 'constructor', 'a', 'c'])` returns `true`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/to-name-side-effects/numbers-object.js b/js/src/tests/test262/language/computed-property-names/to-name-side-effects/numbers-object.js
new file mode 100644
index 0000000000..6869240333
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/to-name-side-effects/numbers-object.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ to name side effects numbers
+includes: [compareArray.js]
+---*/
+var counter = 0;
+var key1 = {
+ valueOf: function() {
+ assert.sameValue(counter++, 0, "The result of `counter++` is `0`");
+ return 1;
+ },
+ toString: null
+};
+var key2 = {
+ valueOf: function() {
+ assert.sameValue(counter++, 1, "The result of `counter++` is `1`");
+ return 2;
+ },
+ toString: null
+};
+
+var object = {
+ a: 'A',
+ [key1]: 'B',
+ c: 'C',
+ [key2]: 'D',
+};
+assert.sameValue(counter, 2, "The value of `counter` is `2`");
+assert.sameValue(object.a, 'A', "The value of `object.a` is `'A'`. Defined as `a: 'A'`");
+assert.sameValue(object[1], 'B', "The value of `object[1]` is `'B'`. Defined as `[key1]: 'B'`");
+assert.sameValue(object.c, 'C', "The value of `object.c` is `'C'`. Defined as `c: 'C'`");
+assert.sameValue(object[2], 'D', "The value of `object[2]` is `'D'`. Defined as `[key2]: 'D'`");
+assert.compareArray(
+ Object.getOwnPropertyNames(object),
+ ['1', '2', 'a', 'c']
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/to-name-side-effects/object.js b/js/src/tests/test262/language/computed-property-names/to-name-side-effects/object.js
new file mode 100644
index 0000000000..06ccd5476b
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/to-name-side-effects/object.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+ to name, accessor side effects object literal
+includes: [compareArray.js]
+---*/
+var counter = 0;
+var key1 = {
+ toString: function() {
+ assert.sameValue(counter++, 0, "The result of `counter++` is `0`");
+ return 'b';
+ }
+};
+var key2 = {
+ toString: function() {
+ assert.sameValue(counter++, 1, "The result of `counter++` is `1`");
+ return 'd';
+ }
+};
+var object = {
+ a() { return 'A'; },
+ [key1]() { return 'B'; },
+ c() { return 'C'; },
+ [key2]() { return 'D'; },
+};
+assert.sameValue(counter, 2, "The value of `counter` is `2`");
+assert.sameValue(object.a(), 'A', "`object.a()` returns `'A'`. Defined as `a() { return 'A'; }`");
+assert.sameValue(object.b(), 'B', "`object.b()` returns `'B'`. Defined as `[key1]() { return 'B'; }`");
+assert.sameValue(object.c(), 'C', "`object.c()` returns `'C'`. Defined as `c() { return 'C'; }`");
+assert.sameValue(object.d(), 'D', "`object.d()` returns `'D'`. Defined as `[key2]() { return 'D'; }`");
+assert.compareArray(
+ Object.getOwnPropertyNames(object),
+ ['a', 'b', 'c', 'd']
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/computed-property-names/to-name-side-effects/shell.js b/js/src/tests/test262/language/computed-property-names/to-name-side-effects/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/computed-property-names/to-name-side-effects/shell.js