tor-browser

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

bug-1879096.js (2463B)


      1 // |jit-test| test-also=--setpref=wasm_test_serialization
      2 
      3 // Conditional branch instructions need to rewrite their stack types according
      4 // to the destination label types. This loses information but is mandated by
      5 // the spec.
      6 
      7 // br_if
      8 wasmFailValidateText(`(module
      9  (func (result anyref)
     10    ref.null array      ;; stack: [arrayref]
     11    ref.null struct     ;; stack: [arrayref structref]
     12    i32.const 0         ;; stack: [arrayref structref i32]
     13    br_if 0             ;; stack: [arrayref anyref]
     14    ref.eq              ;; should fail (anyref is not eq)
     15    unreachable
     16  )
     17 )`, /type mismatch: expression has type anyref but expected eqref/);
     18 
     19 // br_on_null
     20 wasmFailValidateText(`(module
     21  (func (param externref) (result anyref)
     22    ref.null array      ;; stack: [arrayref]
     23    local.get 0         ;; stack: [arrayref externref]
     24    br_on_null 0        ;; stack: [anyref (ref extern)]
     25    drop                ;; stack: [anyref]
     26    array.len           ;; should fail
     27    unreachable
     28  )
     29 )`, /type mismatch: expression has type anyref but expected arrayref/);
     30 
     31 // br_on_non_null
     32 wasmFailValidateText(`(module
     33  (func (param externref) (result anyref (ref extern))
     34    ref.null array      ;; stack: [arrayref]
     35    ref.null struct     ;; stack: [arrayref structref]
     36    local.get 0         ;; stack: [arrayref structref externref]
     37    br_on_non_null 0    ;; stack: [arrayref anyref]
     38    ref.eq              ;; should fail (anyref is not eq)
     39    unreachable
     40  )
     41 )`, /type mismatch: expression has type anyref but expected eqref/);
     42 
     43 // br_on_cast
     44 wasmFailValidateText(`(module
     45  (type $s (struct))
     46  (func (result anyref (ref $s))
     47    ref.null array                    ;; stack: [arrayref]
     48    ref.null struct                   ;; stack: [arrayref structref]
     49    br_on_cast 0 structref (ref $s)   ;; stack: [anyref structref]
     50    ref.eq                            ;; should fail (anyref is not eq)
     51    unreachable
     52  )
     53 )`, /type mismatch: expression has type anyref but expected eqref/);
     54 
     55 // br_on_cast_fail
     56 wasmFailValidateText(`(module
     57  (type $s (struct))
     58  (func (result anyref anyref)
     59    ref.null array                        ;; stack: [arrayref]
     60    ref.null struct                       ;; stack: [arrayref structref]
     61    br_on_cast_fail 0 structref (ref $s)  ;; stack: [anyref (ref $s)]
     62    ref.eq                                ;; should fail (anyref is not eq)
     63    unreachable
     64  )
     65 )`, /type mismatch: expression has type anyref but expected eqref/);