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

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: 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', [1000], [
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 function Derived() {
15 this._x = 1;
16 }
17
18
19 Base.prototype = {
20 constructor: Base,
21 get x() {
22 return this._x++;
23 },
24 set x(v) {
25 this._x += v;
26 return this._x;
27 }
28 }
29
30 Base.prototype.f = function() {
31 return this._x++;
32 }.toMethod(Base.prototype);
33
34 Derived.prototype = Object.create(Base.prototype);
35
36 Derived.prototype.SuperCall = function() {
37 return super.f();
38 }.toMethod(Derived.prototype);
39
40 Derived.prototype.GetterCall = function() {
41 return super.x;
42 }.toMethod(Derived.prototype);
43
44 Derived.prototype.SetterCall = function() {
45 return super.x = 5;
46 }.toMethod(Derived.prototype);
47
arv (Not doing code reviews) 2014/10/16 19:36:55 Object.setPrototypeOf(Derived, Base) too? Since t
Dmitry Lomov (no reviews) 2014/10/16 19:43:29 Done.
48 var derived = new Derived();
49
50 function SuperMethodCall() {
51 return derived.SuperCall();
52 }
53
54 function SuperGetterCall() {
55 return derived.GetterCall();
56 }
57
58 function SuperSetterCall() {
59 return derived.SetterCall();
60 }
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