summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/ref-types/externref-global-prebarrier.js
blob: 139f71e758664954a944ea98129d7bec2cee4b1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Do not run the test if we're jit-compiling JS, since it's the wasm frames
// we're interested in and eager JS compilation can upset the test.

opts = getJitCompilerOptions();
if (opts['ion.enable'] || opts['baseline.enable'])
  quit();

const { startProfiling, endProfiling, assertEqPreciseStacks, isSingleStepProfilingEnabled } = WasmHelpers;

let e = wasmEvalText(`(module
    (global $g (mut externref) (ref.null extern))
    (func (export "set") (param externref) local.get 0 global.set $g)
)`).exports;

let obj = { field: null };

// GCZeal mode 4 implies that prebarriers are being verified at many
// locations in the interpreter, during interrupt checks, etc. It can be ultra
// slow, so disable it with gczeal(0) when it's not strictly needed.
gczeal(4, 1);
e.set(obj);
e.set(null);
gczeal(0);

if (!isSingleStepProfilingEnabled) {
    quit(0);
}

enableGeckoProfiling();
startProfiling();
gczeal(4, 1);
e.set(obj);
gczeal(0);
assertEqPreciseStacks(
    endProfiling(),
    [
        // Expected output for (simulator+via-Ion/baseline).
        ['', '!>', '0,!>', '<,0,!>', 'GC postbarrier,0,!>',
         '<,0,!>', '0,!>', '!>', ''],

        // Expected output for other configurations.
        ['', '!>', '0,!>', '!>', ''],
    ]);

startProfiling();
gczeal(4, 1);
e.set(null);
gczeal(0);

// We're losing stack info in the prebarrier code.
assertEqPreciseStacks(
    endProfiling(),
    [
        // Expected output for (simulator+via-Ion/baseline).
        ['', '!>', '0,!>', '', '0,!>', '<,0,!>', 'GC postbarrier,0,!>',
         '<,0,!>', '0,!>', '!>', ''],

        // Expected output for other configurations.
        ['', '!>', '0,!>', '', '0,!>', '!>', ''],
    ]);