Bug 1633625 - Add a V8 shell runner r=jonco
authorSteve Fink <sfink@mozilla.com>
Tue, 19 May 2020 21:55:44 +0000
changeset 530913 cc9e3394bf4f0b521f5912e07c48b62b62dc198f
parent 530912 16b7d6a72288ec59aa44b2cbff37abddbc25c116
child 530914 37f859f3252ef4b4432723e571961f1be3df59a5
push id37434
push userabutkovits@mozilla.com
push dateWed, 20 May 2020 10:05:10 +0000
treeherdermozilla-central@005ef1c25992 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1633625
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1633625 - Add a V8 shell runner r=jonco Differential Revision: https://phabricator.services.mozilla.com/D75361
js/src/devtools/gc-ubench/v8.js
copy from js/src/devtools/gc-ubench/spidermonkey.js
copy to js/src/devtools/gc-ubench/v8.js
--- a/js/src/devtools/gc-ubench/spidermonkey.js
+++ b/js/src/devtools/gc-ubench/v8.js
@@ -1,48 +1,37 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-// SpiderMonkey JS shell benchmark script
+// V8 JS shell benchmark script
 //
-// Usage: run $JS spidermonkey.js --help
+// Usage: run d8 v8.js -- --help
+
+globalThis.loadRelativeToScript = load;
 
-loadRelativeToScript("shell-bench.js");
+load("shell-bench.js");
 
-var SpiderMonkey = class extends Host {
+var V8 = class extends Host {
+  constructor() {
+    super();
+    this.waitTA = new Int32Array(new SharedArrayBuffer(4));
+  }
+
   start_turn() {}
 
-  end_turn() {
-    clearKeptObjects();
-    maybegc();
-    drainJobQueue();
-  }
+  end_turn() {}
 
   suspend(duration) {
-    sleep(duration);
-  }
-
-  get minorGCCount() {
-    return performance.mozMemory.gc.minorGCCount;
-  }
-  get majorGCCount() {
-    return performance.mozMemory.gc.majorGCCount;
-  }
-  get GCSliceCount() {
-    return performance.mozMemory.gc.sliceCount;
-  }
-  get gcBytes() {
-    return performance.mozMemory.gc.zone.gcBytes;
-  }
-  get gcAllocTrigger() {
-    return performance.mozMemory.gc.zone.gcAllocTrigger;
+    const response = Atomics.wait(this.waitTA, 0, 0, duration * 1000);
+    if (response !== 'timed-out') {
+      throw new Exception(`unexpected response from Atomics.wait: ${response}`);
+    }
   }
 
   features = {
-    haveMemorySizes: true,
-    haveGCCounts: true,
+    haveMemorySizes: false,
+    haveGCCounts: false
   };
 };
-var gHost = new SpiderMonkey();
 
-run(scriptArgs);
-print(`Waited total of ${waited} seconds`);
+var gHost = new V8();
+run(arguments);