Get rid of options member variable in Benchmark.
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Feb 2016 03:30:18 +0000 (03:30 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Feb 2016 03:30:18 +0000 (03:30 +0000)
Options are only needed when initializing the stage or benchmark, so there's no
need to also keep a reference to it.

* Animometer/tests/resources/main.js: Get rid of options variable in Benchmark.
Pass options to Controllers and Stages.
(Controller.Utilities.createClass):
(Benchmark.Utilities.createClass):
(get options): Deleted.

* Animometer/tests/bouncing-particles/resources/bouncing-canvas-images.js:
* Animometer/tests/bouncing-particles/resources/bouncing-canvas-particles.js:
* Animometer/tests/bouncing-particles/resources/bouncing-canvas-shapes.js:
* Animometer/tests/bouncing-particles/resources/bouncing-css-images.js:
* Animometer/tests/bouncing-particles/resources/bouncing-css-shapes.js:
* Animometer/tests/bouncing-particles/resources/bouncing-particles.js:
* Animometer/tests/bouncing-particles/resources/bouncing-svg-images.js:
* Animometer/tests/bouncing-particles/resources/bouncing-svg-shapes.js:
* Animometer/tests/master/resources/canvas-stage.js:
* Animometer/tests/master/resources/canvas-tests.js:
* Animometer/tests/master/resources/particles.js:
* Animometer/tests/misc/resources/canvas-electrons.js:
* Animometer/tests/misc/resources/canvas-stars.js:
* Animometer/tests/misc/resources/compositing-transforms.js:
* Animometer/tests/simple/resources/simple-canvas-paths.js:
* Animometer/tests/simple/resources/tiled-canvas-image.js:
* Animometer/tests/template/resources/template-canvas.js:
* Animometer/tests/template/resources/template-css.js:
* Animometer/tests/template/resources/template-svg.js:
* Animometer/tests/text/resources/layering-text.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196289 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 files changed:
PerformanceTests/Animometer/tests/bouncing-particles/resources/bouncing-canvas-images.js
PerformanceTests/Animometer/tests/bouncing-particles/resources/bouncing-canvas-particles.js
PerformanceTests/Animometer/tests/bouncing-particles/resources/bouncing-canvas-shapes.js
PerformanceTests/Animometer/tests/bouncing-particles/resources/bouncing-css-images.js
PerformanceTests/Animometer/tests/bouncing-particles/resources/bouncing-css-shapes.js
PerformanceTests/Animometer/tests/bouncing-particles/resources/bouncing-particles.js
PerformanceTests/Animometer/tests/bouncing-particles/resources/bouncing-svg-images.js
PerformanceTests/Animometer/tests/bouncing-particles/resources/bouncing-svg-shapes.js
PerformanceTests/Animometer/tests/master/resources/canvas-stage.js
PerformanceTests/Animometer/tests/master/resources/canvas-tests.js
PerformanceTests/Animometer/tests/master/resources/particles.js
PerformanceTests/Animometer/tests/misc/resources/canvas-electrons.js
PerformanceTests/Animometer/tests/misc/resources/canvas-stars.js
PerformanceTests/Animometer/tests/misc/resources/compositing-transforms.js
PerformanceTests/Animometer/tests/resources/main.js
PerformanceTests/Animometer/tests/simple/resources/simple-canvas-paths.js
PerformanceTests/Animometer/tests/simple/resources/tiled-canvas-image.js
PerformanceTests/Animometer/tests/template/resources/template-canvas.js
PerformanceTests/Animometer/tests/template/resources/template-css.js
PerformanceTests/Animometer/tests/template/resources/template-svg.js
PerformanceTests/Animometer/tests/text/resources/layering-text.js
PerformanceTests/ChangeLog

index d1eb111..5fba5ad 100644 (file)
@@ -22,10 +22,10 @@ BouncingCanvasImagesStage = Utilities.createSubclass(BouncingCanvasParticlesStag
         BouncingCanvasParticlesStage.call(this);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        BouncingCanvasParticlesStage.prototype.initialize.call(this, benchmark);
-        var imageSrc = benchmark.options["imageSrc"] || "resources/yin-yang.svg";
+        BouncingCanvasParticlesStage.prototype.initialize.call(this, benchmark, options);
+        var imageSrc = options["imageSrc"] || "resources/yin-yang.svg";
         this.imageElement = document.querySelector(".hidden[src=\"" + imageSrc + "\"]");
     },
 
index 9b18944..0a76ba0 100644 (file)
@@ -72,9 +72,9 @@ BouncingCanvasParticlesStage = Utilities.createSubclass(BouncingParticlesStage,
         BouncingParticlesStage.call(this);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        BouncingParticlesStage.prototype.initialize.call(this, benchmark);
+        BouncingParticlesStage.prototype.initialize.call(this, benchmark, options);
         this.context = this.element.getContext("2d");
     },
 
index b2d14ac..49a31cf 100644 (file)
@@ -63,10 +63,10 @@ BouncingCanvasShapesStage = Utilities.createSubclass(BouncingCanvasParticlesStag
         BouncingCanvasParticlesStage.call(this);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        BouncingCanvasParticlesStage.prototype.initialize.call(this, benchmark);
-        this.parseShapeParameters(benchmark.options);
+        BouncingCanvasParticlesStage.prototype.initialize.call(this, benchmark, options);
+        this.parseShapeParameters(options);
     },
 
     createParticle: function()
index 4d006c3..ce9a48c 100644 (file)
@@ -32,10 +32,10 @@ BouncingCssImagesStage = Utilities.createSubclass(BouncingParticlesStage,
         BouncingParticlesStage.call(this);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        BouncingParticlesStage.prototype.initialize.call(this, benchmark);
-        this.imageSrc = benchmark.options["imageSrc"] || "../resources/yin-yang.svg";
+        BouncingParticlesStage.prototype.initialize.call(this, benchmark, options);
+        this.imageSrc = options["imageSrc"] || "../resources/yin-yang.svg";
     },
 
     createParticle: function()
index c43c8a5..82c93c2 100644 (file)
@@ -50,10 +50,10 @@ BouncingCssShapesStage = Utilities.createSubclass(BouncingParticlesStage,
         BouncingParticlesStage.call(this);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        BouncingParticlesStage.prototype.initialize.call(this, benchmark);
-        this.parseShapeParameters(benchmark.options);
+        BouncingParticlesStage.prototype.initialize.call(this, benchmark, options);
+        this.parseShapeParameters(options);
     },
 
     createParticle: function()
index 0665916..683dc2a 100644 (file)
@@ -72,11 +72,11 @@ BouncingParticlesStage = Utilities.createSubclass(Stage,
         this.particles = [];
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        Stage.prototype.initialize.call(this, benchmark);
-        this.particleSize = new Point(parseInt(benchmark.options["particleWidth"]) || 10, parseInt(benchmark.options["particleHeight"]) || 10);
-        this.maxVelocity = Math.max(parseInt(benchmark.options["maxVelocity"]) || 500, 100);
+        Stage.prototype.initialize.call(this, benchmark, options);
+        this.particleSize = new Point(parseInt(options["particleWidth"]) || 10, parseInt(options["particleHeight"]) || 10);
+        this.maxVelocity = Math.max(parseInt(options["maxVelocity"]) || 500, 100);
     },
 
     parseShapeParameters: function(options)
index dd244af..2239557 100644 (file)
@@ -18,10 +18,10 @@ BouncingSvgImagesStage = Utilities.createSubclass(BouncingSvgParticlesStage,
         BouncingSvgParticlesStage.call(this);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        BouncingSvgParticlesStage.prototype.initialize.call(this, benchmark);
-        this.imageSrc = benchmark.options["imageSrc"] || "resources/yin-yang.svg";
+        BouncingSvgParticlesStage.prototype.initialize.call(this, benchmark, options);
+        this.imageSrc = options["imageSrc"] || "resources/yin-yang.svg";
     },
 
     createParticle: function()
index d05ab11..5588cdc 100644 (file)
@@ -51,10 +51,10 @@ BouncingSvgShapesStage = Utilities.createSubclass(BouncingSvgParticlesStage,
         BouncingSvgParticlesStage.call(this);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        BouncingSvgParticlesStage.prototype.initialize.call(this, benchmark);
-        this.parseShapeParameters(benchmark.options);
+        BouncingSvgParticlesStage.prototype.initialize.call(this, benchmark, options);
+        this.parseShapeParameters(options);
         this._gradientsCount = 0;
     },
 
index 53db13c..e394f92 100644 (file)
@@ -6,9 +6,9 @@ SimpleCanvasStage = Utilities.createSubclass(Stage,
         this.objects = [];
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        Stage.prototype.initialize.call(this, benchmark);
+        Stage.prototype.initialize.call(this, benchmark, options);
         this.context = this.element.getContext("2d");
     },
 
index a70c75b..5ee2a40 100644 (file)
@@ -127,10 +127,10 @@ CanvasLineSegmentStage = Utilities.createSubclass(SimpleCanvasStage,
         SimpleCanvasStage.call(this, CanvasLineSegment);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        SimpleCanvasStage.prototype.initialize.call(this, benchmark);
-        this.context.lineCap = benchmark.options["lineCap"] || "butt";
+        SimpleCanvasStage.prototype.initialize.call(this, benchmark, options);
+        this.context.lineCap = options["lineCap"] || "butt";
         this.circleRadius = this.size.x / 3 / 2 - 20;
     },
 
@@ -162,11 +162,11 @@ CanvasLinePathStage = Utilities.createSubclass(SimpleCanvasStage,
         SimpleCanvasStage.call(this, CanvasLinePoint);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        SimpleCanvasStage.prototype.initialize.call(this, benchmark);
-        this.context.lineJoin = benchmark.options["lineJoin"] || "bevel";
-        this.context.lineCap = benchmark.options["lineCap"] || "butt";
+        SimpleCanvasStage.prototype.initialize.call(this, benchmark, options);
+        this.context.lineJoin = options["lineJoin"] || "bevel";
+        this.context.lineCap = options["lineCap"] || "butt";
     },
 
     animate: function() {
index 8c9583d..807d03c 100644 (file)
@@ -78,9 +78,9 @@ ParticlesStage = Utilities.createSubclass(Stage,
         this.particles = [];
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        Stage.prototype.initialize.call(this, benchmark);
+        Stage.prototype.initialize.call(this, benchmark, options);
         this.emissionSpin = Stage.random(0, 3);
         this.emitSteps = Stage.randomInt(4, 6);
     },
index abc2798..27865b6 100644 (file)
@@ -61,9 +61,9 @@ CanvasElectronsStage = Utilities.createSubclass(Stage,
         this._electrons = [];
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        Stage.prototype.initialize.call(this, benchmark);
+        Stage.prototype.initialize.call(this, benchmark, options);
         this.context = this.element.getContext("2d");
     },
 
index d286148..dc8c0ca 100644 (file)
@@ -58,9 +58,9 @@ CanvasStarsStage = Utilities.createSubclass(Stage,
         this._objects = [];
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        Stage.prototype.initialize.call(this, benchmark);
+        Stage.prototype.initialize.call(this, benchmark, options);
         this.context = this.element.getContext("2d");
     },
 
index a03f553..9fd401e 100644 (file)
@@ -35,12 +35,12 @@ CompositingTransformsStage = Utilities.createSubclass(BouncingParticlesStage,
         BouncingParticlesStage.call(this);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        BouncingParticlesStage.prototype.initialize.call(this, benchmark);
+        BouncingParticlesStage.prototype.initialize.call(this, benchmark, options);
 
-        this.imageSrc = benchmark.options["imageSrc"] || "../resources/yin-yang.svg";
-        this.useFilters = benchmark.options["filters"] == "yes";
+        this.imageSrc = options["imageSrc"] || "../resources/yin-yang.svg";
+        this.useFilters = options["filters"] == "yes";
     },
 
     createParticle: function()
index b74a314..a405f63 100644 (file)
@@ -1,14 +1,13 @@
-
 Controller = Utilities.createClass(
-    function(testLength, benchmark, seriesCount)
+    function(testLength, benchmark, options)
     {
         // Initialize timestamps relative to the start of the benchmark
         // In start() the timestamps are offset by the start timestamp
         this._startTimestamp = 0;
         this._endTimestamp = testLength;
         // Default data series: timestamp, complexity, estimatedFrameLength
-        this._sampler = new Sampler(seriesCount || 3, 60 * testLength, this);
-        this._estimator = new SimpleKalmanEstimator(benchmark.options["kalman-process-error"], benchmark.options["kalman-measurement-error"]);
+        this._sampler = new Sampler(options["series-count"] || 3, 60 * testLength, this);
+        this._estimator = new SimpleKalmanEstimator(options["kalman-process-error"], options["kalman-measurement-error"]);
 
         this.initialComplexity = 0;
     }, {
@@ -101,23 +100,23 @@ Controller = Utilities.createClass(
 });
 
 FixedComplexityController = Utilities.createSubclass(Controller,
-    function(testInterval, benchmark)
+    function(testInterval, benchmark, options)
     {
-        Controller.call(this, testInterval, benchmark);
-        this.initialComplexity = benchmark.options["complexity"];
+        Controller.call(this, testInterval, benchmark, options);
+        this.initialComplexity = options["complexity"];
     }
 );
 
 AdaptiveController = Utilities.createSubclass(Controller,
-    function(testInterval, benchmark)
+    function(testInterval, benchmark, options)
     {
         // Data series: timestamp, complexity, estimatedIntervalFrameLength
-        Controller.call(this, testInterval, benchmark);
+        Controller.call(this, testInterval, benchmark, options);
 
         // All tests start at 0, so we expect to see 60 fps quickly.
         this._samplingTimestamp = testInterval / 2;
         this._startedSampling = false;
-        this._targetFrameRate = benchmark.options["frame-rate"];
+        this._targetFrameRate = options["frame-rate"];
         this._pid = new PIDController(this._targetFrameRate);
 
         this._intervalFrameCount = 0;
@@ -311,30 +310,24 @@ Rotater = Utilities.createClass(
 Benchmark = Utilities.createClass(
     function(stage, options)
     {
-        this._options = options;
         this._animateLoop = this._animateLoop.bind(this);
 
         this._stage = stage;
-        this._stage.initialize(this);
+        this._stage.initialize(this, options);
 
         var testIntervalMilliseconds = options["test-interval"] * 1000;
         switch (options["adjustment"])
         {
         case "fixed":
-            this._controller = new FixedComplexityController(testIntervalMilliseconds, this);
+            this._controller = new FixedComplexityController(testIntervalMilliseconds, this, options);
             break;
         case "adaptive":
         default:
-            this._controller = new AdaptiveController(testIntervalMilliseconds, this);
+            this._controller = new AdaptiveController(testIntervalMilliseconds, this, options);
             break;
         }
     }, {
 
-    get options()
-    {
-        return this._options;
-    },
-
     get stage()
     {
         return this._stage;
index d25ef8d..88e4c1c 100644 (file)
@@ -256,10 +256,10 @@ CanvasLineSegmentStage = Utilities.createSubclass(SimpleCanvasStage,
         SimpleCanvasStage.call(this, CanvasLineSegment);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        SimpleCanvasStage.prototype.initialize.call(this, benchmark);
-        this.context.lineCap = benchmark.options["lineCap"] || "butt";
+        SimpleCanvasStage.prototype.initialize.call(this, benchmark, options);
+        this.context.lineCap = options["lineCap"] || "butt";
     }
 });
 
@@ -269,10 +269,10 @@ CanvasLinePathStage = Utilities.createSubclass(SimpleCanvasPathStrokeStage,
         SimpleCanvasPathStrokeStage.call(this, CanvasLinePoint);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        SimpleCanvasPathStrokeStage.prototype.initialize.call(this, benchmark);
-        this.context.lineJoin = benchmark.options["lineJoin"] || "bevel";
+        SimpleCanvasPathStrokeStage.prototype.initialize.call(this, benchmark, options);
+        this.context.lineJoin = options["lineJoin"] || "bevel";
     }
 });
 
@@ -283,9 +283,9 @@ CanvasLineDashStage = Utilities.createSubclass(SimpleCanvasStage,
         this._step = 0;
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        SimpleCanvasStage.prototype.initialize.call(this, benchmark);
+        SimpleCanvasStage.prototype.initialize.call(this, benchmark, options);
         this.context.setLineDash([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
         this.context.lineWidth = 1;
         this.context.strokeStyle = "#000";
index a890ac1..4c7b421 100644 (file)
@@ -25,9 +25,9 @@ TiledCanvasImageStage = Utilities.createSubclass(Stage,
         Stage.call(this);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        Stage.prototype.initialize.call(this, benchmark);
+        Stage.prototype.initialize.call(this, benchmark, options);
         this.context = this.element.getContext("2d");
         this._setupTiles();
     },
index d3686f1..61a8af6 100644 (file)
@@ -32,9 +32,9 @@ TemplateCanvasStage = Utilities.createSubclass(Stage,
         Stage.call(this);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        Stage.prototype.initialize.call(this, benchmark);
+        Stage.prototype.initialize.call(this, benchmark, options);
         this.context = this.element.getContext("2d");
 
         // Define a collection for your objects.
index 6c077fa..430f415 100644 (file)
@@ -6,9 +6,9 @@ TemplateCssStage = Utilities.createSubclass(Stage,
         Stage.call(this);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        Stage.prototype.initialize.call(this, benchmark);
+        Stage.prototype.initialize.call(this, benchmark, options);
 
         // Do initialization here.
     },
index 7fdadbb..23762c3 100644 (file)
@@ -6,9 +6,9 @@ TemplateSvgStage = Utilities.createSubclass(Stage,
         Stage.call(this);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        Stage.prototype.initialize.call(this, benchmark);
+        Stage.prototype.initialize.call(this, benchmark, options);
 
         // Do initialization here.
     },
index 27d0141..7f0f1c0 100644 (file)
@@ -6,9 +6,9 @@ LayeringTextStage = Utilities.createSubclass(Stage,
         Stage.call(this);
     }, {
 
-    initialize: function(benchmark)
+    initialize: function(benchmark, options)
     {
-        Stage.prototype.initialize.call(this, benchmark);
+        Stage.prototype.initialize.call(this, benchmark, options);
         this._textElementParent = this.element;
         this._textElements = [];
         this._textItemIndex = 0;
index ec01957..fef8a52 100644 (file)
@@ -1,5 +1,39 @@
 2016-02-07  Jon Lee  <jonlee@apple.com>
 
+        Get rid of options member variable in Benchmark.
+
+        Options are only needed when initializing the stage or benchmark, so there's no
+        need to also keep a reference to it.
+
+        * Animometer/tests/resources/main.js: Get rid of options variable in Benchmark.
+        Pass options to Controllers and Stages.
+        (Controller.Utilities.createClass):
+        (Benchmark.Utilities.createClass):
+        (get options): Deleted.
+
+        * Animometer/tests/bouncing-particles/resources/bouncing-canvas-images.js:
+        * Animometer/tests/bouncing-particles/resources/bouncing-canvas-particles.js:
+        * Animometer/tests/bouncing-particles/resources/bouncing-canvas-shapes.js:
+        * Animometer/tests/bouncing-particles/resources/bouncing-css-images.js:
+        * Animometer/tests/bouncing-particles/resources/bouncing-css-shapes.js:
+        * Animometer/tests/bouncing-particles/resources/bouncing-particles.js:
+        * Animometer/tests/bouncing-particles/resources/bouncing-svg-images.js:
+        * Animometer/tests/bouncing-particles/resources/bouncing-svg-shapes.js:
+        * Animometer/tests/master/resources/canvas-stage.js:
+        * Animometer/tests/master/resources/canvas-tests.js:
+        * Animometer/tests/master/resources/particles.js:
+        * Animometer/tests/misc/resources/canvas-electrons.js:
+        * Animometer/tests/misc/resources/canvas-stars.js:
+        * Animometer/tests/misc/resources/compositing-transforms.js:
+        * Animometer/tests/simple/resources/simple-canvas-paths.js:
+        * Animometer/tests/simple/resources/tiled-canvas-image.js:
+        * Animometer/tests/template/resources/template-canvas.js:
+        * Animometer/tests/template/resources/template-css.js:
+        * Animometer/tests/template/resources/template-svg.js:
+        * Animometer/tests/text/resources/layering-text.js:
+
+2016-02-07  Jon Lee  <jonlee@apple.com>
+
         Update how the benchmark is run
         https://bugs.webkit.org/show_bug.cgi?id=153960