tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bug1913445.js (4155B)


      1 // |jit-test| skip-if: !('Function' in WebAssembly)
      2 
      3 // Tests constants pools in the tail call trampoline
      4 
      5 const fun1 = new WebAssembly.Function({ parameters: [], results: [] }, () => { });
      6 const isFun1 = function (f) { return f == fun1; }
      7 const ext1 = {};
      8 const isExt1 = function (e) { return e == ext1; }
      9 
     10 const imp = { gc, fun1, ext1, isFun1, isExt1, };
     11 
     12 function main() {
     13    const a0 = ext1; const a1 = ext1; const a2 = 1.2; const a3 = ext1; const a4 = 1; const a5 = 1; const a6 = 1; const a7 = ext1; const a8 = 1.2; const a9 = 1.2; const a10 = 1.125; const a11 = fun1; const a12 = fun1; const a13 = 1; const a14 = 1; const a15 = 1; const a16 = 1; const a17 = 1; const a18 = 1; const a19 = 1; const a20 = 1; const a21 = 1; const a22 = 1; const a23 = 1; const a24 = 1; const a25 = 1; const a26 = 1; const a27 = 1; const a28 = fun1; const a29 = 1; const a30 = 1;
     14    ins2.exports.f0(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30);
     15 }
     16 
     17 const ins4 = wasmEvalText(`(module
     18    (func $f2 (export "f2"))
     19 )`);
     20 
     21 const ins3 = wasmEvalText(`(module
     22    (import "x" "f2" (func $f2 ))
     23 
     24    (func $f1 (export "f1")
     25      return_call $f2
     26    )
     27 )`, {x: {
     28    "f2": ins4.exports.f2,
     29  }});
     30 
     31 const ins2 = wasmEvalText(`(module
     32  (import "" "fun1" (global $fun1 funcref))
     33  (import "" "isFun1" (func $isFun1 (param funcref) (result i32)))
     34  (import "" "ext1" (global $ext1 externref))
     35  (import "" "isExt1" (func $isExt1 (param externref) (result i32)))
     36    (import "x" "f1" (func $f1))
     37 
     38    (func $f0 (export "f0") (param externref externref f64 externref i32 i32 i32 externref f64 f64 f32 funcref funcref i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 funcref i32 i32) (result )
     39      local.get 0
     40 block (param externref)
     41 call $isExt1
     42 br_if 0
     43 unreachable
     44 end
     45 local.get 1
     46 block (param externref)
     47 call $isExt1
     48 br_if 0
     49 unreachable
     50 end
     51 local.get 2
     52 block (param f64)
     53 f64.const 1.2
     54 f64.eq
     55 br_if 0
     56 unreachable
     57 end
     58 local.get 3
     59 block (param externref)
     60 call $isExt1
     61 br_if 0
     62 unreachable
     63 end
     64 local.get 4
     65 block (param i32)
     66 i32.const 1
     67 i32.eq
     68 br_if 0
     69 unreachable
     70 end
     71 local.get 5
     72 block (param i32)
     73 i32.const 1
     74 i32.eq
     75 br_if 0
     76 unreachable
     77 end
     78 local.get 6
     79 block (param i32)
     80 i32.const 1
     81 i32.eq
     82 br_if 0
     83 unreachable
     84 end
     85 local.get 7
     86 block (param externref)
     87 call $isExt1
     88 br_if 0
     89 unreachable
     90 end
     91 local.get 8
     92 block (param f64)
     93 f64.const 1.2
     94 f64.eq
     95 br_if 0
     96 unreachable
     97 end
     98 local.get 9
     99 block (param f64)
    100 f64.const 1.2
    101 f64.eq
    102 br_if 0
    103 unreachable
    104 end
    105 local.get 10
    106 block (param f32)
    107 f32.const 1.125
    108 f32.eq
    109 br_if 0
    110 unreachable
    111 end
    112 local.get 11
    113 block (param funcref)
    114 call $isFun1
    115 br_if 0
    116 unreachable
    117 end
    118 local.get 12
    119 block (param funcref)
    120 call $isFun1
    121 br_if 0
    122 unreachable
    123 end
    124 local.get 13
    125 block (param i32)
    126 i32.const 1
    127 i32.eq
    128 br_if 0
    129 unreachable
    130 end
    131 local.get 14
    132 block (param i32)
    133 i32.const 1
    134 i32.eq
    135 br_if 0
    136 unreachable
    137 end
    138 local.get 15
    139 block (param i32)
    140 i32.const 1
    141 i32.eq
    142 br_if 0
    143 unreachable
    144 end
    145 local.get 16
    146 block (param i32)
    147 i32.const 1
    148 i32.eq
    149 br_if 0
    150 unreachable
    151 end
    152 local.get 17
    153 block (param i32)
    154 i32.const 1
    155 i32.eq
    156 br_if 0
    157 unreachable
    158 end
    159 local.get 18
    160 block (param i32)
    161 i32.const 1
    162 i32.eq
    163 br_if 0
    164 unreachable
    165 end
    166 local.get 19
    167 block (param i32)
    168 i32.const 1
    169 i32.eq
    170 br_if 0
    171 unreachable
    172 end
    173 local.get 20
    174 block (param i32)
    175 i32.const 1
    176 i32.eq
    177 br_if 0
    178 unreachable
    179 end
    180 local.get 21
    181 block (param i32)
    182 i32.const 1
    183 i32.eq
    184 br_if 0
    185 unreachable
    186 end
    187 local.get 22
    188 block (param i32)
    189 i32.const 1
    190 i32.eq
    191 br_if 0
    192 unreachable
    193 end
    194 local.get 23
    195 block (param i32)
    196 i32.const 1
    197 i32.eq
    198 br_if 0
    199 unreachable
    200 end
    201 local.get 24
    202 block (param i32)
    203 i32.const 1
    204 i32.eq
    205 br_if 0
    206 unreachable
    207 end
    208 local.get 25
    209 block (param i32)
    210 i32.const 1
    211 i32.eq
    212 br_if 0
    213 unreachable
    214 end
    215 local.get 26
    216 block (param i32)
    217 i32.const 1
    218 i32.eq
    219 br_if 0
    220 unreachable
    221 end
    222 local.get 27
    223 block (param i32)
    224 i32.const 1
    225 i32.eq
    226 br_if 0
    227 unreachable
    228 end
    229 local.get 28
    230 block (param funcref)
    231 call $isFun1
    232 br_if 0
    233 unreachable
    234 end
    235 local.get 29
    236 block (param i32)
    237 i32.const 1
    238 i32.eq
    239 br_if 0
    240 unreachable
    241 end
    242 local.get 30
    243 block (param i32)
    244 i32.const 1
    245 i32.eq
    246 br_if 0
    247 unreachable
    248 end
    249 
    250    return_call $f1
    251    )
    252 
    253 )`, {"":imp, x: {
    254  "f1": ins3.exports.f1,
    255 }});
    256 
    257 main()