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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/wasm/wasm-limits-tests-common.js

Issue 2702953002: [wasm] Block compile/instantiate of large array buffers (Closed)
Patch Set: Updated after V8 side landed Created 3 years, 10 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 2017 The Chromium 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 function createTestBuffers(limit) {
6 let builder = new WasmModuleBuilder();
7 let body = [];
8 var fct = builder.addFunction("f", kSig_v_v);
9
10 var l = builder.toBuffer().byteLength;
11
12 // in the bare bones buffer, the size of the function f
13 // is 0, which is encoded in 1 byte. For the 2^12 case,
14 // we need 2 bytes. Then, the function ends in kExprEnd,
15 // so we need that accounted, too.
16 var remaining = limit - l - 3;
17
18 for (var i = 0; i < remaining; ++i) body.push(kExprNop);
19 fct.addBody(body);
20
21 var small_buffer = builder.toBuffer();
22 // body is now 1 larger than before, because it has the kExpEnd at the end.
23 // replace that with kExprNop, and generate a new buffer.
24 body[body.length-1] = kExprNop;
25 fct.addBody(body);
26 var large_buffer = builder.toBuffer();
27 return {small: small_buffer, large: large_buffer};
28 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698