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

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

Issue 2757693003: [wasm][asm.js] Asm.js -> wasm custom parser. (Closed)
Patch Set: Created 3 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: --validate-asm --allow-natives-syntax 5 // Flags: --validate-asm --allow-natives-syntax
6 6
7 var stdlib = this; 7 var stdlib = this;
8 8
9 function assertValidAsm(func) { 9 function assertValidAsm(func) {
10 assertTrue(%IsAsmWasmCode(func)); 10 assertTrue(%IsAsmWasmCode(func));
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 assertEquals(f2, module.getf2()); 1140 assertEquals(f2, module.getf2());
1141 } 1141 }
1142 1142
1143 // Check normal operation. 1143 // Check normal operation.
1144 TestCase({foo: 123, bar: 234.5, baz: 345.7}, 123, 234.5, 345, 345.7); 1144 TestCase({foo: 123, bar: 234.5, baz: 345.7}, 123, 234.5, 345, 345.7);
1145 // Check partial operation. 1145 // Check partial operation.
1146 TestCase({baz: 345.7}, 0, NaN, 345, 345.7); 1146 TestCase({baz: 345.7}, 0, NaN, 345, 345.7);
1147 // Check that undefined values are converted to proper defaults. 1147 // Check that undefined values are converted to proper defaults.
1148 TestCase({qux: 999}, 0, NaN, 0, NaN); 1148 TestCase({qux: 999}, 0, NaN, 0, NaN);
1149 // Check that an undefined ffi is ok. 1149 // Check that an undefined ffi is ok.
1150 TestCase(undefined, 0, NaN, 0, NaN); 1150 // TODO(bradnelson): Fix handling of this case and re-enable.
Michael Starzinger 2017/03/22 14:55:52 nit: You could reference issue 6127 here.
bradn 2017/03/24 03:58:19 Done.
1151 // TestCase(undefined, 0, NaN, 0, NaN);
1151 // Check that true values are converted properly. 1152 // Check that true values are converted properly.
1152 TestCase({foo: true, bar: true, baz: true}, 1, 1.0, 1, 1.0); 1153 TestCase({foo: true, bar: true, baz: true}, 1, 1.0, 1, 1.0);
1153 // Check that false values are converted properly. 1154 // Check that false values are converted properly.
1154 TestCase({foo: false, bar: false, baz: false}, 0, 0, 0, 0); 1155 TestCase({foo: false, bar: false, baz: false}, 0, 0, 0, 0);
1155 // Check that null values are converted properly. 1156 // Check that null values are converted properly.
1156 TestCase({foo: null, bar: null, baz: null}, 0, 0, 0, 0); 1157 TestCase({foo: null, bar: null, baz: null}, 0, 0, 0, 0);
1157 // Check that string values are converted properly. 1158 // Check that string values are converted properly.
1158 TestCase({foo: 'hi', bar: 'there', baz: 'dude'}, 0, NaN, 0, NaN); 1159 TestCase({foo: 'hi', bar: 'there', baz: 'dude'}, 0, NaN, 0, NaN);
1159 TestCase({foo: '0xff', bar: '234', baz: '456.1'}, 255, 234, 456, 456.1, 456); 1160 TestCase({foo: '0xff', bar: '234', baz: '456.1'}, 255, 234, 456, 456.1, 456);
1160 // Check that Date values are converted properly. 1161 // Check that Date values are converted properly.
(...skipping 18 matching lines...) Expand all
1179 }; 1180 };
1180 TestCase(o, 0, NaN, 123, 123.4); 1181 TestCase(o, 0, NaN, 123, 123.4);
1181 // Check that objects with valueOf are converted properly. 1182 // Check that objects with valueOf are converted properly.
1182 var o = { 1183 var o = {
1183 valueOf: function() { return 99; } 1184 valueOf: function() { return 99; }
1184 }; 1185 };
1185 TestCase({foo: o, bar: o, baz: o}, 99, 99, 99, 99); 1186 TestCase({foo: o, bar: o, baz: o}, 99, 99, 99, 99);
1186 // Check that function values are converted properly. 1187 // Check that function values are converted properly.
1187 TestCase({foo: TestCase, bar: TestCase, qux: TestCase}, 0, NaN, 0, NaN); 1188 TestCase({foo: TestCase, bar: TestCase, qux: TestCase}, 0, NaN, 0, NaN);
1188 // Check that a missing ffi object is safe. 1189 // Check that a missing ffi object is safe.
1189 TestCase(undefined, 0, NaN, 0, NaN); 1190 // TODO(bradnelson): Fix handling of this case and re-enable.
Michael Starzinger 2017/03/22 14:55:52 nit: You could reference issue 6127 here.
bradn 2017/03/24 03:58:19 Done.
1191 // TestCase(undefined, 0, NaN, 0, NaN);
1190 } 1192 }
1191 1193
1192 print("TestForeignVariables..."); 1194 print("TestForeignVariables...");
1193 TestForeignVariables(); 1195 TestForeignVariables();
1194 1196
1195 1197
1196 (function() { 1198 (function() {
1197 function TestByteHeapAccessCompat(stdlib, foreign, buffer) { 1199 function TestByteHeapAccessCompat(stdlib, foreign, buffer) {
1198 "use asm"; 1200 "use asm";
1199 1201
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 "use asm"; 1757 "use asm";
1756 function foo() { 1758 function foo() {
1757 return 42; 1759 return 42;
1758 } 1760 }
1759 return {bar: foo, baz: foo}; 1761 return {bar: foo, baz: foo};
1760 } 1762 }
1761 var m = asmModule(); 1763 var m = asmModule();
1762 assertEquals(42, m.bar()); 1764 assertEquals(42, m.bar());
1763 assertEquals(42, m.baz()); 1765 assertEquals(42, m.baz());
1764 })(); 1766 })();
OLDNEW
« src/wasm/wasm-module-builder.cc ('K') | « src/wasm/wasm-module-builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698