OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // This benchmark is based on the six-speed benchmark build output. |
| 6 // Copyright 2014 Kevin Decker <https://github.com/kpdecker/six-speed/> |
| 7 |
| 8 load('../../base.js'); |
| 9 |
| 10 new BenchmarkSuite('Babel', [1000], [ |
| 11 new Benchmark('Babel', false, false, 0, Babel), |
| 12 ]); |
| 13 |
| 14 function _possibleConstructorReturn(self, call) { |
| 15 if (!self) { |
| 16 throw new ReferenceError( |
| 17 'this hasn\'t been initialised - super() hasn\'t been called'); |
| 18 } |
| 19 return call && (typeof call === 'object' || typeof call === 'function') ? |
| 20 call : |
| 21 self; |
| 22 } |
| 23 |
| 24 function _inherits(subClass, superClass) { |
| 25 if (typeof superClass !== 'function' && superClass !== null) { |
| 26 throw new TypeError( |
| 27 'Super expression must either be null or a function, not ' + |
| 28 typeof superClass); |
| 29 } |
| 30 subClass.prototype = Object.create(superClass && superClass.prototype, { |
| 31 constructor: { |
| 32 value: subClass, |
| 33 enumerable: false, |
| 34 writable: true, |
| 35 configurable: true |
| 36 } |
| 37 }); |
| 38 if (superClass) |
| 39 Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : |
| 40 subClass.__proto__ = superClass; |
| 41 } |
| 42 |
| 43 function _classCallCheck(instance, Constructor) { |
| 44 if (!(instance instanceof Constructor)) { |
| 45 throw new TypeError('Cannot call a class as a function'); |
| 46 } |
| 47 } |
| 48 |
| 49 var Point = function Point(x, y) { |
| 50 _classCallCheck(this, Point); |
| 51 |
| 52 this.x = x; |
| 53 this.y = y; |
| 54 }; |
| 55 |
| 56 var MyPoint = function(_Point) { |
| 57 _inherits(MyPoint, _Point); |
| 58 |
| 59 function MyPoint() { |
| 60 _classCallCheck(this, MyPoint); |
| 61 |
| 62 return _possibleConstructorReturn( |
| 63 this, (MyPoint.__proto__ || Object.getPrototypeOf(MyPoint)) |
| 64 .apply(this, arguments)); |
| 65 } |
| 66 |
| 67 return MyPoint; |
| 68 }(Point); |
| 69 |
| 70 function makePoint(x, y) { |
| 71 return new MyPoint(x, y); |
| 72 } |
| 73 |
| 74 function Babel() { |
| 75 'use strict'; |
| 76 return makePoint(1, 2); |
| 77 } |
| 78 |
| 79 load('run.js'); |
OLD | NEW |