mirror of
https://github.com/nodejs/node.git
synced 2025-05-16 04:04:17 +00:00

PR-URL: https://github.com/nodejs/node/pull/28918 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
29 lines
697 B
JavaScript
29 lines
697 B
JavaScript
// Copyright 2019 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.
|
|
|
|
// Flags: --validate-asm --allow-natives-syntax
|
|
|
|
function Module(stdlib, ffi, buffer) {
|
|
"use asm";
|
|
var MEM8 = new stdlib.Uint8Array(buffer);
|
|
function foo() { return MEM8[0] | 0; }
|
|
return { foo: foo };
|
|
}
|
|
|
|
|
|
function RunOnce() {
|
|
let buffer = new ArrayBuffer(4096);
|
|
let ffi = {};
|
|
let stdlib = {Uint8Array: Uint8Array};
|
|
let module = Module(stdlib, ffi, buffer);
|
|
assertTrue(%IsAsmWasmCode(Module));
|
|
assertEquals(0, module.foo());
|
|
}
|
|
|
|
(function RunTest() {
|
|
for (let i = 0; i < 3000; i++) {
|
|
RunOnce();
|
|
}
|
|
})();
|