summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/metadata-hook-regexp-result.js
blob: cad570db7871a7c05bdadddb0f32f3b354254b4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var g = newGlobal({sameCompartmentAs: this});
g.evaluate(`enableShellAllocationMetadataBuilder()`);

function f() {
    // Ensure a match stub is created for the zone.
    var re = /abc.+/;
    for (var i = 0; i < 100; i++) {
        assertEq(re.exec("..abcd").index, 2);
    }
    // Allocated match result objects in the realm with the metadata hook
    // must have metadata.
    g.evaluate(`
    var re = /abc.+/;
    for (var i = 0; i < 100; i++) {
        var obj = re.exec("..abcd");
        assertEq(getAllocationMetadata(obj).stack.length > 0, true);
    }
    `)
}
f();