diff options
Diffstat (limited to 'third_party/webkit/PerformanceTests/six-speed/tests')
52 files changed, 738 insertions, 0 deletions
diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/arrow-args.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/arrow-args.es5 new file mode 100644 index 0000000000..252c02a7c8 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/arrow-args.es5 @@ -0,0 +1,16 @@ +var obj = { + value: 42, + fn: function() { + var args = arguments; + return function() { + return args[0]; + }; + } +}; + +var fn = obj.fn(1); +assertEqual(fn(), 1); + +test(function() { + fn(); +}); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/arrow-args.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/arrow-args.es6 new file mode 100644 index 0000000000..1a82d36853 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/arrow-args.es6 @@ -0,0 +1,14 @@ + +var obj = { + value: 42, + fn: function() { + return () => arguments[0]; + } +}; + +var fn = obj.fn(1); +assertEqual(fn(), 1); + +test(function() { + fn(); +}); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/arrow-declare.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/arrow-declare.es5 new file mode 100644 index 0000000000..735654624e --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/arrow-declare.es5 @@ -0,0 +1,14 @@ +var obj = { + value: 42, + fn: function() { + return function() { + return obj.value; + }; + } +}; + +assertEqual(obj.fn()(), 42); + +test(function() { + obj.fn(); +}); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/arrow-declare.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/arrow-declare.es6 new file mode 100644 index 0000000000..9e37365b28 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/arrow-declare.es6 @@ -0,0 +1,13 @@ + +var obj = { + value: 42, + fn: function() { + return () => this.value; + } +}; + +assertEqual(obj.fn()(), 42); + +test(function() { + obj.fn(); +}); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/arrow.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/arrow.es5 new file mode 100644 index 0000000000..f1f7ff9c1d --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/arrow.es5 @@ -0,0 +1,15 @@ +var obj = { + value: 42, + fn: function() { + return function() { + return obj.value; + }; + } +}; + +var fn = obj.fn(); +assertEqual(fn(), 42); + +test(function() { + fn(); +}); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/arrow.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/arrow.es6 new file mode 100644 index 0000000000..f2c01493db --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/arrow.es6 @@ -0,0 +1,14 @@ + +var obj = { + value: 42, + fn: function() { + return () => this.value; + } +}; + +var fn = obj.fn(); +assertEqual(fn(), 42); + +test(function() { + fn(); +}); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/bindings-compound.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/bindings-compound.es5 new file mode 100644 index 0000000000..789d586cac --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/bindings-compound.es5 @@ -0,0 +1,11 @@ +var b = 2; + +assertEqual(fn(), 3); + +function fn() { + var a = 1; + a += b; + + return a; +} +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/bindings-compound.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/bindings-compound.es6 new file mode 100644 index 0000000000..cea478f070 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/bindings-compound.es6 @@ -0,0 +1,14 @@ +"use strict"; + +const b = 2; + +function fn() { + + let a = 1; + a += b; + + return a; +} + +assertEqual(fn(), 3); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/bindings.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/bindings.es5 new file mode 100644 index 0000000000..4d4df8362d --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/bindings.es5 @@ -0,0 +1,8 @@ +var a = 1, + b = 2; + +assertEqual(a+b, 3); + +test(function() { + return a + b; +}); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/bindings.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/bindings.es6 new file mode 100644 index 0000000000..44e34bc8d5 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/bindings.es6 @@ -0,0 +1,10 @@ +"use strict"; + +const a = 1; +let b = 2; + +assertEqual(a+b, 3); + +test(function() { + return a + b; +}); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/classes.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/classes.es5 new file mode 100644 index 0000000000..ae5c7c11fb --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/classes.es5 @@ -0,0 +1,11 @@ +function C() { + this.foo = 'bar'; +} +C.prototype.bar = function() { +}; + +assertEqual(new C().foo, 'bar'); + +test(function() { + return new C(); +}); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/classes.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/classes.es6 new file mode 100644 index 0000000000..9007b992f7 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/classes.es6 @@ -0,0 +1,13 @@ +class C { + constructor() { + this.foo = 'bar'; + } + bar() { + } +} + +assertEqual(new C().foo, 'bar'); + +test(function() { + return new C(); +}); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/defaults.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/defaults.es5 new file mode 100644 index 0000000000..eec3f0d2e7 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/defaults.es5 @@ -0,0 +1,14 @@ +function fn(arg, other) { + arg = arg === undefined ? 1 : arg; + other = other === undefined ? 3 : other; + return other; +} + +assertEqual(fn(), 3); +assertEqual(fn(1, 2), 2); + +test(function() { + fn(); + fn(2); + fn(2, 4); +}); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/defaults.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/defaults.es6 new file mode 100644 index 0000000000..1df8fdeb01 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/defaults.es6 @@ -0,0 +1,13 @@ +function fn(arg = 1, other = 3) { + return other; +} + + +assertEqual(fn(), 3); +assertEqual(fn(1, 2), 2); + +test(function() { + fn(); + fn(2); + fn(2, 4); +}); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/destructuring-simple.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/destructuring-simple.es5 new file mode 100644 index 0000000000..1bd89387cf --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/destructuring-simple.es5 @@ -0,0 +1,14 @@ +var data = { + a: 'foo', + b: {c: 'd'}, + arr: [1, 2, 3] +}; + +function fn() { + var a = data.a, + b = data.b; + return a; +} + +assertEqual(fn(), 'foo'); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/destructuring-simple.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/destructuring-simple.es6 new file mode 100644 index 0000000000..60fd3c010e --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/destructuring-simple.es6 @@ -0,0 +1,14 @@ +var data = { + a: 'foo', + b: {c: 'd'}, + arr: [1, 2, 3] +}; + +function fn() { + var {a, b} = data; + return a; +} + +assertEqual(fn(), 'foo'); + +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/destructuring.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/destructuring.es5 new file mode 100644 index 0000000000..7be5e3cfc8 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/destructuring.es5 @@ -0,0 +1,15 @@ +var data = { + a: 'foo', + b: {c: 'd'}, + arr: [1, 2, 3] +}; + +function fn() { + var a = data.a, + b = data.b.c, + c = data.arr[1]; + return c; +} + +assertEqual(fn(), 2); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/destructuring.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/destructuring.es6 new file mode 100644 index 0000000000..50e9b75bb3 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/destructuring.es6 @@ -0,0 +1,13 @@ +var data = { + a: 'foo', + b: {c: 'd'}, + arr: [1, 2, 3] +}; + +function fn() { + var {a, b:{c:b}, arr:[, c]} = data; + return c; +} + +assertEqual(fn(), 2); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/for-of-array.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/for-of-array.es5 new file mode 100644 index 0000000000..d27543f84a --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/for-of-array.es5 @@ -0,0 +1,13 @@ +var data = [1,2,3]; + +function fn() { + var ret = ''; + for (var i = 0; i < data.length; i++) { + ret += data[i]; + } + return ret; +} + +assertEqual(fn(), '123'); + +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/for-of-array.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/for-of-array.es6 new file mode 100644 index 0000000000..b64378948b --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/for-of-array.es6 @@ -0,0 +1,13 @@ +var data = [1,2,3]; + +function fn() { + var ret = ''; + for (var value of data) { + ret += value; + } + return ret; +} + +assertEqual(fn(), '123'); + +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/for-of-object.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/for-of-object.es5 new file mode 100644 index 0000000000..3dc1da1929 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/for-of-object.es5 @@ -0,0 +1,13 @@ +var data = {'a': 'b', 'c': 'd'}; +function fn() { + var ret = ''; + for (var name in data) { + if (data.hasOwnProperty(name)) { + ret += data[name]; + } + } + return ret; +} + +assertEqual(fn(), 'bd'); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/for-of-object.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/for-of-object.es6 new file mode 100644 index 0000000000..55b5fb6dd0 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/for-of-object.es6 @@ -0,0 +1,24 @@ +var data = {'a': 'b', 'c': 'd'}; +data[Symbol.iterator] = function() { + var array = Object.keys(data), + nextIndex = 0; + + return { + next: function() { + return nextIndex < array.length ? + {value: data[array[nextIndex++]], done: false} : + {done: true}; + } + }; +}; + +function fn() { + var ret = ''; + for (var value of data) { + ret += value; + } + return ret; +} + +assertEqual(fn(), 'bd'); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/generator.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/generator.es5 new file mode 100644 index 0000000000..d1b441c1da --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/generator.es5 @@ -0,0 +1,26 @@ +function generator() { + var i = 0; + return { + next: function() { + i++; + if (i >= 3) { + return {done: true}; + } else { + return { + value: i, + done: false + }; + } + } + }; +} + +function fn() { + var iterator = generator(); + iterator.next(); + iterator.next(); + return iterator.next().done; +} + +assertEqual(fn(), true); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/generator.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/generator.es6 new file mode 100644 index 0000000000..431fd76f22 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/generator.es6 @@ -0,0 +1,14 @@ +function * generator() { + yield 1; + yield 2; +} + +function fn() { + var iterator = generator(); + iterator.next(); + iterator.next(); + return iterator.next().done; +} + +assertEqual(fn(), true); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/map-set-lookup.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/map-set-lookup.es5 new file mode 100644 index 0000000000..e0fa70d97a --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/map-set-lookup.es5 @@ -0,0 +1,21 @@ +var keys = [], + values = [], + set = [], + key = {}; + +for (var i = 0; i < 500; i++) { + keys.push(i); + values.push(i); + set.push(i); +} + +keys.push(key); +values.push('bar'); +set.push(key); + +function fn() { + return set.indexOf(key) >= 0 && keys.indexOf(key) >= 0; +} + +assertEqual(fn(), true); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/map-set-lookup.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/map-set-lookup.es6 new file mode 100644 index 0000000000..2fc9c503e2 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/map-set-lookup.es6 @@ -0,0 +1,18 @@ +var map = new Map(), + set = new Set(), + key = {}; + +for (var i = 0; i < 500; i++) { + map.set(i, i); + set.add(i); +} + +map.set(key, 'bar'); +set.add(key); + +function fn() { + return map.has(key) && set.has(key); +} + +assertEqual(fn(), true); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/map-set-object.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/map-set-object.es5 new file mode 100644 index 0000000000..61dfcc5b21 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/map-set-object.es5 @@ -0,0 +1,21 @@ +function fn() { + var keys = [], + values = [], + set = [], + key = {}; + + for (var i = 0; i < 500; i++) { + keys.push(i); + values.push(i); + set.push(i); + } + + keys.push(key); + values.push('bar'); + set.push(key); + + return set.indexOf(key) >= 0 && keys.indexOf(key) >= 0; +} + +assertEqual(fn(), true); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/map-set-object.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/map-set-object.es6 new file mode 100644 index 0000000000..8624a0bb27 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/map-set-object.es6 @@ -0,0 +1,18 @@ +function fn() { + var map = new Map(), + set = new Set(), + key = {}; + + for (var i = 0; i < 500; i++) { + map.set(i, i); + set.add(i); + } + + map.set(key, 'bar'); + set.add(key); + + return map.has(key) && set.has(key); +} + +assertEqual(fn(), true); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/map-set.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/map-set.es5 new file mode 100644 index 0000000000..b99ec7ad04 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/map-set.es5 @@ -0,0 +1,16 @@ +function fn() { + var map = {}, + set = []; + + for (var i = 0; i < 250; i++) { + map[i] = i; + set.push(i); + } + + map.foo = 'bar'; + set.push('bar'); + return ('foo' in map) && set.indexOf('bar') >= 0; +} + +assertEqual(fn(), true); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/map-set.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/map-set.es6 new file mode 100644 index 0000000000..583450d1db --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/map-set.es6 @@ -0,0 +1,17 @@ +function fn() { + var map = new Map(), + set = new Set(); + + for (var i = 0; i < 250; i++) { + map.set(i, i); + set.add(i); + } + + map.set('foo', 'bar'); + set.add('bar'); + + return map.has('foo') && set.has('bar'); +} + +assertEqual(fn(), true); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/map-string.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/map-string.es5 new file mode 100644 index 0000000000..147547e6b4 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/map-string.es5 @@ -0,0 +1,12 @@ +var map = {}; + +for (var i = 0; i < 500; i++) { + map[i] = i; +} + +function fn() { + return map['499'] === 499; +} + +assertEqual(fn(), true); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/map-string.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/map-string.es6 new file mode 100644 index 0000000000..43b7811025 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/map-string.es6 @@ -0,0 +1,12 @@ +var map = new Map(); + +for (var i = 0; i < 500; i++) { + map.set(i + '', i); +} + +function fn() { + return map.get('499') === 499; +} + +assertEqual(fn(), true); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/object-assign.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/object-assign.es5 new file mode 100644 index 0000000000..33d1571d27 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/object-assign.es5 @@ -0,0 +1,28 @@ +var obj = { + a: 1, + b: true, + c: function () {}, + d: null, + e: 'e' +}; + +var fn = function (src) { + var o = {}; + var keys = Object.keys(src); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + o[key] = src[key]; + } + return o; +}; + +var r = fn(obj); +assertEqual(r.a, obj.a); +assertEqual(r.b, obj.b); +assertEqual(r.c, obj.c); +assertEqual(r.d, obj.d); +assertEqual(r.e, obj.e); + +test(function () { + fn(obj); +}); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/object-assign.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/object-assign.es6 new file mode 100644 index 0000000000..bdce0b20fc --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/object-assign.es6 @@ -0,0 +1,22 @@ +const obj = { + a: 1, + b: true, + c: function () {}, + d: null, + e: 'e' +}; + +const fn = function (src) { + return Object.assign({}, src); +}; + +const r = fn(obj); +assertEqual(r.a, obj.a); +assertEqual(r.b, obj.b); +assertEqual(r.c, obj.c); +assertEqual(r.d, obj.d); +assertEqual(r.e, obj.e); + +test(function () { + fn(obj); +}); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/object-literal-ext.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/object-literal-ext.es5 new file mode 100644 index 0000000000..5ea31687db --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/object-literal-ext.es5 @@ -0,0 +1,15 @@ +function fn() { + var name = 'foo'; + var ret = { + 'bizz buzz': function() { + return 1; + }, + name: name + }; + ret[name] = 'bar'; + ret[name + 'foo'] = 'foo'; + return ret; +} + +assertEqual(fn().foofoo, 'foo'); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/object-literal-ext.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/object-literal-ext.es6 new file mode 100644 index 0000000000..8b2052f990 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/object-literal-ext.es6 @@ -0,0 +1,14 @@ +function fn() { + var name = 'foo'; + return { + 'bizz buzz'() { + return 1; + }, + name, + [name]: 'bar', + [name + 'foo']: 'foo' + }; +} + +assertEqual(fn().foofoo, 'foo'); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/regex-u.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/regex-u.es5 new file mode 100644 index 0000000000..b91eadd1c5 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/regex-u.es5 @@ -0,0 +1,6 @@ +function fn() { + return '𠮷'.match(/^.$/); +} + +// Not asserting as this isn't quite an accurate test under es5 +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/regex-u.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/regex-u.es6 new file mode 100644 index 0000000000..828cbbcac7 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/regex-u.es6 @@ -0,0 +1,6 @@ +function fn() { + return '𠮷'.match(/^.$/u); +} + +assertEqual(!!fn(), true); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/rest.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/rest.es5 new file mode 100644 index 0000000000..6c9b56a09a --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/rest.es5 @@ -0,0 +1,13 @@ +function fn() { + return arguments[1]; +} + +assertEqual(fn(), undefined); +assertEqual(fn(2), undefined); +assertEqual(fn(2, 4), 4); + +test(function() { + fn(); + fn(2); + fn(2, 4); +}); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/rest.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/rest.es6 new file mode 100644 index 0000000000..41e4d91611 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/rest.es6 @@ -0,0 +1,13 @@ +function fn(foo, ...args) { + return args[0]; +} + +assertEqual(fn(), undefined); +assertEqual(fn(2), undefined); +assertEqual(fn(2, 4), 4); + +test(function() { + fn(); + fn(2); + fn(2, 4); +}); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/spread-generator.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/spread-generator.es5 new file mode 100644 index 0000000000..2a0305b349 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/spread-generator.es5 @@ -0,0 +1,27 @@ +function generator() { + var i = 0; + return { + next: function() { + i++; + if (i >= 4) { + return {done: true}; + } else { + return { + value: i, + done: false + }; + } + } + }; +} + +function fn() { + var iterator = generator(); + var args = [iterator.next().value, iterator.next().value, iterator.next().value]; + iterator.next(); + + return Math.max.apply(Math, args); +} + +assertEqual(fn(), 3); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/spread-generator.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/spread-generator.es6 new file mode 100644 index 0000000000..a7831295a9 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/spread-generator.es6 @@ -0,0 +1,11 @@ +function *generate() { + yield 1; + yield 2; + yield 3; +} + +function fn() { + return Math.max(... generate()); +} +assertEqual(fn(), 3); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/spread-literal.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/spread-literal.es5 new file mode 100644 index 0000000000..d76d88edf9 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/spread-literal.es5 @@ -0,0 +1,8 @@ +function fn() { + var ret = [1]; + ret.push(1, 2, 3); + return ret; +} + +assertEqual(fn()[3], 3); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/spread-literal.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/spread-literal.es6 new file mode 100644 index 0000000000..b180fb5587 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/spread-literal.es6 @@ -0,0 +1,5 @@ +function fn() { + return [1, ... [1, 2, 3]]; +} +assertEqual(fn()[3], 3); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/spread.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/spread.es5 new file mode 100644 index 0000000000..bd13f44c6f --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/spread.es5 @@ -0,0 +1,6 @@ +function fn() { + return Math.max.apply(Math, [1,2,3]); +} + +assertEqual(fn(), 3); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/spread.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/spread.es6 new file mode 100644 index 0000000000..95ee937d24 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/spread.es6 @@ -0,0 +1,6 @@ +function fn() { + return Math.max(...[1,2,3]); +} + +assertEqual(fn(), 3); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/super.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/super.es5 new file mode 100644 index 0000000000..8edc527127 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/super.es5 @@ -0,0 +1,23 @@ +function C() { + this.foo = 'bar'; +} +C.prototype.bar = function() { + return 41; +}; + + +function D() { + C.call(this); + this.baz = 'bat'; +} +D.prototype = Object.create(C.prototype); +D.prototype.bar = function() { + return C.prototype.bar.call(this) + 1; +}; +function fn() { + var d = new D(); + return d.bar(); +} + +assertEqual(fn(), 42); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/super.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/super.es6 new file mode 100644 index 0000000000..29386be524 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/super.es6 @@ -0,0 +1,25 @@ + +class C { + constructor() { + this.foo = 'bar'; + } + bar() { + return 41; + } +} +class D extends C { + constructor() { + super(); + this.baz = 'bat'; + } + bar() { + return super.bar() + 1; + } +} +function fn() { + var d = new D(); + return d.bar(); +} + +assertEqual(fn(), 42); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/template_string.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/template_string.es5 new file mode 100644 index 0000000000..6296ad3625 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/template_string.es5 @@ -0,0 +1,7 @@ +var data = [1,2,3]; +function fn() { + return data[0] + ' ' + (data[1] + data[2]); +} + +assertEqual(fn(), '1 5'); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/template_string.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/template_string.es6 new file mode 100644 index 0000000000..3e891237b9 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/template_string.es6 @@ -0,0 +1,7 @@ +var data = [1,2,3]; +function fn() { + return `${data[0]} ${data[1] + data[2]}`; +} + +assertEqual(fn(), '1 5'); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/template_string_tag.es5 b/third_party/webkit/PerformanceTests/six-speed/tests/template_string_tag.es5 new file mode 100644 index 0000000000..a0e5db0507 --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/template_string_tag.es5 @@ -0,0 +1,11 @@ +var data = [1, 2, 3]; +function tag(strings, value1, value2) { + return strings[0] + value1 + strings[1] + value2 + strings[2]; +} + +function fn() { + return tag(['', ' ', ''], data[0], data[1] + data[2]); +} + +assertEqual(fn(), '1 5'); +test(fn); diff --git a/third_party/webkit/PerformanceTests/six-speed/tests/template_string_tag.es6 b/third_party/webkit/PerformanceTests/six-speed/tests/template_string_tag.es6 new file mode 100644 index 0000000000..dec6501bce --- /dev/null +++ b/third_party/webkit/PerformanceTests/six-speed/tests/template_string_tag.es6 @@ -0,0 +1,11 @@ +var data = [1, 2, 3]; +function tag(strings, value1, value2) { + return strings[0] + value1 + strings[1] + value2 + strings[2]; +} + +function fn() { + return tag`${data[0]} ${data[1] + data[2]}`; +} + +assertEqual(fn(), '1 5'); +test(fn); |