Debian Codegraph @

js/src/devtools/gc-ubench/v8.js

raw
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 // V8 JS shell benchmark script
6 //
7 // Usage: run d8 v8.js -- --help
8
9 globalThis.loadRelativeToScript = load;
10
11 load("shell-bench.js");
12
13 var V8 = class extends Host {
14 constructor() {
15 super();
16 this.waitTA = new Int32Array(new SharedArrayBuffer(4));
17 }
18
19 start_turn() {}
20
21 end_turn() {}
22
23 suspend(duration) {
24 const response = Atomics.wait(this.waitTA, 0, 0, duration * 1000);
25 if (response !== 'timed-out') {
26 throw new Exception(`unexpected response from Atomics.wait: ${response}`);
27 }
28 }
29
30 features = {
31 haveMemorySizes: false,
32 haveGCCounts: false
33 };
34 };
35
36 var gHost = new V8();
37
38 var { opts, rest: mutators } = argparse.parse_args(arguments);
39 run(opts, mutators);
40
41 print("\nTest results:\n");
42 report_results();