Revision: 22980
Author: [email protected]
Date: Thu Aug 7 16:42:14 2014 UTC
Log: Enable ES6 iteration by default
This enables for-of, as well as @@iterator implementations for strings
and arrays.
[email protected]
BUG=v8:2214
LOG=Y
Review URL: https://codereview.chromium.org/446023002
http://code.google.com/p/v8/source/detail?r=22980
Added:
/branches/bleeding_edge/test/mjsunit/es6/array-iterator.js
/branches/bleeding_edge/test/mjsunit/es6/iteration-semantics.js
/branches/bleeding_edge/test/mjsunit/es6/iteration-syntax.js
/branches/bleeding_edge/test/mjsunit/es6/regress/regress-crbug-248025.js
/branches/bleeding_edge/test/mjsunit/es6/string-iterator.js
/branches/bleeding_edge/test/mjsunit/es6/typed-array-iterator.js
Deleted:
/branches/bleeding_edge/test/mjsunit/harmony/array-iterator.js
/branches/bleeding_edge/test/mjsunit/harmony/iteration-semantics.js
/branches/bleeding_edge/test/mjsunit/harmony/iteration-syntax.js
/branches/bleeding_edge/test/mjsunit/harmony/regress/regress-crbug-248025.js
/branches/bleeding_edge/test/mjsunit/harmony/string-iterator.js
/branches/bleeding_edge/test/mjsunit/harmony/typed-array-iterator.js
Modified:
/branches/bleeding_edge/BUILD.gn
/branches/bleeding_edge/src/bootstrapper.cc
/branches/bleeding_edge/src/flag-definitions.h
/branches/bleeding_edge/src/parser.cc
/branches/bleeding_edge/src/preparser.cc
/branches/bleeding_edge/src/preparser.h
/branches/bleeding_edge/src/unscopables.js
/branches/bleeding_edge/test/cctest/test-parsing.cc
/branches/bleeding_edge/test/mjsunit/builtins.js
/branches/bleeding_edge/test/mjsunit/debug-script.js
/branches/bleeding_edge/test/mjsunit/harmony/generators-iteration.js
/branches/bleeding_edge/test/mjsunit/harmony/proxies.js
/branches/bleeding_edge/test/mjsunit/mjsunit.status
/branches/bleeding_edge/tools/gyp/v8.gyp
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/es6/array-iterator.js Thu Aug 7
16:42:14 2014 UTC
@@ -0,0 +1,252 @@
+// Copyright 2013 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+
+var NONE = 0;
+var READ_ONLY = 1;
+var DONT_ENUM = 2;
+var DONT_DELETE = 4;
+
+
+function assertHasOwnProperty(object, name, attrs) {
+ assertTrue(object.hasOwnProperty(name));
+ var desc = Object.getOwnPropertyDescriptor(object, name);
+ assertEquals(desc.writable, !(attrs & READ_ONLY));
+ assertEquals(desc.enumerable, !(attrs & DONT_ENUM));
+ assertEquals(desc.configurable, !(attrs & DONT_DELETE));
+}
+
+
+function TestArrayPrototype() {
+ assertHasOwnProperty(Array.prototype, 'entries', DONT_ENUM);
+ assertHasOwnProperty(Array.prototype, 'values', DONT_ENUM);
+ assertHasOwnProperty(Array.prototype, 'keys', DONT_ENUM);
+ assertHasOwnProperty(Array.prototype, Symbol.iterator, DONT_ENUM);
+
+ assertEquals(Array.prototype.values, Array.prototype[Symbol.iterator]);
+}
+TestArrayPrototype();
+
+
+function assertIteratorResult(value, done, result) {
+ assertEquals({value: value, done: done}, result);
+}
+
+
+function TestValues() {
+ var array = ['a', 'b', 'c'];
+ var iterator = array.values();
+ assertIteratorResult('a', false, iterator.next());
+ assertIteratorResult('b', false, iterator.next());
+ assertIteratorResult('c', false, iterator.next());
+ assertIteratorResult(void 0, true, iterator.next());
+
+ array.push('d');
+ assertIteratorResult(void 0, true, iterator.next());
+}
+TestValues();
+
+
+function TestValuesMutate() {
+ var array = ['a', 'b', 'c'];
+ var iterator = array.values();
+ assertIteratorResult('a', false, iterator.next());
+ assertIteratorResult('b', false, iterator.next());
+ assertIteratorResult('c', false, iterator.next());
+ array.push('d');
+ assertIteratorResult('d', false, iterator.next());
+ assertIteratorResult(void 0, true, iterator.next());
+}
+TestValuesMutate();
+
+
+function TestKeys() {
+ var array = ['a', 'b', 'c'];
+ var iterator = array.keys();
+ assertIteratorResult(0, false, iterator.next());
+ assertIteratorResult(1, false, iterator.next());
+ assertIteratorResult(2, false, iterator.next());
+ assertIteratorResult(void 0, true, iterator.next());
+
+ array.push('d');
+ assertIteratorResult(void 0, true, iterator.next());
+}
+TestKeys();
+
+
+function TestKeysMutate() {
+ var array = ['a', 'b', 'c'];
+ var iterator = array.keys();
+ assertIteratorResult(0, false, iterator.next());
+ assertIteratorResult(1, false, iterator.next());
+ assertIteratorResult(2, false, iterator.next());
+ array.push('d');
+ assertIteratorResult(3, false, iterator.next());
+ assertIteratorResult(void 0, true, iterator.next());
+}
+TestKeysMutate();
+
+
+function TestEntries() {
+ var array = ['a', 'b', 'c'];
+ var iterator = array.entries();
+ assertIteratorResult([0, 'a'], false, iterator.next());
+ assertIteratorResult([1, 'b'], false, iterator.next());
+ assertIteratorResult([2, 'c'], false, iterator.next());
+ assertIteratorResult(void 0, true, iterator.next());
+
+ array.push('d');
+ assertIteratorResult(void 0, true, iterator.next());
+}
+TestEntries();
+
+
+function TestEntriesMutate() {
+ var array = ['a', 'b', 'c'];
+ var iterator = array.entries();
+ assertIteratorResult([0, 'a'], false, iterator.next());
+ assertIteratorResult([1, 'b'], false, iterator.next());
+ assertIteratorResult([2, 'c'], false, iterator.next());
+ array.push('d');
+ assertIteratorResult([3, 'd'], false, iterator.next());
+ assertIteratorResult(void 0, true, iterator.next());
+}
+TestEntriesMutate();
+
+
+function TestArrayIteratorPrototype() {
+ var array = [];
+ var iterator = array.values();
+
+ var ArrayIteratorPrototype = iterator.__proto__;
+
+ assertEquals(ArrayIteratorPrototype, array.values().__proto__);
+ assertEquals(ArrayIteratorPrototype, array.keys().__proto__);
+ assertEquals(ArrayIteratorPrototype, array.entries().__proto__);
+
+ assertEquals(Object.prototype, ArrayIteratorPrototype.__proto__);
+
+ assertEquals('Array Iterator', %_ClassOf(array.values()));
+ assertEquals('Array Iterator', %_ClassOf(array.keys()));
+ assertEquals('Array Iterator', %_ClassOf(array.entries()));
+
+ assertFalse(ArrayIteratorPrototype.hasOwnProperty('constructor'));
+ assertArrayEquals(['next'],
+ Object.getOwnPropertyNames(ArrayIteratorPrototype));
+ assertHasOwnProperty(ArrayIteratorPrototype, 'next', DONT_ENUM);
+ assertHasOwnProperty(ArrayIteratorPrototype, Symbol.iterator, DONT_ENUM);
+}
+TestArrayIteratorPrototype();
+
+
+function TestForArrayValues() {
+ var buffer = [];
+ var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
+ var i = 0;
+ for (var value of array.values()) {
+ buffer[i++] = value;
+ }
+
+ assertEquals(8, buffer.length);
+
+ for (var i = 0; i < buffer.length - 1; i++) {
+ assertSame(array[i], buffer[i]);
+ }
+ assertTrue(isNaN(buffer[buffer.length - 1]));
+}
+TestForArrayValues();
+
+
+function TestForArrayKeys() {
+ var buffer = [];
+ var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
+ var i = 0;
+ for (var key of array.keys()) {
+ buffer[i++] = key;
+ }
+
+ assertEquals(8, buffer.length);
+
+ for (var i = 0; i < buffer.length; i++) {
+ assertEquals(i, buffer[i]);
+ }
+}
+TestForArrayKeys();
+
+
+function TestForArrayEntries() {
+ var buffer = [];
+ var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
+ var i = 0;
+ for (var entry of array.entries()) {
+ buffer[i++] = entry;
+ }
+
+ assertEquals(8, buffer.length);
+
+ for (var i = 0; i < buffer.length - 1; i++) {
+ assertSame(array[i], buffer[i][1]);
+ }
+ assertTrue(isNaN(buffer[buffer.length - 1][1]));
+
+ for (var i = 0; i < buffer.length; i++) {
+ assertEquals(i, buffer[i][0]);
+ }
+}
+TestForArrayEntries();
+
+
+function TestForArray() {
+ var buffer = [];
+ var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
+ var i = 0;
+ for (var value of array) {
+ buffer[i++] = value;
+ }
+
+ assertEquals(8, buffer.length);
+
+ for (var i = 0; i < buffer.length - 1; i++) {
+ assertSame(array[i], buffer[i]);
+ }
+ assertTrue(isNaN(buffer[buffer.length - 1]));
+}
+TestForArrayValues();
+
+
+function TestNonOwnSlots() {
+ var array = [0];
+ var iterator = array.values();
+ var object = {__proto__: iterator};
+
+ assertThrows(function() {
+ object.next();
+ }, TypeError);
+}
+TestNonOwnSlots();
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/es6/iteration-semantics.js Thu
Aug 7 16:42:14 2014 UTC
@@ -0,0 +1,336 @@
+// Copyright 2013 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --harmony-generators --harmony-scoping --harmony-proxies
+
+// Test for-of semantics.
+
+"use strict";
+
+
+// First, some helpers.
+
+function* values() {
+ for (var i = 0; i < arguments.length; i++) {
+ yield arguments[i];
+ }
+}
+
+function wrap_iterator(iterator) {
+ var iterable = {};
+ iterable[Symbol.iterator] = function() { return iterator; };
+ return iterable;
+}
+
+function integers_until(max) {
+ function next() {
+ var ret = { value: this.n, done: this.n == max };
+ this.n++;
+ return ret;
+ }
+ return wrap_iterator({ next: next, n: 0 });
+}
+
+function results(results) {
+ var i = 0;
+ function next() {
+ return results[i++];
+ }
+ return wrap_iterator({ next: next });
+}
+
+function* integers_from(n) {
+ while (1) yield n++;
+}
+
+// A destructive append.
+function append(x, tail) {
+ tail[tail.length] = x;
+ return tail;
+}
+
+function sum(x, tail) {
+ return x + tail;
+}
+
+function fold(cons, seed, iterable) {
+ for (var x of iterable) {
+ seed = cons(x, seed);
+ }
+ return seed;
+}
+
+function* take(iterable, n) {
+ if (n == 0) return;
+ for (let x of iterable) {
+ yield x;
+ if (--n == 0) break;
+ }
+}
+
+function nth(iterable, n) {
+ for (let x of iterable) {
+ if (n-- == 0) return x;
+ }
+ throw "unreachable";
+}
+
+function* skip_every(iterable, n) {
+ var i = 0;
+ for (let x of iterable) {
+ if (++i % n == 0) continue;
+ yield x;
+ }
+}
+
+function* iter_map(iterable, f) {
+ for (var x of iterable) {
+ yield f(x);
+ }
+}
+function nested_fold(cons, seed, iterable) {
+ var visited = []
+ for (let x of iterable) {
+ for (let y of x) {
+ seed = cons(y, seed);
+ }
+ }
+ return seed;
+}
+
+function* unreachable(iterable) {
+ for (let x of iterable) {
+ throw "not reached";
+ }
+}
+
+function one_time_getter(o, prop, val) {
+ function set_never() { throw "unreachable"; }
+ var gotten = false;
+ function get_once() {
+ if (gotten) throw "got twice";
+ gotten = true;
+ return val;
+ }
+ Object.defineProperty(o, prop, {get: get_once, set: set_never})
+ return o;
+}
+
+function never_getter(o, prop) {
+ function never() { throw "unreachable"; }
+ Object.defineProperty(o, prop, {get: never, set: never})
+ return o;
+}
+
+function remove_next_after(iterable, n) {
+ var iterator = iterable[Symbol.iterator]();
+ function next() {
+ if (n-- == 0) delete this.next;
+ return iterator.next();
+ }
+ return wrap_iterator({ next: next });
+}
+
+function poison_next_after(iterable, n) {
+ var iterator = iterable[Symbol.iterator]();
+ function next() {
+ return iterator.next();
+ }
+ function next_getter() {
+ if (n-- < 0)
+ throw "poisoned";
+ return next;
+ }
+ var o = {};
+ Object.defineProperty(o, 'next', { get: next_getter });
+ return wrap_iterator(o);
+}
+
+// Now, the tests.
+
+// Non-generator iterators.
+assertEquals(45, fold(sum, 0, integers_until(10)));
+// Generator iterators.
+assertEquals([1, 2, 3], fold(append, [], values(1, 2, 3)));
+// Break.
+assertEquals(45, fold(sum, 0, take(integers_from(0), 10)));
+// Continue.
+assertEquals(90, fold(sum, 0, take(skip_every(integers_from(0), 2), 10)));
+// Return.
+assertEquals(10, nth(integers_from(0), 10));
+// Nested for-of.
+assertEquals([0, 0, 1, 0, 1, 2, 0, 1, 2, 3],
+ nested_fold(append,
+ [],
+ iter_map(integers_until(5), integers_until)));
+// Result objects with sparse fields.
+assertEquals([undefined, 1, 2, 3],
+ fold(append, [],
+ results([{ done: false },
+ { value: 1, done: false },
+ // A missing "done" is the same as undefined,
which
+ // is false.
+ { value: 2 },
+ // Not done.
+ { value: 3, done: 0 },
+ // Done.
+ { value: 4, done: 42 }])));
+// Results that are not objects.
+assertEquals([undefined, undefined, undefined],
+ fold(append, [],
+ results([10, "foo", /qux/, { value: 37, done: true }])));
+// Getters (shudder).
+assertEquals([1, 2],
+ fold(append, [],
+ results([one_time_getter({ value: 1 }, 'done', false),
+ one_time_getter({ done: false }, 'value', 2),
+ { value: 37, done: true },
+
never_getter(never_getter({}, 'done'), 'value')])));
+
+// Unlike the case with for-in, null and undefined cause an error.
+assertThrows('fold(sum, 0, unreachable(null))', TypeError);
+assertThrows('fold(sum, 0, unreachable(undefined))', TypeError);
+
+// Other non-iterators do cause an error.
+assertThrows('fold(sum, 0, unreachable({}))', TypeError);
+assertThrows('fold(sum, 0, unreachable(false))', TypeError);
+assertThrows('fold(sum, 0, unreachable(37))', TypeError);
+
+// "next" is looked up each time.
+assertThrows('fold(sum, 0, remove_next_after(integers_until(10), 5))',
+ TypeError);
+// It is not called at any other time.
+assertEquals(45,
+ fold(sum, 0, remove_next_after(integers_until(10), 10)));
+// It is not looked up too many times.
+assertEquals(45,
+ fold(sum, 0, poison_next_after(integers_until(10), 10)));
+
+function labelled_continue(iterable) {
+ var n = 0;
+outer:
+ while (true) {
+ n++;
+ for (var x of iterable) continue outer;
+ break;
+ }
+ return n;
+}
+assertEquals(11, labelled_continue(integers_until(10)));
+
+function labelled_break(iterable) {
+ var n = 0;
+outer:
+ while (true) {
+ n++;
+ for (var x of iterable) break outer;
+ }
+ return n;
+}
+assertEquals(1, labelled_break(integers_until(10)));
+
+// Test continue/break in catch.
+function catch_control(iterable, k) {
+ var n = 0;
+ for (var x of iterable) {
+ try {
+ return k(x);
+ } catch (e) {
+ if (e == "continue") continue;
+ else if (e == "break") break;
+ else throw e;
+ }
+ } while (false);
+ return false;
+}
+assertEquals(false,
+ catch_control(integers_until(10),
+ function() { throw "break" }));
+assertEquals(false,
+ catch_control(integers_until(10),
+ function() { throw "continue" }));
+assertEquals(5,
+ catch_control(integers_until(10),
+ function(x) {
+ if (x == 5) return x;
+ throw "continue";
+ }));
+
+// Test continue/break in try.
+function try_control(iterable, k) {
+ var n = 0;
+ for (var x of iterable) {
+ try {
+ var e = k(x);
+ if (e == "continue") continue;
+ else if (e == "break") break;
+ return e;
+ } catch (e) {
+ throw e;
+ }
+ } while (false);
+ return false;
+}
+assertEquals(false,
+ try_control(integers_until(10),
+ function() { return "break" }));
+assertEquals(false,
+ try_control(integers_until(10),
+ function() { return "continue" }));
+assertEquals(5,
+ try_control(integers_until(10),
+ function(x) { return (x == 5) ? x : "continue"
}));
+
+// Proxy results, with getters.
+function transparent_proxy(x) {
+ return Proxy.create({
+ get: function(receiver, name) { return x[name]; }
+ });
+}
+assertEquals([1, 2],
+ fold(append, [],
+ results([one_time_getter({ value: 1 }, 'done', false),
+ one_time_getter({ done: false }, 'value', 2),
+ { value: 37, done: true },
+ never_getter(never_getter({}, 'done'), 'value')]
+ .map(transparent_proxy))));
+
+// Proxy iterators.
+function poison_proxy_after(iterable, n) {
+ var iterator = iterable[Symbol.iterator]();
+ return wrap_iterator(Proxy.create({
+ get: function(receiver, name) {
+ if (name == 'next' && n-- < 0) throw "unreachable";
+ return iterator[name];
+ },
+ // Needed for integers_until(10)'s this.n++.
+ set: function(receiver, name, val) {
+ return iterator[name] = val;
+ }
+ }));
+}
+assertEquals(45, fold(sum, 0, poison_proxy_after(integers_until(10), 10)));
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/es6/iteration-syntax.js Thu Aug 7
16:42:14 2014 UTC
@@ -0,0 +1,70 @@
+// Copyright 2013 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --harmony-scoping --use-strict
+
+// Test for-of syntax.
+
+"use strict";
+
+function f() { for (x of y) { } }
+function f() { for (var x of y) { } }
+function f() { for (let x of y) { } }
+
+assertThrows("function f() { for (x of) { } }", SyntaxError);
+assertThrows("function f() { for (x of y z) { } }", SyntaxError);
+assertThrows("function f() { for (x of y;) { } }", SyntaxError);
+
+assertThrows("function f() { for (var x of) { } }", SyntaxError);
+assertThrows("function f() { for (var x of y z) { } }", SyntaxError);
+assertThrows("function f() { for (var x of y;) { } }", SyntaxError);
+
+assertThrows("function f() { for (let x of) { } }", SyntaxError);
+assertThrows("function f() { for (let x of y z) { } }", SyntaxError);
+assertThrows("function f() { for (let x of y;) { } }", SyntaxError);
+
+assertThrows("function f() { for (of y) { } }", SyntaxError);
+assertThrows("function f() { for (of of) { } }", SyntaxError);
+assertThrows("function f() { for (var of y) { } }", SyntaxError);
+assertThrows("function f() { for (var of of) { } }", SyntaxError);
+assertThrows("function f() { for (let of y) { } }", SyntaxError);
+assertThrows("function f() { for (let of of) { } }", SyntaxError);
+
+assertThrows("function f() { for (x = 3 of y) { } }", SyntaxError);
+assertThrows("function f() { for (var x = 3 of y) { } }", SyntaxError);
+assertThrows("function f() { for (let x = 3 of y) { } }", SyntaxError);
+
+
+// Alack, this appears to be valid.
+function f() { for (of of y) { } }
+function f() { for (let of of y) { } }
+function f() { for (var of of y) { } }
+
+// This too, of course.
+function f() { for (of in y) { } }
+function f() { for (var of in y) { } }
+function f() { for (let of in y) { } }
=======================================
--- /dev/null
+++
/branches/bleeding_edge/test/mjsunit/es6/regress/regress-crbug-248025.js
Thu Aug 7 16:42:14 2014 UTC
@@ -0,0 +1,38 @@
+// Copyright 2013 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Filler long enough to trigger lazy parsing.
+var filler = "//" + new Array(1024).join('x');
+
+// Test that the pre-parser does not crash when the expected contextual
+// keyword as part if a 'for' statement is not and identifier.
+try {
+ eval(filler + "\nfunction f() { for (x : y) { } }");
+ throw "not reached";
+} catch (e) {
+ if (!(e instanceof SyntaxError)) throw e;
+}
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/es6/string-iterator.js Thu Aug 7
16:42:14 2014 UTC
@@ -0,0 +1,89 @@
+// Copyright 2014 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.
+
+
+function TestStringPrototypeIterator() {
+ assertTrue(String.prototype.hasOwnProperty(Symbol.iterator));
+ assertFalse("".hasOwnProperty(Symbol.iterator));
+ assertFalse("".propertyIsEnumerable(Symbol.iterator));
+}
+TestStringPrototypeIterator();
+
+
+function assertIteratorResult(value, done, result) {
+ assertEquals({value: value, done: done}, result);
+}
+
+
+function TestManualIteration() {
+ var string = "abc";
+ var iterator = string[Symbol.iterator]();
+ assertIteratorResult('a', false, iterator.next());
+ assertIteratorResult('b', false, iterator.next());
+ assertIteratorResult('c', false, iterator.next());
+ assertIteratorResult(void 0, true, iterator.next());
+ assertIteratorResult(void 0, true, iterator.next());
+}
+TestManualIteration();
+
+
+function TestSurrogatePairs() {
+ var lo = "\uD834";
+ var hi = "\uDF06";
+ var pair = lo + hi;
+ var string = "abc" + pair + "def" + lo + pair + hi + lo;
+ var iterator = string[Symbol.iterator]();
+ assertIteratorResult('a', false, iterator.next());
+ assertIteratorResult('b', false, iterator.next());
+ assertIteratorResult('c', false, iterator.next());
+ assertIteratorResult(pair, false, iterator.next());
+ assertIteratorResult('d', false, iterator.next());
+ assertIteratorResult('e', false, iterator.next());
+ assertIteratorResult('f', false, iterator.next());
+ assertIteratorResult(lo, false, iterator.next());
+ assertIteratorResult(pair, false, iterator.next());
+ assertIteratorResult(hi, false, iterator.next());
+ assertIteratorResult(lo, false, iterator.next());
+ assertIteratorResult(void 0, true, iterator.next());
+ assertIteratorResult(void 0, true, iterator.next());
+}
+TestSurrogatePairs();
+
+
+function TestStringIteratorPrototype() {
+ var iterator = ""[Symbol.iterator]();
+ var StringIteratorPrototype = iterator.__proto__;
+ assertFalse(StringIteratorPrototype.hasOwnProperty('constructor'));
+ assertEquals(StringIteratorPrototype.__proto__, Object.prototype);
+ assertArrayEquals(['next'],
+ Object.getOwnPropertyNames(StringIteratorPrototype));
+ assertEquals('[object String Iterator]', "" + iterator);
+}
+TestStringIteratorPrototype();
+
+
+function TestForOf() {
+ var lo = "\uD834";
+ var hi = "\uDF06";
+ var pair = lo + hi;
+ var string = "abc" + pair + "def" + lo + pair + hi + lo;
+ var expected = ['a', 'b', 'c', pair, 'd', 'e', 'f', lo, pair, hi, lo];
+
+ var i = 0;
+ for (var char of string) {
+ assertEquals(expected[i++], char);
+ }
+
+ assertEquals(expected.length, i);
+}
+TestForOf();
+
+
+function TestNonOwnSlots() {
+ var iterator = ""[Symbol.iterator]();
+ var object = {__proto__: iterator};
+
+ assertThrows(function() { object.next(); }, TypeError);
+}
+TestNonOwnSlots();
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/es6/typed-array-iterator.js Thu
Aug 7 16:42:14 2014 UTC
@@ -0,0 +1,39 @@
+// Copyright 2014 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.
+
+
+var constructors = [Uint8Array, Int8Array,
+ Uint16Array, Int16Array,
+ Uint32Array, Int32Array,
+ Float32Array, Float64Array,
+ Uint8ClampedArray];
+
+function TestTypedArrayPrototype(constructor) {
+ assertTrue(constructor.prototype.hasOwnProperty('entries'));
+ assertTrue(constructor.prototype.hasOwnProperty('values'));
+ assertTrue(constructor.prototype.hasOwnProperty('keys'));
+ assertTrue(constructor.prototype.hasOwnProperty(Symbol.iterator));
+
+ assertFalse(constructor.prototype.propertyIsEnumerable('entries'));
+ assertFalse(constructor.prototype.propertyIsEnumerable('values'));
+ assertFalse(constructor.prototype.propertyIsEnumerable('keys'));
+ assertFalse(constructor.prototype.propertyIsEnumerable(Symbol.iterator));
+
+ assertEquals(Array.prototype.entries, constructor.prototype.entries);
+ assertEquals(Array.prototype.values, constructor.prototype.values);
+ assertEquals(Array.prototype.keys, constructor.prototype.keys);
+ assertEquals(Array.prototype.values,
constructor.prototype[Symbol.iterator]);
+}
+constructors.forEach(TestTypedArrayPrototype);
+
+
+function TestTypedArrayValues(constructor) {
+ var array = [1, 2, 3];
+ var i = 0;
+ for (var value of new constructor(array)) {
+ assertEquals(array[i++], value);
+ }
+ assertEquals(i, array.length);
+}
+constructors.forEach(TestTypedArrayValues);
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/array-iterator.js Wed Jun
25 07:32:57 2014 UTC
+++ /dev/null
@@ -1,252 +0,0 @@
-// Copyright 2013 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Flags: --harmony-iteration --allow-natives-syntax
-
-
-var NONE = 0;
-var READ_ONLY = 1;
-var DONT_ENUM = 2;
-var DONT_DELETE = 4;
-
-
-function assertHasOwnProperty(object, name, attrs) {
- assertTrue(object.hasOwnProperty(name));
- var desc = Object.getOwnPropertyDescriptor(object, name);
- assertEquals(desc.writable, !(attrs & READ_ONLY));
- assertEquals(desc.enumerable, !(attrs & DONT_ENUM));
- assertEquals(desc.configurable, !(attrs & DONT_DELETE));
-}
-
-
-function TestArrayPrototype() {
- assertHasOwnProperty(Array.prototype, 'entries', DONT_ENUM);
- assertHasOwnProperty(Array.prototype, 'values', DONT_ENUM);
- assertHasOwnProperty(Array.prototype, 'keys', DONT_ENUM);
- assertHasOwnProperty(Array.prototype, Symbol.iterator, DONT_ENUM);
-
- assertEquals(Array.prototype.values, Array.prototype[Symbol.iterator]);
-}
-TestArrayPrototype();
-
-
-function assertIteratorResult(value, done, result) {
- assertEquals({value: value, done: done}, result);
-}
-
-
-function TestValues() {
- var array = ['a', 'b', 'c'];
- var iterator = array.values();
- assertIteratorResult('a', false, iterator.next());
- assertIteratorResult('b', false, iterator.next());
- assertIteratorResult('c', false, iterator.next());
- assertIteratorResult(void 0, true, iterator.next());
-
- array.push('d');
- assertIteratorResult(void 0, true, iterator.next());
-}
-TestValues();
-
-
-function TestValuesMutate() {
- var array = ['a', 'b', 'c'];
- var iterator = array.values();
- assertIteratorResult('a', false, iterator.next());
- assertIteratorResult('b', false, iterator.next());
- assertIteratorResult('c', false, iterator.next());
- array.push('d');
- assertIteratorResult('d', false, iterator.next());
- assertIteratorResult(void 0, true, iterator.next());
-}
-TestValuesMutate();
-
-
-function TestKeys() {
- var array = ['a', 'b', 'c'];
- var iterator = array.keys();
- assertIteratorResult(0, false, iterator.next());
- assertIteratorResult(1, false, iterator.next());
- assertIteratorResult(2, false, iterator.next());
- assertIteratorResult(void 0, true, iterator.next());
-
- array.push('d');
- assertIteratorResult(void 0, true, iterator.next());
-}
-TestKeys();
-
-
-function TestKeysMutate() {
- var array = ['a', 'b', 'c'];
- var iterator = array.keys();
- assertIteratorResult(0, false, iterator.next());
- assertIteratorResult(1, false, iterator.next());
- assertIteratorResult(2, false, iterator.next());
- array.push('d');
- assertIteratorResult(3, false, iterator.next());
- assertIteratorResult(void 0, true, iterator.next());
-}
-TestKeysMutate();
-
-
-function TestEntries() {
- var array = ['a', 'b', 'c'];
- var iterator = array.entries();
- assertIteratorResult([0, 'a'], false, iterator.next());
- assertIteratorResult([1, 'b'], false, iterator.next());
- assertIteratorResult([2, 'c'], false, iterator.next());
- assertIteratorResult(void 0, true, iterator.next());
-
- array.push('d');
- assertIteratorResult(void 0, true, iterator.next());
-}
-TestEntries();
-
-
-function TestEntriesMutate() {
- var array = ['a', 'b', 'c'];
- var iterator = array.entries();
- assertIteratorResult([0, 'a'], false, iterator.next());
- assertIteratorResult([1, 'b'], false, iterator.next());
- assertIteratorResult([2, 'c'], false, iterator.next());
- array.push('d');
- assertIteratorResult([3, 'd'], false, iterator.next());
- assertIteratorResult(void 0, true, iterator.next());
-}
-TestEntriesMutate();
-
-
-function TestArrayIteratorPrototype() {
- var array = [];
- var iterator = array.values();
-
- var ArrayIteratorPrototype = iterator.__proto__;
-
- assertEquals(ArrayIteratorPrototype, array.values().__proto__);
- assertEquals(ArrayIteratorPrototype, array.keys().__proto__);
- assertEquals(ArrayIteratorPrototype, array.entries().__proto__);
-
- assertEquals(Object.prototype, ArrayIteratorPrototype.__proto__);
-
- assertEquals('Array Iterator', %_ClassOf(array.values()));
- assertEquals('Array Iterator', %_ClassOf(array.keys()));
- assertEquals('Array Iterator', %_ClassOf(array.entries()));
-
- assertFalse(ArrayIteratorPrototype.hasOwnProperty('constructor'));
- assertArrayEquals(['next'],
- Object.getOwnPropertyNames(ArrayIteratorPrototype));
- assertHasOwnProperty(ArrayIteratorPrototype, 'next', DONT_ENUM);
- assertHasOwnProperty(ArrayIteratorPrototype, Symbol.iterator, DONT_ENUM);
-}
-TestArrayIteratorPrototype();
-
-
-function TestForArrayValues() {
- var buffer = [];
- var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
- var i = 0;
- for (var value of array.values()) {
- buffer[i++] = value;
- }
-
- assertEquals(8, buffer.length);
-
- for (var i = 0; i < buffer.length - 1; i++) {
- assertSame(array[i], buffer[i]);
- }
- assertTrue(isNaN(buffer[buffer.length - 1]));
-}
-TestForArrayValues();
-
-
-function TestForArrayKeys() {
- var buffer = [];
- var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
- var i = 0;
- for (var key of array.keys()) {
- buffer[i++] = key;
- }
-
- assertEquals(8, buffer.length);
-
- for (var i = 0; i < buffer.length; i++) {
- assertEquals(i, buffer[i]);
- }
-}
-TestForArrayKeys();
-
-
-function TestForArrayEntries() {
- var buffer = [];
- var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
- var i = 0;
- for (var entry of array.entries()) {
- buffer[i++] = entry;
- }
-
- assertEquals(8, buffer.length);
-
- for (var i = 0; i < buffer.length - 1; i++) {
- assertSame(array[i], buffer[i][1]);
- }
- assertTrue(isNaN(buffer[buffer.length - 1][1]));
-
- for (var i = 0; i < buffer.length; i++) {
- assertEquals(i, buffer[i][0]);
- }
-}
-TestForArrayEntries();
-
-
-function TestForArray() {
- var buffer = [];
- var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
- var i = 0;
- for (var value of array) {
- buffer[i++] = value;
- }
-
- assertEquals(8, buffer.length);
-
- for (var i = 0; i < buffer.length - 1; i++) {
- assertSame(array[i], buffer[i]);
- }
- assertTrue(isNaN(buffer[buffer.length - 1]));
-}
-TestForArrayValues();
-
-
-function TestNonOwnSlots() {
- var array = [0];
- var iterator = array.values();
- var object = {__proto__: iterator};
-
- assertThrows(function() {
- object.next();
- }, TypeError);
-}
-TestNonOwnSlots();
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/iteration-semantics.js Mon
Aug 4 18:17:54 2014 UTC
+++ /dev/null
@@ -1,337 +0,0 @@
-// Copyright 2013 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Flags: --harmony-iteration
-// Flags: --harmony-generators --harmony-scoping --harmony-proxies
-
-// Test for-of semantics.
-
-"use strict";
-
-
-// First, some helpers.
-
-function* values() {
- for (var i = 0; i < arguments.length; i++) {
- yield arguments[i];
- }
-}
-
-function wrap_iterator(iterator) {
- var iterable = {};
- iterable[Symbol.iterator] = function() { return iterator; };
- return iterable;
-}
-
-function integers_until(max) {
- function next() {
- var ret = { value: this.n, done: this.n == max };
- this.n++;
- return ret;
- }
- return wrap_iterator({ next: next, n: 0 });
-}
-
-function results(results) {
- var i = 0;
- function next() {
- return results[i++];
- }
- return wrap_iterator({ next: next });
-}
-
-function* integers_from(n) {
- while (1) yield n++;
-}
-
-// A destructive append.
-function append(x, tail) {
- tail[tail.length] = x;
- return tail;
-}
-
-function sum(x, tail) {
- return x + tail;
-}
-
-function fold(cons, seed, iterable) {
- for (var x of iterable) {
- seed = cons(x, seed);
- }
- return seed;
-}
-
-function* take(iterable, n) {
- if (n == 0) return;
- for (let x of iterable) {
- yield x;
- if (--n == 0) break;
- }
-}
-
-function nth(iterable, n) {
- for (let x of iterable) {
- if (n-- == 0) return x;
- }
- throw "unreachable";
-}
-
-function* skip_every(iterable, n) {
- var i = 0;
- for (let x of iterable) {
- if (++i % n == 0) continue;
- yield x;
- }
-}
-
-function* iter_map(iterable, f) {
- for (var x of iterable) {
- yield f(x);
- }
-}
-function nested_fold(cons, seed, iterable) {
- var visited = []
- for (let x of iterable) {
- for (let y of x) {
- seed = cons(y, seed);
- }
- }
- return seed;
-}
-
-function* unreachable(iterable) {
- for (let x of iterable) {
- throw "not reached";
- }
-}
-
-function one_time_getter(o, prop, val) {
- function set_never() { throw "unreachable"; }
- var gotten = false;
- function get_once() {
- if (gotten) throw "got twice";
- gotten = true;
- return val;
- }
- Object.defineProperty(o, prop, {get: get_once, set: set_never})
- return o;
-}
-
-function never_getter(o, prop) {
- function never() { throw "unreachable"; }
- Object.defineProperty(o, prop, {get: never, set: never})
- return o;
-}
-
-function remove_next_after(iterable, n) {
- var iterator = iterable[Symbol.iterator]();
- function next() {
- if (n-- == 0) delete this.next;
- return iterator.next();
- }
- return wrap_iterator({ next: next });
-}
-
-function poison_next_after(iterable, n) {
- var iterator = iterable[Symbol.iterator]();
- function next() {
- return iterator.next();
- }
- function next_getter() {
- if (n-- < 0)
- throw "poisoned";
- return next;
- }
- var o = {};
- Object.defineProperty(o, 'next', { get: next_getter });
- return wrap_iterator(o);
-}
-
-// Now, the tests.
-
-// Non-generator iterators.
-assertEquals(45, fold(sum, 0, integers_until(10)));
-// Generator iterators.
-assertEquals([1, 2, 3], fold(append, [], values(1, 2, 3)));
-// Break.
-assertEquals(45, fold(sum, 0, take(integers_from(0), 10)));
-// Continue.
-assertEquals(90, fold(sum, 0, take(skip_every(integers_from(0), 2), 10)));
-// Return.
-assertEquals(10, nth(integers_from(0), 10));
-// Nested for-of.
-assertEquals([0, 0, 1, 0, 1, 2, 0, 1, 2, 3],
- nested_fold(append,
- [],
- iter_map(integers_until(5), integers_until)));
-// Result objects with sparse fields.
-assertEquals([undefined, 1, 2, 3],
- fold(append, [],
- results([{ done: false },
- { value: 1, done: false },
- // A missing "done" is the same as undefined,
which
- // is false.
- { value: 2 },
- // Not done.
- { value: 3, done: 0 },
- // Done.
- { value: 4, done: 42 }])));
-// Results that are not objects.
-assertEquals([undefined, undefined, undefined],
- fold(append, [],
- results([10, "foo", /qux/, { value: 37, done: true }])));
-// Getters (shudder).
-assertEquals([1, 2],
- fold(append, [],
- results([one_time_getter({ value: 1 }, 'done', false),
- one_time_getter({ done: false }, 'value', 2),
- { value: 37, done: true },
-
never_getter(never_getter({}, 'done'), 'value')])));
-
-// Unlike the case with for-in, null and undefined cause an error.
-assertThrows('fold(sum, 0, unreachable(null))', TypeError);
-assertThrows('fold(sum, 0, unreachable(undefined))', TypeError);
-
-// Other non-iterators do cause an error.
-assertThrows('fold(sum, 0, unreachable({}))', TypeError);
-assertThrows('fold(sum, 0, unreachable(false))', TypeError);
-assertThrows('fold(sum, 0, unreachable(37))', TypeError);
-
-// "next" is looked up each time.
-assertThrows('fold(sum, 0, remove_next_after(integers_until(10), 5))',
- TypeError);
-// It is not called at any other time.
-assertEquals(45,
- fold(sum, 0, remove_next_after(integers_until(10), 10)));
-// It is not looked up too many times.
-assertEquals(45,
- fold(sum, 0, poison_next_after(integers_until(10), 10)));
-
-function labelled_continue(iterable) {
- var n = 0;
-outer:
- while (true) {
- n++;
- for (var x of iterable) continue outer;
- break;
- }
- return n;
-}
-assertEquals(11, labelled_continue(integers_until(10)));
-
-function labelled_break(iterable) {
- var n = 0;
-outer:
- while (true) {
- n++;
- for (var x of iterable) break outer;
- }
- return n;
-}
-assertEquals(1, labelled_break(integers_until(10)));
-
-// Test continue/break in catch.
-function catch_control(iterable, k) {
- var n = 0;
- for (var x of iterable) {
- try {
- return k(x);
- } catch (e) {
- if (e == "continue") continue;
- else if (e == "break") break;
- else throw e;
- }
- } while (false);
- return false;
-}
-assertEquals(false,
- catch_control(integers_until(10),
- function() { throw "break" }));
-assertEquals(false,
- catch_control(integers_until(10),
- function() { throw "continue" }));
-assertEquals(5,
- catch_control(integers_until(10),
- function(x) {
- if (x == 5) return x;
- throw "continue";
- }));
-
-// Test continue/break in try.
-function try_control(iterable, k) {
- var n = 0;
- for (var x of iterable) {
- try {
- var e = k(x);
- if (e == "continue") continue;
- else if (e == "break") break;
- return e;
- } catch (e) {
- throw e;
- }
- } while (false);
- return false;
-}
-assertEquals(false,
- try_control(integers_until(10),
- function() { return "break" }));
-assertEquals(false,
- try_control(integers_until(10),
- function() { return "continue" }));
-assertEquals(5,
- try_control(integers_until(10),
- function(x) { return (x == 5) ? x : "continue"
}));
-
-// Proxy results, with getters.
-function transparent_proxy(x) {
- return Proxy.create({
- get: function(receiver, name) { return x[name]; }
- });
-}
-assertEquals([1, 2],
- fold(append, [],
- results([one_time_getter({ value: 1 }, 'done', false),
- one_time_getter({ done: false }, 'value', 2),
- { value: 37, done: true },
- never_getter(never_getter({}, 'done'), 'value')]
- .map(transparent_proxy))));
-
-// Proxy iterators.
-function poison_proxy_after(iterable, n) {
- var iterator = iterable[Symbol.iterator]();
- return wrap_iterator(Proxy.create({
- get: function(receiver, name) {
- if (name == 'next' && n-- < 0) throw "unreachable";
- return iterator[name];
- },
- // Needed for integers_until(10)'s this.n++.
- set: function(receiver, name, val) {
- return iterator[name] = val;
- }
- }));
-}
-assertEquals(45, fold(sum, 0, poison_proxy_after(integers_until(10), 10)));
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/iteration-syntax.js Thu
Jul 10 14:06:37 2014 UTC
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2013 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Flags: --harmony-iteration --harmony-scoping --use-strict
-
-// Test for-of syntax.
-
-"use strict";
-
-function f() { for (x of y) { } }
-function f() { for (var x of y) { } }
-function f() { for (let x of y) { } }
-
-assertThrows("function f() { for (x of) { } }", SyntaxError);
-assertThrows("function f() { for (x of y z) { } }", SyntaxError);
-assertThrows("function f() { for (x of y;) { } }", SyntaxError);
-
-assertThrows("function f() { for (var x of) { } }", SyntaxError);
-assertThrows("function f() { for (var x of y z) { } }", SyntaxError);
-assertThrows("function f() { for (var x of y;) { } }", SyntaxError);
-
-assertThrows("function f() { for (let x of) { } }", SyntaxError);
-assertThrows("function f() { for (let x of y z) { } }", SyntaxError);
-assertThrows("function f() { for (let x of y;) { } }", SyntaxError);
-
-assertThrows("function f() { for (of y) { } }", SyntaxError);
-assertThrows("function f() { for (of of) { } }", SyntaxError);
-assertThrows("function f() { for (var of y) { } }", SyntaxError);
-assertThrows("function f() { for (var of of) { } }", SyntaxError);
-assertThrows("function f() { for (let of y) { } }", SyntaxError);
-assertThrows("function f() { for (let of of) { } }", SyntaxError);
-
-assertThrows("function f() { for (x = 3 of y) { } }", SyntaxError);
-assertThrows("function f() { for (var x = 3 of y) { } }", SyntaxError);
-assertThrows("function f() { for (let x = 3 of y) { } }", SyntaxError);
-
-
-// Alack, this appears to be valid.
-function f() { for (of of y) { } }
-function f() { for (let of of y) { } }
-function f() { for (var of of y) { } }
-
-// This too, of course.
-function f() { for (of in y) { } }
-function f() { for (var of in y) { } }
-function f() { for (let of in y) { } }
=======================================
---
/branches/bleeding_edge/test/mjsunit/harmony/regress/regress-crbug-248025.js
Fri Feb 28 14:26:32 2014 UTC
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2013 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Flags: --harmony-iteration
-
-// Filler long enough to trigger lazy parsing.
-var filler = "//" + new Array(1024).join('x');
-
-// Test that the pre-parser does not crash when the expected contextual
-// keyword as part if a 'for' statement is not and identifier.
-try {
- eval(filler + "\nfunction f() { for (x : y) { } }");
- throw "not reached";
-} catch (e) {
- if (!(e instanceof SyntaxError)) throw e;
-}
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/string-iterator.js Wed Jun
25 07:43:14 2014 UTC
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2014 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.
-
-// Flags: --harmony-iteration
-
-
-function TestStringPrototypeIterator() {
- assertTrue(String.prototype.hasOwnProperty(Symbol.iterator));
- assertFalse("".hasOwnProperty(Symbol.iterator));
- assertFalse("".propertyIsEnumerable(Symbol.iterator));
-}
-TestStringPrototypeIterator();
-
-
-function assertIteratorResult(value, done, result) {
- assertEquals({value: value, done: done}, result);
-}
-
-
-function TestManualIteration() {
- var string = "abc";
- var iterator = string[Symbol.iterator]();
- assertIteratorResult('a', false, iterator.next());
- assertIteratorResult('b', false, iterator.next());
- assertIteratorResult('c', false, iterator.next());
- assertIteratorResult(void 0, true, iterator.next());
- assertIteratorResult(void 0, true, iterator.next());
-}
-TestManualIteration();
-
-
-function TestSurrogatePairs() {
- var lo = "\uD834";
- var hi = "\uDF06";
- var pair = lo + hi;
- var string = "abc" + pair + "def" + lo + pair + hi + lo;
- var iterator = string[Symbol.iterator]();
- assertIteratorResult('a', false, iterator.next());
- assertIteratorResult('b', false, iterator.next());
- assertIteratorResult('c', false, iterator.next());
- assertIteratorResult(pair, false, iterator.next());
- assertIteratorResult('d', false, iterator.next());
- assertIteratorResult('e', false, iterator.next());
- assertIteratorResult('f', false, iterator.next());
- assertIteratorResult(lo, false, iterator.next());
- assertIteratorResult(pair, false, iterator.next());
- assertIteratorResult(hi, false, iterator.next());
- assertIteratorResult(lo, false, iterator.next());
- assertIteratorResult(void 0, true, iterator.next());
- assertIteratorResult(void 0, true, iterator.next());
-}
-TestSurrogatePairs();
-
-
-function TestStringIteratorPrototype() {
- var iterator = ""[Symbol.iterator]();
- var StringIteratorPrototype = iterator.__proto__;
- assertFalse(StringIteratorPrototype.hasOwnProperty('constructor'));
- assertEquals(StringIteratorPrototype.__proto__, Object.prototype);
- assertArrayEquals(['next'],
- Object.getOwnPropertyNames(StringIteratorPrototype));
- assertEquals('[object String Iterator]', "" + iterator);
-}
-TestStringIteratorPrototype();
-
-
-function TestForOf() {
- var lo = "\uD834";
- var hi = "\uDF06";
- var pair = lo + hi;
- var string = "abc" + pair + "def" + lo + pair + hi + lo;
- var expected = ['a', 'b', 'c', pair, 'd', 'e', 'f', lo, pair, hi, lo];
-
- var i = 0;
- for (var char of string) {
- assertEquals(expected[i++], char);
- }
-
- assertEquals(expected.length, i);
-}
-TestForOf();
-
-
-function TestNonOwnSlots() {
- var iterator = ""[Symbol.iterator]();
- var object = {__proto__: iterator};
-
- assertThrows(function() { object.next(); }, TypeError);
-}
-TestNonOwnSlots();
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/typed-array-iterator.js
Wed Jun 25 08:46:53 2014 UTC
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2014 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.
-
-// Flags: --harmony-iteration
-
-
-var constructors = [Uint8Array, Int8Array,
- Uint16Array, Int16Array,
- Uint32Array, Int32Array,
- Float32Array, Float64Array,
- Uint8ClampedArray];
-
-function TestTypedArrayPrototype(constructor) {
- assertTrue(constructor.prototype.hasOwnProperty('entries'));
- assertTrue(constructor.prototype.hasOwnProperty('values'));
- assertTrue(constructor.prototype.hasOwnProperty('keys'));
- assertTrue(constructor.prototype.hasOwnProperty(Symbol.iterator));
-
- assertFalse(constructor.prototype.propertyIsEnumerable('entries'));
- assertFalse(constructor.prototype.propertyIsEnumerable('values'));
- assertFalse(constructor.prototype.propertyIsEnumerable('keys'));
- assertFalse(constructor.prototype.propertyIsEnumerable(Symbol.iterator));
-
- assertEquals(Array.prototype.entries, constructor.prototype.entries);
- assertEquals(Array.prototype.values, constructor.prototype.values);
- assertEquals(Array.prototype.keys, constructor.prototype.keys);
- assertEquals(Array.prototype.values,
constructor.prototype[Symbol.iterator]);
-}
-constructors.forEach(TestTypedArrayPrototype);
-
-
-function TestTypedArrayValues(constructor) {
- var array = [1, 2, 3];
- var i = 0;
- for (var value of new constructor(array)) {
- assertEquals(array[i++], value);
- }
- assertEquals(i, array.length);
-}
-constructors.forEach(TestTypedArrayValues);
=======================================
--- /branches/bleeding_edge/BUILD.gn Thu Aug 7 12:21:01 2014 UTC
+++ /branches/bleeding_edge/BUILD.gn Thu Aug 7 16:42:14 2014 UTC
@@ -200,6 +200,8 @@
"src/promise.js",
"src/object-observe.js",
"src/macros.py",
+ "src/array-iterator.js",
+ "src/string-iterator.js",
]
outputs = [
@@ -238,7 +240,6 @@
"src/macros.py",
"src/proxy.js",
"src/generator.js",
- "src/array-iterator.js",
"src/harmony-string.js",
"src/harmony-array.js",
"src/unscopables.js",
=======================================
--- /branches/bleeding_edge/src/bootstrapper.cc Thu Aug 7 16:14:22 2014 UTC
+++ /branches/bleeding_edge/src/bootstrapper.cc Thu Aug 7 16:42:14 2014 UTC
@@ -121,7 +121,7 @@
void Bootstrapper::TearDown() {
if (delete_these_non_arrays_on_tear_down_ != NULL) {
int len = delete_these_non_arrays_on_tear_down_->length();
- DCHECK(len < 25); // Don't use this mechanism for unbounded
allocations.
+ DCHECK(len < 27); // Don't use this mechanism for unbounded
allocations.
for (int i = 0; i < len; i++) {
delete delete_these_non_arrays_on_tear_down_->at(i);
delete_these_non_arrays_on_tear_down_->at(i) = NULL;
@@ -2060,8 +2060,6 @@
i++) {
INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js")
INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js")
- INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js")
- INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "string-iterator.js")
INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js")
INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js")
INSTALL_EXPERIMENTAL_NATIVE(i, unscopables, "unscopables.js")
=======================================
--- /branches/bleeding_edge/src/flag-definitions.h Wed Aug 6 15:50:40 2014
UTC
+++ /branches/bleeding_edge/src/flag-definitions.h Thu Aug 7 16:42:14 2014
UTC
@@ -155,7 +155,6 @@
"enable harmony modules (implies block scoping)")
DEFINE_BOOL(harmony_proxies, false, "enable harmony proxies")
DEFINE_BOOL(harmony_generators, false, "enable harmony generators")
-DEFINE_BOOL(harmony_iteration, false, "enable harmony iteration (for-of)")
DEFINE_BOOL(harmony_numeric_literals, false,
"enable harmony numeric literals (0o77, 0b11)")
DEFINE_BOOL(harmony_strings, false, "enable harmony string")
@@ -175,7 +174,6 @@
DEFINE_IMPLICATION(harmony_modules, harmony_scoping)
DEFINE_IMPLICATION(harmony, es_staging)
-DEFINE_IMPLICATION(es_staging, harmony_iteration)
// Flags for experimental implementation features.
DEFINE_BOOL(compiled_keyed_dictionary_loads, true,
=======================================
--- /branches/bleeding_edge/src/parser.cc Thu Aug 7 09:06:01 2014 UTC
+++ /branches/bleeding_edge/src/parser.cc Thu Aug 7 16:42:14 2014 UTC
@@ -729,7 +729,6 @@
set_allow_natives_syntax(FLAG_allow_natives_syntax || info->is_native());
set_allow_lazy(false); // Must be explicitly enabled.
set_allow_generators(FLAG_harmony_generators);
- set_allow_for_of(FLAG_harmony_iteration);
set_allow_arrow_functions(FLAG_harmony_arrow_functions);
set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals);
for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount;
@@ -2759,8 +2758,7 @@
if (Check(Token::IN)) {
*visit_mode = ForEachStatement::ENUMERATE;
return true;
- } else if (allow_for_of() && accept_OF &&
- CheckContextualKeyword(CStrVector("of"))) {
+ } else if (accept_OF && CheckContextualKeyword(CStrVector("of"))) {
*visit_mode = ForEachStatement::ITERATE;
return true;
}
@@ -3741,7 +3739,6 @@
reusable_preparser_->set_allow_natives_syntax(allow_natives_syntax());
reusable_preparser_->set_allow_lazy(true);
reusable_preparser_->set_allow_generators(allow_generators());
- reusable_preparser_->set_allow_for_of(allow_for_of());
reusable_preparser_->set_allow_arrow_functions(allow_arrow_functions());
reusable_preparser_->set_allow_harmony_numeric_literals(
allow_harmony_numeric_literals());
=======================================
--- /branches/bleeding_edge/src/preparser.cc Mon Aug 4 11:34:54 2014 UTC
+++ /branches/bleeding_edge/src/preparser.cc Thu Aug 7 16:42:14 2014 UTC
@@ -653,8 +653,7 @@
bool PreParser::CheckInOrOf(bool accept_OF) {
if (Check(Token::IN) ||
- (allow_for_of() && accept_OF &&
- CheckContextualKeyword(CStrVector("of")))) {
+ (accept_OF && CheckContextualKeyword(CStrVector("of")))) {
return true;
}
return false;
=======================================
--- /branches/bleeding_edge/src/preparser.h Wed Aug 6 12:05:39 2014 UTC
+++ /branches/bleeding_edge/src/preparser.h Thu Aug 7 16:42:14 2014 UTC
@@ -81,7 +81,6 @@
allow_lazy_(false),
allow_natives_syntax_(false),
allow_generators_(false),
- allow_for_of_(false),
allow_arrow_functions_(false),
zone_(zone) {}
@@ -90,7 +89,6 @@
bool allow_lazy() const { return allow_lazy_; }
bool allow_natives_syntax() const { return allow_natives_syntax_; }
bool allow_generators() const { return allow_generators_; }
- bool allow_for_of() const { return allow_for_of_; }
bool allow_arrow_functions() const { return allow_arrow_functions_; }
bool allow_modules() const { return scanner()->HarmonyModules(); }
bool allow_harmony_scoping() const { return scanner()->HarmonyScoping();
}
@@ -103,7 +101,6 @@
void set_allow_lazy(bool allow) { allow_lazy_ = allow; }
void set_allow_natives_syntax(bool allow) { allow_natives_syntax_ =
allow; }
void set_allow_generators(bool allow) { allow_generators_ = allow; }
- void set_allow_for_of(bool allow) { allow_for_of_ = allow; }
void set_allow_arrow_functions(bool allow) { allow_arrow_functions_ =
allow; }
void set_allow_modules(bool allow) {
scanner()->SetHarmonyModules(allow); }
void set_allow_harmony_scoping(bool allow) {
@@ -570,7 +567,6 @@
bool allow_lazy_;
bool allow_natives_syntax_;
bool allow_generators_;
- bool allow_for_of_;
bool allow_arrow_functions_;
typename Traits::Type::Zone* zone_; // Only used by Parser.
=======================================
--- /branches/bleeding_edge/src/unscopables.js Wed Aug 6 15:50:40 2014 UTC
+++ /branches/bleeding_edge/src/unscopables.js Thu Aug 7 16:42:14 2014 UTC
@@ -8,14 +8,14 @@
// var $Array = global.Array;
// var $Symbol = global.Symbol;
-function ExtendSymbol() {
+function UnscopablesExtendSymbol() {
%CheckIsBootstrapping();
InstallConstants($Symbol, $Array(
"unscopables", symbolUnscopables
));
}
-ExtendSymbol();
+UnscopablesExtendSymbol();
var arrayUnscopables = {
@@ -30,10 +30,10 @@
};
-function ExtendArrayPrototype() {
+function UnscopablesExtendArrayPrototype() {
%CheckIsBootstrapping();
%AddNamedProperty($Array.prototype, symbolUnscopables, arrayUnscopables,
DONT_ENUM | READ_ONLY);
}
-ExtendArrayPrototype();
+UnscopablesExtendArrayPrototype();
=======================================
--- /branches/bleeding_edge/test/cctest/test-parsing.cc Mon Aug 4 11:34:54
2014 UTC
+++ /branches/bleeding_edge/test/cctest/test-parsing.cc Thu Aug 7 16:42:14
2014 UTC
@@ -1208,7 +1208,6 @@
kAllowHarmonyScoping,
kAllowModules,
kAllowGenerators,
- kAllowForOf,
kAllowHarmonyNumericLiterals,
kAllowArrowFunctions
};
@@ -1228,7 +1227,6 @@
parser->set_allow_harmony_scoping(flags.Contains(kAllowHarmonyScoping));
parser->set_allow_modules(flags.Contains(kAllowModules));
parser->set_allow_generators(flags.Contains(kAllowGenerators));
- parser->set_allow_for_of(flags.Contains(kAllowForOf));
parser->set_allow_harmony_numeric_literals(
flags.Contains(kAllowHarmonyNumericLiterals));
parser->set_allow_arrow_functions(flags.Contains(kAllowArrowFunctions));
@@ -1436,10 +1434,9 @@
CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition()
-
128 * 1024);
- static const ParserFlag flags1[] = {
- kAllowLazy, kAllowHarmonyScoping, kAllowModules, kAllowGenerators,
- kAllowForOf, kAllowArrowFunctions
- };
+ static const ParserFlag flags1[] = {kAllowLazy, kAllowHarmonyScoping,
+ kAllowModules, kAllowGenerators,
+ kAllowArrowFunctions};
for (int i = 0; context_data[i][0] != NULL; ++i) {
for (int j = 0; statement_data[j] != NULL; ++j) {
for (int k = 0; termination_data[k] != NULL; ++k) {
@@ -1514,9 +1511,8 @@
128 * 1024);
static const ParserFlag default_flags[] = {
- kAllowLazy, kAllowHarmonyScoping, kAllowModules, kAllowGenerators,
- kAllowForOf, kAllowNativesSyntax, kAllowArrowFunctions
- };
+ kAllowLazy, kAllowHarmonyScoping, kAllowModules,
+ kAllowGenerators, kAllowNativesSyntax, kAllowArrowFunctions};
ParserFlag* generated_flags = NULL;
if (flags == NULL) {
flags = default_flags;
=======================================
--- /branches/bleeding_edge/test/mjsunit/builtins.js Tue Aug 5 19:37:32
2014 UTC
+++ /branches/bleeding_edge/test/mjsunit/builtins.js Thu Aug 7 16:42:14
2014 UTC
@@ -41,7 +41,9 @@
function isV8Native(name) {
return name == "GeneratorFunctionPrototype" ||
name == "SetIterator" ||
- name == "MapIterator";
+ name == "MapIterator" ||
+ name == "ArrayIterator" ||
+ name == "StringIterator";
}
function checkConstructor(func, name) {
=======================================
--- /branches/bleeding_edge/test/mjsunit/debug-script.js Wed Aug 6
11:39:39 2014 UTC
+++ /branches/bleeding_edge/test/mjsunit/debug-script.js Thu Aug 7
16:42:14 2014 UTC
@@ -59,7 +59,7 @@
}
// This has to be updated if the number of native scripts change.
-assertTrue(named_native_count == 23 || named_native_count == 24);
+assertTrue(named_native_count == 25 || named_native_count == 26);
// Only the 'gc' extension is loaded.
assertEquals(1, extension_count);
// This script and mjsunit.js has been loaded. If using d8, d8 loads
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/generators-iteration.js
Tue Aug 5 13:17:49 2014 UTC
+++ /branches/bleeding_edge/test/mjsunit/harmony/generators-iteration.js
Thu Aug 7 16:42:14 2014 UTC
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --harmony-generators --expose-gc --harmony-iteration
+// Flags: --harmony-generators --expose-gc
// Test generator iteration.
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/proxies.js Fri Mar 21
09:28:26 2014 UTC
+++ /branches/bleeding_edge/test/mjsunit/harmony/proxies.js Thu Aug 7
16:42:14 2014 UTC
@@ -1807,7 +1807,7 @@
},
})
-TestKeysThrow([], {
+TestKeysThrow({
get getOwnPropertyNames() {
return function() { return [1, 2] }
},
=======================================
--- /branches/bleeding_edge/test/mjsunit/mjsunit.status Wed Aug 6 11:38:51
2014 UTC
+++ /branches/bleeding_edge/test/mjsunit/mjsunit.status Thu Aug 7 16:42:14
2014 UTC
@@ -155,10 +155,10 @@
'harmony/regress/regress-3280': [PASS, NO_VARIANTS],
# Support for ES6 for-of iteration is missing.
- 'harmony/array-iterator': [PASS, NO_VARIANTS],
- 'harmony/iteration-semantics': [PASS, NO_VARIANTS],
- 'harmony/string-iterator': [PASS, NO_VARIANTS],
- 'harmony/typed-array-iterator': [PASS, NO_VARIANTS],
+ 'es6/array-iterator': [PASS, NO_VARIANTS],
+ 'es6/iteration-semantics': [PASS, NO_VARIANTS],
+ 'es6/string-iterator': [PASS, NO_VARIANTS],
+ 'es6/typed-array-iterator': [PASS, NO_VARIANTS],
##############################################################################
# Too slow in debug mode with --stress-opt mode.
=======================================
--- /branches/bleeding_edge/tools/gyp/v8.gyp Thu Aug 7 12:21:01 2014 UTC
+++ /branches/bleeding_edge/tools/gyp/v8.gyp Thu Aug 7 16:42:14 2014 UTC
@@ -1409,13 +1409,13 @@
'../../src/collection.js',
'../../src/collection-iterator.js',
'../../src/macros.py',
+ '../../src/array-iterator.js',
+ '../../src/string-iterator.js'
],
'experimental_library_files': [
'../../src/macros.py',
'../../src/proxy.js',
'../../src/generator.js',
- '../../src/array-iterator.js',
- '../../src/string-iterator.js',
'../../src/harmony-string.js',
'../../src/harmony-array.js',
'../../src/unscopables.js',
--
--
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.