Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: test/js-perf-test/Classes/super.js

Issue 645933003: Initial set of perf tests for classes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased patch for landing Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/js-perf-test/Classes/run.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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 'use strict';
5
6 var SuperBenchmark = new BenchmarkSuite('Super', [100], [
7 new Benchmark('SuperMethodCall', false, false, 0, SuperMethodCall),
8 new Benchmark('SuperGetterCall', false, false, 0, SuperGetterCall),
9 new Benchmark('SuperSetterCall', false, false, 0, SuperSetterCall),
10 ]);
11
12
13 function Base() { }
14 Base.prototype = {
15 constructor: Base,
16 get x() {
17 return this._x++;
18 },
19 set x(v) {
20 this._x += v;
21 return this._x;
22 }
23 }
24
25 Base.prototype.f = function() {
26 return this._x++;
27 }.toMethod(Base.prototype);
28
29 function Derived() {
30 this._x = 1;
31 }
32 Derived.prototype = Object.create(Base.prototype);
33 Object.setPrototypeOf(Derived, Base);
34
35 Derived.prototype.SuperCall = function() {
36 return super.f();
37 }.toMethod(Derived.prototype);
38
39 Derived.prototype.GetterCall = function() {
40 return super.x;
41 }.toMethod(Derived.prototype);
42
43 Derived.prototype.SetterCall = function() {
44 return super.x = 5;
45 }.toMethod(Derived.prototype);
46
47 var derived = new Derived();
48
49 function SuperMethodCall() {
50 return derived.SuperCall();
51 }
52
53 function SuperGetterCall() {
54 return derived.GetterCall();
55 }
56
57 function SuperSetterCall() {
58 return derived.SetterCall();
59 }
OLDNEW
« no previous file with comments | « test/js-perf-test/Classes/run.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698