verify-function-simple.js 853 Bytes
Newer Older
1 2 3 4
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5 6
// Flags: --expose-wasm

7 8 9 10
load("test/mjsunit/wasm/wasm-constants.js");

try {
  var data = bytes(
11 12 13
      kWasmFunctionTypeForm, 0, kAstStmt,  // signature
      kDeclNoLocals,                       // --
      kExprNop                             // body
14 15
  );

16
  Wasm.verifyFunction(data);
17 18 19 20 21 22 23 24 25
  print("ok");
} catch (e) {
  assertTrue(false);
}


var threw = false;
try {
  var data = bytes(
26 27
      kWasmFunctionTypeForm, 0, 1, kAstI32,     // signature
      kDeclNoLocals,                            // --
28
      kExprBlock, kExprNop, kExprNop, kExprEnd  // body
29 30
  );

31
  Wasm.verifyFunction(data);
32 33 34 35 36 37 38
  print("not ok");
} catch (e) {
  print("ok: " + e);
  threw = true;
}

assertTrue(threw);