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

Side by Side Diff: benchmarks/spinning-balls/v.js

Issue 8228004: Remove some unused and unneeded flags. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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 | « no previous file | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 24 matching lines...) Expand all
35 return window.webkitRequestAnimationFrame || 35 return window.webkitRequestAnimationFrame ||
36 window.mozRequestAnimationFrame || 36 window.mozRequestAnimationFrame ||
37 window.oRequestAnimationFrame || 37 window.oRequestAnimationFrame ||
38 window.msRequestAnimationFrame || 38 window.msRequestAnimationFrame ||
39 function(callback, element) { 39 function(callback, element) {
40 window.setTimeout( callback, 1000 / 60 ); 40 window.setTimeout( callback, 1000 / 60 );
41 }; 41 };
42 } )(); 42 } )();
43 } 43 }
44 44
45
46
47
45 var kNPoints = 8000; 48 var kNPoints = 8000;
46 var kNModifications = 20; 49 var kNModifications = 20;
47 var kNVisiblePoints = 200; 50 var kNVisiblePoints = 200;
48 var kDecaySpeed = 20; 51 var kDecaySpeed = 20;
49 52
50 var kPointRadius = 4; 53 var kPointRadius = 4;
51 var kInitialLifeForce = 100; 54 var kInitialLifeForce = 100;
52 55
53 var livePoints = void 0; 56 var livePoints = void 0;
54 var dyingPoints = void 0; 57 var dyingPoints = void 0;
55 var scene = void 0; 58 var scene = void 0;
56 var renderingStartTime = void 0; 59 var renderingStartTime = void 0;
60 var omitFrameDueToVisibilityChange = false;
57 var scene = void 0; 61 var scene = void 0;
58 var pausePlot = void 0; 62 var pausePlot = void 0;
59 var splayTree = void 0; 63 var splayTree = void 0;
60 64
65 handleVisibilityChange();
66
67 function handleVisibilityChange() {
68 console.log("visibility change");
69 omitFrameDueToVisibilityChange = true;
70 document.addEventListener("webkitvisibilitychange", handleVisibilityChange);
71 document.addEventListener("msvisibilitychange", handleVisibilityChange);
72 document.addEventListener("mozvisibilitychange", handleVisibilityChange);
73 document.addEventListener("visibilitychange", handleVisibilityChange);
74 }
75
61 76
62 function Point(x, y, z, payload) { 77 function Point(x, y, z, payload) {
63 this.x = x; 78 this.x = x;
64 this.y = y; 79 this.y = y;
65 this.z = z; 80 this.z = z;
66 81
67 this.next = null; 82 this.next = null;
68 this.prev = null; 83 this.prev = null;
69 this.payload = payload; 84 this.payload = payload;
70 this.lifeForce = kInitialLifeForce; 85 this.lifeForce = kInitialLifeForce;
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 function render() { 361 function render() {
347 if (typeof renderingStartTime === 'undefined') { 362 if (typeof renderingStartTime === 'undefined') {
348 renderingStartTime = Date.now(); 363 renderingStartTime = Date.now();
349 } 364 }
350 365
351 ModifyPointsSet(); 366 ModifyPointsSet();
352 367
353 scene.draw(); 368 scene.draw();
354 369
355 var renderingEndTime = Date.now(); 370 var renderingEndTime = Date.now();
356 var pause = renderingEndTime - renderingStartTime; 371 if (!omitFrameDueToVisibilityChange) {
357 pausePlot.addPause(pause); 372 var pause = renderingEndTime - renderingStartTime;
373 pausePlot.addPause(pause);
374 }
358 renderingStartTime = renderingEndTime; 375 renderingStartTime = renderingEndTime;
376 omitFrameDueToVisibilityChange = false;
359 377
360 pausePlot.draw(); 378 pausePlot.draw();
361 379
362 div.innerHTML = 380 div.innerHTML =
363 livePoints.count + "/" + dyingPoints.count + " " + 381 livePoints.count + "/" + dyingPoints.count + " " +
364 pause + "(max = " + pausePlot.maxPause + ") ms" ; 382 pause + "(max = " + pausePlot.maxPause + ") ms" ;
365 383
366 // Schedule next frame. 384 // Schedule next frame.
367 requestAnimationFrame(render); 385 requestAnimationFrame(render);
368 } 386 }
369 387
370 388
371 function init() { 389 function init() {
372 livePoints = new PointsList; 390 livePoints = new PointsList;
373 dyingPoints = new PointsList; 391 dyingPoints = new PointsList;
374 392
375 splayTree = new SplayTree(); 393 splayTree = new SplayTree();
376 394
377 scene = new Scene(640, 480); 395 scene = new Scene(640, 480);
378 396
379 div = document.createElement("div"); 397 div = document.createElement("div");
380 document.body.appendChild(div); 398 document.body.appendChild(div);
381 399
382 pausePlot = new PausePlot(480, 240, 160); 400 pausePlot = new PausePlot(480, 240, 160);
383 } 401 }
384 402
385 403
386 init(); 404 init();
387 render(); 405 render();
OLDNEW
« no previous file with comments | « no previous file | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698