Revision: 24684
Author:   dslo...@chromium.org
Date:     Fri Oct 17 09:26:55 2014 UTC
Log:      Initial set of perf tests for classes.

R=a...@chromium.org, machenb...@chromium.org, rossb...@chromium.org

Review URL: https://codereview.chromium.org/645933003
https://code.google.com/p/v8/source/detail?r=24684

Added:
 /branches/bleeding_edge/test/js-perf-test/Classes
 /branches/bleeding_edge/test/js-perf-test/Classes/Classes.json
 /branches/bleeding_edge/test/js-perf-test/Classes/run.js
 /branches/bleeding_edge/test/js-perf-test/Classes/super.js

=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/js-perf-test/Classes/Classes.json Fri Oct 17 09:26:55 2014 UTC
@@ -0,0 +1,12 @@
+{
+  "path": ["."],
+  "main": "run.js",
+  "flags": ["--harmony-classes"],
+  "run_count": 5,
+  "units": "score",
+  "results_regexp": "^%s\\-Classes\\(Score\\): (.+)$",
+  "total": true,
+  "tests": [
+    {"name": "Super"}
+  ]
+}
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/js-perf-test/Classes/run.js Fri Oct 17 09:26:55 2014 UTC
@@ -0,0 +1,27 @@
+// 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.
+
+
+load('../base.js');
+load('super.js');
+
+
+var success = true;
+
+function PrintResult(name, result) {
+  print(name + '-Classes(Score): ' + result);
+}
+
+
+function PrintError(name, error) {
+  PrintResult(name, error);
+  success = false;
+}
+
+
+BenchmarkSuite.config.doWarmup = undefined;
+BenchmarkSuite.config.doDeterministic = undefined;
+
+BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
+                           NotifyError: PrintError });
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/js-perf-test/Classes/super.js Fri Oct 17 09:26:55 2014 UTC
@@ -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();
+}

--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to