summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/regexp/bug-1841771.js
blob: ae13aa86f5c585a7314abc3f2c416ad8a34dfbbd (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
var lfLogBuffer = `
let hasFunction ;
for (const name of [, "" ]) 
  g55 = newGlobal();
gcparam('maxBytes', gcparam('gcBytes') );
//corefuzz-dcd-endofdata
/*
//corefuzz-dcd-endofdata
/**/



let hasFunction ;
for (const name of [ "", "", "", ""]) {





    const present = name in this;
    if (!present) 
        thisname = function() {};
}
//corefuzz-dcd-endofdata
//corefuzz-dcd-selectmode 1089924061
//corefuzz-dcd-endofdata
oomTest(function() {
  let m14 = parseModule('a'.replace(/a/, assertEq.toString));
});
`;
lfLogBuffer = lfLogBuffer.split('\n');
let lfPreamble = `
  Object.defineProperty(this, "fuzzutils", {
    value:{
        untemplate: function(s) {
          return s.replace(/\\\\/g, '\\\\\\\\').replace(/\`/g, '\\\\\`').replace(/\\\$/g, '\\\\\$'); 
        }
    }
  });
function lfFixRedeclaration(lfSrc, lfExc, lfRewriteSet) {
    let varName;
    let srcParts = lfSrc.split("\\n");
    let regReplace = new RegExp;
    for (let lfIdx = 0; lfIdx < srcParts.length; ++lfIdx)
      srcParts[lfExc.lineNumber - 1] = srcParts[lfExc.lineNumber - 1].replace(regReplace, varName);
    return srcParts.join();
}
`;
evaluate(lfPreamble);
let lfRunTypeId = -1;
let lfCodeBuffer = "";
while (true) {
    let line = lfLogBuffer.shift();
    if (line == null) break;
    else if (line == "//corefuzz-dcd-endofdata") {
        loadFile(lfCodeBuffer);
        lfCodeBuffer = "";
    } else lfCodeBuffer += line + "\n";
}
loadFile(lfCodeBuffer);
function loadFile(lfVarx, lfForceRunType = 0, lfPatchSets = []) {
    try {
        if (lfVarx.indexOf("//corefuzz-dcd-selectmode ") === 0) {
            if (lfGCStress);
        } else {
                evaluate(lfVarx);
        }
    } catch (lfVare) {
        if (lfVare.toString.indexOf0 >= 0);
        else if (lfVare.toString().indexOf("redeclaration of ") >= 0) {
            let lfNewSrc = lfFixRedeclaration(lfVarx, lfVare, lfPatchSets);
            loadFile(lfNewSrc, lfRunTypeId, lfPatchSets);
        }
        lfVarx = fuzzutils.untemplate(lfVarx);
    }
}