mirror of
https://github.com/tc39/test262.git
synced 2025-05-04 06:50:32 +02:00
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
62 lines
1.8 KiB
JavaScript
62 lines
1.8 KiB
JavaScript
import Builder from '../Builder.js';
|
|
import * as assert from '../assert.js';
|
|
|
|
function escape(){}
|
|
noInline(escape);
|
|
|
|
for (let i = 0; i < 10; ++i) {
|
|
const max = 1024*2;
|
|
const memoryDescription = {initial: 0, maximum: max};
|
|
const growMemoryAmount = 256;
|
|
|
|
const builder = (new Builder())
|
|
.Type().End()
|
|
.Import()
|
|
.Function("imp", "func", {params: [], ret: "void"})
|
|
.Memory("imp", "memory", memoryDescription)
|
|
.End()
|
|
.Function().End()
|
|
.Export()
|
|
.Function("foo")
|
|
.End()
|
|
.Code()
|
|
.Function("foo", {params: [], ret: "i32"})
|
|
.I32Const(1)
|
|
.I32Const(1)
|
|
.I32Const(1)
|
|
.I32Const(1)
|
|
.I32Const(1)
|
|
.I32Const(1)
|
|
.I32Const(1)
|
|
.I32Const(1)
|
|
.I32Const(1)
|
|
.I32Const(1)
|
|
.I32Const(1)
|
|
.I32Const(1)
|
|
.I32Const(1)
|
|
.I32Const(1)
|
|
.I32Const(1)
|
|
.I32Const(1)
|
|
.Call(2)
|
|
.I32Const(growMemoryAmount)
|
|
.GrowMemory(0)
|
|
.Return()
|
|
.End()
|
|
.Function("bar", {params: ["i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32", "i32"], ret: "void"})
|
|
.Call(0)
|
|
.Return()
|
|
.End()
|
|
.End();
|
|
|
|
const bin = builder.WebAssembly().get();
|
|
const module = new WebAssembly.Module(bin);
|
|
const memory = new WebAssembly.Memory(memoryDescription);
|
|
|
|
function func() { }
|
|
|
|
const instance = new WebAssembly.Instance(module, {imp: {memory, func}});
|
|
for (let i = 0; i < max/growMemoryAmount; ++i) {
|
|
instance.exports.foo();
|
|
}
|
|
}
|