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

Unified Diff: test/mjsunit/d8-performance-now.js

Issue 133523003: Revert "Temporarily disable performance.now() in the d8 shell." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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 | « src/d8.cc ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/d8-performance-now.js
diff --git a/test/mjsunit/regress/regress-grow-store-smi-check.js b/test/mjsunit/d8-performance-now.js
similarity index 63%
copy from test/mjsunit/regress/regress-grow-store-smi-check.js
copy to test/mjsunit/d8-performance-now.js
index 381141d52317c22cf19547a3626280fa2cb1ba9b..13eb1d3f006fa9405873d7e191d733bc4ac37b02 100644
--- a/test/mjsunit/regress/regress-grow-store-smi-check.js
+++ b/test/mjsunit/d8-performance-now.js
@@ -27,27 +27,36 @@
// Flags: --allow-natives-syntax
-// The below test function was generated from part of a WebKit layout
-// test library setup routine: fast/canvas/webgl/resources/pnglib.js
+// Test the performance.now() function of d8. This test only makes sense with
+// d8.
-function test(crc32) {
- for (var i = 0; i < 256; i++) {
- var c = i;
- for (var j = 0; j < 8; j++) {
- if (c & 1) {
- c = -306674912 ^ ((c >> 1) & 0x7fffffff);
+// Don't run this test in gc stress mode. Time differences may be long
+// due to garbage collections.
+%SetFlags("--gc-interval=-1");
+%SetFlags("--nostress-compaction");
+
+if (this.performance && performance.now) {
+ (function run() {
+ var start_test = performance.now();
+ // Let the retry run for maximum 100ms to reduce flakiness.
+ for (var start = performance.now();
+ start - start_test < 100;
+ start = performance.now()) {
+ var end = performance.now();
+ assertTrue(start >= start_test);
+ assertTrue(end >= start);
+ while (end - start == 0) {
+ var next = performance.now();
+ assertTrue(next >= end);
+ end = next;
+ }
+ if (end - start <= 1) {
+ // Found (sub-)millisecond granularity.
+ return;
} else {
- c = (c >> 1) & 0x7fffffff;
+ print("Timer difference too big: " + (end - start) + "ms");
}
}
- crc32[i] = c;
- }
+ assertTrue(false);
+ })()
}
-
-var a = [0.5];
-for (var i = 0; i < 256; ++i) a[i] = i;
-
-test([0.5]);
-test(a);
-%OptimizeFunctionOnNextCall(test);
-test(a);
« no previous file with comments | « src/d8.cc ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698