Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: test/mjsunit/wasm/compiled-module-management.js

Issue 2305903002: [wasm] reuse the first compiled module (Closed)
Patch Set: use HeapNumber for storing mem size Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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: --no-ignition --no-ignition-staging --expose-wasm --expose-gc --allow- natives-syntax
bradnelson 2016/09/02 16:57:00 You can split these into two Flags: to stay under
Mircea Trofin 2016/09/02 20:55:30 Done.
6
7 load("test/mjsunit/wasm/wasm-constants.js");
8 load("test/mjsunit/wasm/wasm-module-builder.js");
9
10
11 (function CompiledModuleInstancesAreGCed() {
12 var builder = new WasmModuleBuilder();
13
14 builder.addMemory(1,1, true);
15 builder.addImport("getValue", kSig_i);
16 builder.addFunction("f", kSig_i)
17 .addBody([
18 kExprCallImport, kArity0, 0
19 ]).exportFunc();
20
21 var module = new WebAssembly.Module(builder.toBuffer());
22 %ValidateWasmModuleState(module);
23 %ValidateWasmInstancesChain(module, 0);
24 var i1 = new WebAssembly.Instance(module, {getValue: () => 1});
25 %ValidateWasmInstancesChain(module, 1);
26 var i2 = new WebAssembly.Instance(module, {getValue: () => 2});
27 %ValidateWasmInstancesChain(module, 2);
28 var i3 = new WebAssembly.Instance(module, {getValue: () => 3});
29 %ValidateWasmInstancesChain(module, 3);
30
31 assertEquals(1, i1.exports.f());
32 i1 = null;
33 gc();
34 %ValidateWasmInstancesChain(module, 2);
35 assertEquals(3, i3.exports.f());
36 i3 = null;
37 gc();
38 %ValidateWasmInstancesChain(module, 1);
39 assertEquals(2, i2.exports.f());
40 i2 = null;
41 gc();
42 %ValidateWasmModuleState(module);
43 var i4 = new WebAssembly.Instance(module, {getValue: () => 4});
44 assertEquals(4, i4.exports.f());
45 module = null;
46 gc();
47 %ValidateWasmOrphanedInstance(i4);
48 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698