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: test/mjsunit/wasm/ffi-error.js

Issue 1763433002: [wasm] Rework encoding of local declarations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --expose-wasm 5 // Flags: --expose-wasm
6 6
7 load("test/mjsunit/wasm/wasm-constants.js"); 7 load("test/mjsunit/wasm/wasm-constants.js");
8 8
9 function testCallFFI(ffi) { 9 function testCallFFI(ffi) {
10 var kBodySize = 6; 10 var kBodySize = 7;
11 var kNameAddOffset = kHeaderSize + 28 + kBodySize + 1; 11 var kNameAddOffset = kHeaderSize + 28 + kBodySize + 1;
12 var kNameMainOffset = kNameAddOffset + 4; 12 var kNameMainOffset = kNameAddOffset + 4;
13 13
14 var data = bytesWithHeader( 14 var data = bytesWithHeader(
15 kDeclMemory, 15 kDeclMemory,
16 12, 12, 1, // memory 16 12, 12, 1, // memory
17 // -- signatures 17 // -- signatures
18 kDeclSignatures, 1, 18 kDeclSignatures, 1,
19 2, kAstI32, kAstF64, kAstF64, // (f64,f64)->int 19 2, kAstI32, kAstF64, kAstF64, // (f64,f64)->int
20 // -- foreign function 20 // -- foreign function
21 kDeclFunctions, 2, 21 kDeclFunctions, 2,
22 kDeclFunctionName | kDeclFunctionImport, 22 kDeclFunctionName | kDeclFunctionImport,
23 0, 0, // signature index 23 0, 0, // signature index
24 kNameAddOffset, 0, 0, 0, // name offset 24 kNameAddOffset, 0, 0, 0, // name offset
25 // -- main function 25 // -- main function
26 kDeclFunctionName | kDeclFunctionExport, 26 kDeclFunctionName | kDeclFunctionExport,
27 0, 0, // signature index 27 0, 0, // signature index
28 kNameMainOffset, 0, 0, 0, // name offset 28 kNameMainOffset, 0, 0, 0, // name offset
29 kBodySize, 0, 29 kBodySize, 0,
30 // main body 30 // main body
31 kDeclNoLocals,
31 kExprCallFunction, 0, // -- 32 kExprCallFunction, 0, // --
32 kExprGetLocal, 0, // -- 33 kExprGetLocal, 0, // --
33 kExprGetLocal, 1, // -- 34 kExprGetLocal, 1, // --
34 // names 35 // names
35 kDeclEnd, 36 kDeclEnd,
36 'f', 'u', 'n', 0, // -- 37 'f', 'u', 'n', 0, // --
37 'm', 'a', 'i', 'n', 0 // -- 38 'm', 'a', 'i', 'n', 0 // --
38 ); 39 );
39 40
40 print("instantiate FFI"); 41 print("instantiate FFI");
(...skipping 29 matching lines...) Expand all
70 testCallFFI(ffi); 71 testCallFFI(ffi);
71 }); 72 });
72 73
73 74
74 // "fun" should be a JS function. 75 // "fun" should be a JS function.
75 assertThrows(function() { 76 assertThrows(function() {
76 var ffi = new Object(); 77 var ffi = new Object();
77 ffi.fun = 0; 78 ffi.fun = 0;
78 testCallFFI(ffi); 79 testCallFFI(ffi);
79 }); 80 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698