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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/js-perf-test/Classes/run.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/js-perf-test/Classes/super.js
diff --git a/test/js-perf-test/Classes/super.js b/test/js-perf-test/Classes/super.js
new file mode 100644
index 0000000000000000000000000000000000000000..a9ec7666884a8f9b683075885c7c7c170ccd38af
--- /dev/null
+++ b/test/js-perf-test/Classes/super.js
@@ -0,0 +1,59 @@
+// Copyright 2014 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.
+'use strict';
+
+var SuperBenchmark = new BenchmarkSuite('Super', [100], [
+ new Benchmark('SuperMethodCall', false, false, 0, SuperMethodCall),
+ new Benchmark('SuperGetterCall', false, false, 0, SuperGetterCall),
+ new Benchmark('SuperSetterCall', false, false, 0, SuperSetterCall),
+]);
+
+
+function Base() { }
+Base.prototype = {
+ constructor: Base,
+ get x() {
+ return this._x++;
+ },
+ set x(v) {
+ this._x += v;
+ return this._x;
+ }
+}
+
+Base.prototype.f = function() {
+ return this._x++;
+}.toMethod(Base.prototype);
+
+function Derived() {
+ this._x = 1;
+}
+Derived.prototype = Object.create(Base.prototype);
+Object.setPrototypeOf(Derived, Base);
+
+Derived.prototype.SuperCall = function() {
+ return super.f();
+}.toMethod(Derived.prototype);
+
+Derived.prototype.GetterCall = function() {
+ return super.x;
+}.toMethod(Derived.prototype);
+
+Derived.prototype.SetterCall = function() {
+ return super.x = 5;
+}.toMethod(Derived.prototype);
+
+var derived = new Derived();
+
+function SuperMethodCall() {
+ return derived.SuperCall();
+}
+
+function SuperGetterCall() {
+ return derived.GetterCall();
+}
+
+function SuperSetterCall() {
+ return derived.SetterCall();
+}
« 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