blob: 2e649a0bd28b7c9e449b444968355eca7d8fd79a [file] [log] [blame]
Ben Murdochf2e39942016-05-18 10:25:55 +00001// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Flags: --expose-wasm
6
7load("test/mjsunit/wasm/wasm-constants.js");
Ben Murdoch3b9bc312016-06-02 14:46:10 +01008load("test/mjsunit/wasm/wasm-module-builder.js");
Ben Murdochf2e39942016-05-18 10:25:55 +00009
Ben Murdoch3b9bc312016-06-02 14:46:10 +010010(function BasicTest() {
11 var kReturnValue = 107;
12 var builder = new WasmModuleBuilder();
Ben Murdochf2e39942016-05-18 10:25:55 +000013
Ben Murdoch3b9bc312016-06-02 14:46:10 +010014 builder.addFunction("main", [kAstI32])
15 .addBody([kExprI8Const, kReturnValue])
16 .exportFunc();
Ben Murdochf2e39942016-05-18 10:25:55 +000017
Ben Murdoch3b9bc312016-06-02 14:46:10 +010018 var main = builder.instantiate().exports.main;
19 assertEquals(kReturnValue, main());
20})();