From 98ca77a0e1cc676ad9bfff663d5fcfe734f9843a Mon Sep 17 00:00:00 2001 From: petermarshall Date: Fri, 3 Feb 2017 06:07:16 -0800 Subject: [PATCH] [Test] Reconfigure SuperSpread benchmarks to run in separate processes. BUG=v8:5922 Review-Url: https://codereview.chromium.org/2669223002 Cr-Commit-Position: refs/heads/master@{#42929} --- test/js-perf-test/SixSpeed.json | 23 +-- .../SixSpeed/super_spread/babel.js | 75 ++++++++++ .../js-perf-test/SixSpeed/super_spread/es5.js | 28 ++++ .../js-perf-test/SixSpeed/super_spread/es6.js | 28 ++++ .../js-perf-test/SixSpeed/super_spread/run.js | 2 +- .../SixSpeed/super_spread/super_spread.js | 133 ------------------ 6 files changed, 147 insertions(+), 142 deletions(-) create mode 100644 test/js-perf-test/SixSpeed/super_spread/babel.js create mode 100644 test/js-perf-test/SixSpeed/super_spread/es5.js create mode 100644 test/js-perf-test/SixSpeed/super_spread/es6.js delete mode 100644 test/js-perf-test/SixSpeed/super_spread/super_spread.js diff --git a/test/js-perf-test/SixSpeed.json b/test/js-perf-test/SixSpeed.json index 47c6d934af..417ec89569 100644 --- a/test/js-perf-test/SixSpeed.json +++ b/test/js-perf-test/SixSpeed.json @@ -54,17 +54,24 @@ { "name": "SuperSpread", "path": ["SixSpeed/super_spread"], - "main": "run.js", - "resources": [ - "run.js", - "super_spread.js" - ], "flags": ["--future"], "results_regexp": "^%s\\(Score\\): (.+)$", "tests": [ - {"name": "SuperSpread-ES5"}, - {"name": "SuperSpread-Babel"}, - {"name": "SuperSpread-ES6"} + { + "name": "ES5", + "main": "run.js", + "test_flags": ["es5"] + }, + { + "name": "Babel", + "main": "run.js", + "test_flags": ["babel"] + }, + { + "name": "ES6", + "main": "run.js", + "test_flags": ["es6"] + } ] } ] diff --git a/test/js-perf-test/SixSpeed/super_spread/babel.js b/test/js-perf-test/SixSpeed/super_spread/babel.js new file mode 100644 index 0000000000..c736477c83 --- /dev/null +++ b/test/js-perf-test/SixSpeed/super_spread/babel.js @@ -0,0 +1,75 @@ +// Copyright 2017 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. + +// This benchmark is based on the six-speed benchmark build output. +// Copyright 2014 Kevin Decker + +new BenchmarkSuite('Babel', [1000], [ + new Benchmark('Babel', false, false, 0, Babel), +]); + +function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError( + 'this hasn\'t been initialised - super() hasn\'t been called'); + } + return call && (typeof call === 'object' || typeof call === 'function') ? + call : + self; +} + +function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError( + 'Super expression must either be null or a function, not ' + + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : + subClass.__proto__ = superClass; +} + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } +} + +var Point = function Point(x, y) { + _classCallCheck(this, Point); + + this.x = x; + this.y = y; +}; + +var MyPoint = function(_Point) { + _inherits(MyPoint, _Point); + + function MyPoint() { + _classCallCheck(this, MyPoint); + + return _possibleConstructorReturn( + this, (MyPoint.__proto__ || Object.getPrototypeOf(MyPoint)) + .apply(this, arguments)); + } + + return MyPoint; +}(Point); + +function makePoint(x, y) { + return new MyPoint(x, y); +} + +function Babel() { + 'use strict'; + return makePoint(1, 2); +} diff --git a/test/js-perf-test/SixSpeed/super_spread/es5.js b/test/js-perf-test/SixSpeed/super_spread/es5.js new file mode 100644 index 0000000000..7d56d94a42 --- /dev/null +++ b/test/js-perf-test/SixSpeed/super_spread/es5.js @@ -0,0 +1,28 @@ +// Copyright 2017 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. + +// This benchmark is based on the six-speed benchmark build output. +// Copyright 2014 Kevin Decker + +new BenchmarkSuite('ES5', [1000], [ + new Benchmark('ES5', false, false, 0, ES5), +]); + +function Point(x, y) { + this.x = x; + this.y = y; +} + +function MyPoint() { + Point.apply(this, arguments); +} + +function makePoint(x, y) { + return new MyPoint(x, y); +} + +function ES5() { + 'use strict'; + return makePoint(1, 2); +} diff --git a/test/js-perf-test/SixSpeed/super_spread/es6.js b/test/js-perf-test/SixSpeed/super_spread/es6.js new file mode 100644 index 0000000000..4640ff4bb3 --- /dev/null +++ b/test/js-perf-test/SixSpeed/super_spread/es6.js @@ -0,0 +1,28 @@ +// Copyright 2017 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. + +// This benchmark is based on the six-speed benchmark build output. +// Copyright 2014 Kevin Decker + +new BenchmarkSuite('ES6', [1000], [ + new Benchmark('ES6', false, false, 0, ES6), +]); + +class Point { + constructor(x, y) { + this.x = x; + this.y = y; + } +} + +class MyPoint extends Point {} + +function makePoint(x, y) { + return new MyPoint(x, y); +} + +function ES6() { + 'use strict'; + return makePoint(1, 2); +} diff --git a/test/js-perf-test/SixSpeed/super_spread/run.js b/test/js-perf-test/SixSpeed/super_spread/run.js index 7d55265cf8..3025caf8a8 100644 --- a/test/js-perf-test/SixSpeed/super_spread/run.js +++ b/test/js-perf-test/SixSpeed/super_spread/run.js @@ -3,7 +3,7 @@ // found in the LICENSE file. load('../../base.js'); -load('super_spread.js'); +load(arguments[0] + '.js'); var success = true; diff --git a/test/js-perf-test/SixSpeed/super_spread/super_spread.js b/test/js-perf-test/SixSpeed/super_spread/super_spread.js deleted file mode 100644 index 35f257afb5..0000000000 --- a/test/js-perf-test/SixSpeed/super_spread/super_spread.js +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright 2017 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. - -// This benchmark is based on the six-speed benchmark build output. -// Copyright 2014 Kevin Decker - -new BenchmarkSuite('SuperSpread-ES5', [1000], [ - new Benchmark('ES5', false, false, 0, ES5), -]); - -new BenchmarkSuite('SuperSpread-Babel', [1000], [ - new Benchmark('Babel', false, false, 0, Babel), -]); - -new BenchmarkSuite('SuperSpread-ES6', [1000], [ - new Benchmark('ES6', false, false, 0, ES6), -]); - -// ---------------------------------------------------------------------------- -// Benchmark: ES5 -// ---------------------------------------------------------------------------- - -function ES5() { - 'use strict'; - - function Point(x, y) { - this.x = x; - this.y = y; - } - - function MyPoint() { - Point.apply(this, arguments); - } - - function makePoint(x, y) { - return new MyPoint(x, y); - } - - return makePoint(1, 2); -} - -// ---------------------------------------------------------------------------- -// Benchmark: Babel -// ---------------------------------------------------------------------------- - -function _possibleConstructorReturn(self, call) { - if (!self) { - throw new ReferenceError( - 'this hasn\'t been initialised - super() hasn\'t been called'); - } - return call && (typeof call === 'object' || typeof call === 'function') ? - call : - self; -} - -function _inherits(subClass, superClass) { - if (typeof superClass !== 'function' && superClass !== null) { - throw new TypeError( - 'Super expression must either be null or a function, not ' + - typeof superClass); - } - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - enumerable: false, - writable: true, - configurable: true - } - }); - if (superClass) - Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : - subClass.__proto__ = superClass; -} - -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError('Cannot call a class as a function'); - } -} - -function Babel() { - 'use strict'; - var Point = function Point(x, y) { - _classCallCheck(this, Point); - - this.x = x; - this.y = y; - }; - - var MyPoint = function(_Point) { - _inherits(MyPoint, _Point); - - function MyPoint() { - _classCallCheck(this, MyPoint); - - return _possibleConstructorReturn( - this, (MyPoint.__proto__ || Object.getPrototypeOf(MyPoint)) - .apply(this, arguments)); - } - - return MyPoint; - }(Point); - - function makePoint(x, y) { - return new MyPoint(x, y); - } - - return makePoint(1, 2); -} - -// ---------------------------------------------------------------------------- -// Benchmark: ES6 -// ---------------------------------------------------------------------------- - -function ES6() { - 'use strict'; - - class Point { - constructor(x, y) { - this.x = x; - this.y = y; - } - } - - class MyPoint extends Point {} - - function makePoint(x, y) { - return new MyPoint(x, y); - } - - return makePoint(1, 2); -}