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

Side by Side Diff: test/mjsunit/wasm/unicode-validation.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/trap-location.js ('k') | test/mjsunit/wasm/verify-function-simple.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 toByteArray(s) { 10 function toByteArray(s) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 function checkImportsAndExports(imported_module_name, imported_function_name, 44 function checkImportsAndExports(imported_module_name, imported_function_name,
45 internal_function_name, exported_function_name, shouldThrow) { 45 internal_function_name, exported_function_name, shouldThrow) {
46 var builder = new WasmModuleBuilder(); 46 var builder = new WasmModuleBuilder();
47 47
48 builder.addImportWithModule(imported_module_name, imported_function_name, 48 builder.addImportWithModule(imported_module_name, imported_function_name,
49 kSig_v_v); 49 kSig_v_v);
50 50
51 builder.addFunction(internal_function_name, kSig_v_v) 51 builder.addFunction(internal_function_name, kSig_v_v)
52 .addBody([kExprCallImport, kArity0, 0]) 52 .addBody([kExprCallFunction, 0])
53 .exportAs(exported_function_name); 53 .exportAs(exported_function_name);
54 54
55 // sanity check: does javascript agree with out shouldThrow annotation? 55 // sanity check: does javascript agree with out shouldThrow annotation?
56 assertEquals(shouldThrow, 56 assertEquals(shouldThrow,
57 !isValidUtf8(imported_module_name) || 57 !isValidUtf8(imported_module_name) ||
58 !isValidUtf8(imported_function_name) || 58 !isValidUtf8(imported_function_name) ||
59 !isValidUtf8(exported_function_name), 59 !isValidUtf8(exported_function_name),
60 "JavaScript does not agree with our shouldThrow expectation"); 60 "JavaScript does not agree with our shouldThrow expectation");
61 61
62 if (!shouldThrow) { 62 if (!shouldThrow) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 checkAll("some math: (½)² = ¼", false); 113 checkAll("some math: (½)² = ¼", false);
114 checkAll("中国历史系列条目\n北", false); 114 checkAll("中国历史系列条目\n北", false);
115 checkAll(toByteArray("\xef\xb7\x8f"), false); 115 checkAll(toByteArray("\xef\xb7\x8f"), false);
116 checkAll(toByteArray("a\xc2\x81\xe1\x80\xbf\xf1\x80\xa0\xbf"), false); 116 checkAll(toByteArray("a\xc2\x81\xe1\x80\xbf\xf1\x80\xa0\xbf"), false);
117 checkAll(toByteArray("\xff"), true); 117 checkAll(toByteArray("\xff"), true);
118 checkAll(toByteArray("\xed\xa0\x8f"), true); // surrogate code points 118 checkAll(toByteArray("\xed\xa0\x8f"), true); // surrogate code points
119 checkAll(toByteArray("\xe0\x82\x80"), true); // overlong sequence 119 checkAll(toByteArray("\xe0\x82\x80"), true); // overlong sequence
120 checkAll(toByteArray("\xf4\x90\x80\x80"), true); // beyond limit: U+110000 120 checkAll(toByteArray("\xf4\x90\x80\x80"), true); // beyond limit: U+110000
121 checkAll(toByteArray("\xef\xbf\xbe"), true); // non-character; U+FFFE 121 checkAll(toByteArray("\xef\xbf\xbe"), true); // non-character; U+FFFE
122 checkAll(toByteArray("with\x00null"), false); 122 checkAll(toByteArray("with\x00null"), false);
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/trap-location.js ('k') | test/mjsunit/wasm/verify-function-simple.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698