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

Side by Side Diff: test/mjsunit/wasm/receiver.js

Issue 2345593003: [wasm] Master CL for Binary 0xC changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test failures and TSAN races. Created 4 years, 2 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
« no previous file with comments | « test/mjsunit/wasm/parallel_compilation.js ('k') | test/mjsunit/wasm/stack.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 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 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 load("test/mjsunit/wasm/wasm-module-builder.js"); 8 load("test/mjsunit/wasm/wasm-module-builder.js");
9 9
10 function testCallImport(func, expected, a, b) { 10 function testCallImport(func, expected, a, b) {
11 var builder = new WasmModuleBuilder(); 11 var builder = new WasmModuleBuilder();
12 12
13 var sig_index = builder.addType(kSig_i_dd); 13 var sig_index = builder.addType(kSig_i_dd);
14 builder.addImport("func", sig_index); 14 builder.addImport("func", sig_index);
15 builder.addFunction("main", sig_index) 15 builder.addFunction("main", sig_index)
16 .addBody([ 16 .addBody([
17 kExprGetLocal, 0, // -- 17 kExprGetLocal, 0, // --
18 kExprGetLocal, 1, // -- 18 kExprGetLocal, 1, // --
19 kExprCallImport, 2, 0]) // -- 19 kExprCallFunction, 0]) // --
20 .exportAs("main"); 20 .exportAs("main");
21 21
22 var main = builder.instantiate({func: func}).exports.main; 22 var main = builder.instantiate({func: func}).exports.main;
23 23
24 assertEquals(expected, main(a, b)); 24 assertEquals(expected, main(a, b));
25 } 25 }
26 26
27 var global = (function() { return this; })(); 27 var global = (function() { return this; })();
28 28
29 function sloppyReceiver(a, b) { 29 function sloppyReceiver(a, b) {
30 assertEquals(global, this); 30 assertEquals(global, this);
31 assertEquals(33.3, a); 31 assertEquals(33.3, a);
32 assertEquals(44.4, b); 32 assertEquals(44.4, b);
33 return 11; 33 return 11;
34 } 34 }
35 35
36 function strictReceiver(a, b) { 36 function strictReceiver(a, b) {
37 'use strict'; 37 'use strict';
38 assertEquals(undefined, this); 38 assertEquals(undefined, this);
39 assertEquals(55.5, a); 39 assertEquals(55.5, a);
40 assertEquals(66.6, b); 40 assertEquals(66.6, b);
41 return 22; 41 return 22;
42 } 42 }
43 43
44 testCallImport(sloppyReceiver, 11, 33.3, 44.4); 44 testCallImport(sloppyReceiver, 11, 33.3, 44.4);
45 testCallImport(strictReceiver, 22, 55.5, 66.6); 45 testCallImport(strictReceiver, 22, 55.5, 66.6);
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/parallel_compilation.js ('k') | test/mjsunit/wasm/stack.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698