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

Side by Side Diff: test/mjsunit/wasm/asm-wasm.js

Issue 1697423003: Support blocks in asm->wasm global section. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: merge Created 4 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
« no previous file with comments | « src/wasm/asm-wasm-builder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 function EmptyTest() { 7 function EmptyTest() {
8 "use asm"; 8 "use asm";
9 function caller() { 9 function caller() {
10 empty(); 10 empty();
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 m.storeb(22, 77); 1215 m.storeb(22, 77);
1216 assertEquals(123, m.load(20)); 1216 assertEquals(123, m.load(20));
1217 assertEquals(42, m.load(21)); 1217 assertEquals(42, m.load(21));
1218 assertEquals(77, m.load(22)); 1218 assertEquals(77, m.load(22));
1219 assertEquals(123, m.iload(0)); 1219 assertEquals(123, m.iload(0));
1220 assertEquals(42, m.iload(4)); 1220 assertEquals(42, m.iload(4));
1221 assertEquals(77, m.iload(8)); 1221 assertEquals(77, m.iload(8));
1222 })(); 1222 })();
1223 1223
1224 1224
1225 (function TestGlobalBlock() {
1226 function Module(stdlib, foreign, buffer) {
1227 "use asm";
1228
1229 var x = foreign.x | 0, y = foreign.y | 0;
1230
1231 function test() {
1232 return (x + y) | 0;
1233 }
1234
1235 return {test: test};
1236 }
1237
1238 var m = _WASMEXP_.instantiateModuleFromAsm(
1239 Module.toString(), { x: 4, y: 11 });
1240 m.__init__();
1241 assertEquals(15, m.test());
1242 })();
1243
1244
1225 (function TestComma() { 1245 (function TestComma() {
1226 function CommaModule() { 1246 function CommaModule() {
1227 "use asm"; 1247 "use asm";
1228 1248
1229 function ifunc(a, b) { 1249 function ifunc(a, b) {
1230 a = +a; 1250 a = +a;
1231 b = b | 0; 1251 b = b | 0;
1232 return (a, b) | 0; 1252 return (a, b) | 0;
1233 } 1253 }
1234 1254
1235 function dfunc(a, b) { 1255 function dfunc(a, b) {
1236 a = a | 0; 1256 a = a | 0;
1237 b = +b; 1257 b = +b;
1238 return +(a, b); 1258 return +(a, b);
1239 } 1259 }
1240 1260
1241 return {ifunc: ifunc, dfunc: dfunc}; 1261 return {ifunc: ifunc, dfunc: dfunc};
1242 } 1262 }
1243 1263
1244 var m = _WASMEXP_.instantiateModuleFromAsm(CommaModule.toString()); 1264 var m = _WASMEXP_.instantiateModuleFromAsm(CommaModule.toString());
1245 assertEquals(123, m.ifunc(456.7, 123)); 1265 assertEquals(123, m.ifunc(456.7, 123));
1246 assertEquals(123.4, m.dfunc(456, 123.4)); 1266 assertEquals(123.4, m.dfunc(456, 123.4));
1247 })(); 1267 })();
OLDNEW
« no previous file with comments | « src/wasm/asm-wasm-builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698