Changeset 214438 in webkit
- Timestamp:
- Mar 27, 2017 4:24:31 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r214345 r214438 1 2017-03-27 JF Bastien <jfbastien@apple.com> 2 3 WebAssembly: misc memory testing 4 https://bugs.webkit.org/show_bug.cgi?id=170137 5 6 Reviewed by Keith Miller. 7 8 * wasm/assert.js: handle newlines in code we print out, avoid regex 9 * wasm/function-tests/memory-import-and-grow.js: Added. 10 (const.instantiate): 11 (const.test): 12 * wasm/function-tests/memory-section-and-import.js: Added. 13 (const.instantiate): 14 1 15 2017-03-23 Yusuke Suzuki <utatane.tea@gmail.com> 2 16 -
trunk/JSTests/wasm/assert.js
r213465 r214438 112 112 }; 113 113 114 // Ignore source information at the end of the error message if the expected message didn't specify that information. Sometimes it changes, or it's tricky to get just right.115 const _sourceRe = new RegExp(/( \(evaluating '.*'\))|( \(In .*\))/);116 117 114 const _throws = (func, type, message, ...args) => { 118 115 try { … … 122 119 if (e.message === message) 123 120 return e; 124 const cleanMessage = e.message.replace(_sourceRe, ''); 125 if (cleanMessage === message) 126 return e; 121 // Ignore source information at the end of the error message if the 122 // expected message didn't specify that information. Sometimes it 123 // changes, or it's tricky to get just right. 124 const evaluatingIndex = e.message.indexOf(" (evaluating '"); 125 if (evaluatingIndex !== -1) { 126 const cleanMessage = e.message.substring(0, evaluatingIndex); 127 if (cleanMessage === message) 128 return e; 129 } 130 return e; 127 131 } 128 132 _fail(`Expected to throw a ${type.name} with message "${message}", got ${e.name} with message "${e.message}"`); -
trunk/Source/JavaScriptCore/ChangeLog
r214416 r214438 1 2017-03-27 JF Bastien <jfbastien@apple.com> 2 3 WebAssembly: misc memory testing 4 https://bugs.webkit.org/show_bug.cgi?id=170137 5 6 Reviewed by Keith Miller. 7 8 * wasm/js/WebAssemblyInstanceConstructor.cpp: 9 (JSC::WebAssemblyInstanceConstructor::createInstance): improve error messages 10 1 11 2017-03-27 Michael Saboff <msaboff@apple.com> 2 12 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp
r214261 r214438 169 169 return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Table import is not an instance of WebAssembly.Table"))); 170 170 171 uint32_t expectedInitial = moduleInformation.tableInformation.initial();172 uint32_t actualInitial = table->size();173 if ( actualInitial < expectedInitial)171 uint32_t declaredInitial = moduleInformation.tableInformation.initial(); 172 uint32_t importedInitial = table->size(); 173 if (importedInitial < declaredInitial) 174 174 return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Table import provided an 'initial' that is too small"))); 175 175 176 if (std::optional<uint32_t> expectedMaximum = moduleInformation.tableInformation.maximum()) {177 std::optional<uint32_t> actualMaximum = table->maximum();178 if (! actualMaximum)176 if (std::optional<uint32_t> declaredMaximum = moduleInformation.tableInformation.maximum()) { 177 std::optional<uint32_t> importedMaximum = table->maximum(); 178 if (!importedMaximum) 179 179 return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Table import does not have a 'maximum' but the module requires that it does"))); 180 if (* actualMaximum > *expectedMaximum)180 if (*importedMaximum > *declaredMaximum) 181 181 return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Imported Table's 'maximum' is larger than the module's expected 'maximum'"))); 182 182 } … … 197 197 return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory import is not an instance of WebAssembly.Memory"))); 198 198 199 Wasm::PageCount expectedInitial = moduleInformation.memory.initial();200 Wasm::PageCount actualInitial = memory->memory().initial();201 if ( actualInitial < expectedInitial)202 return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory import provided an 'initial' that is too small")));203 204 if (Wasm::PageCount expectedMaximum = moduleInformation.memory.maximum()) {205 Wasm::PageCount actualMaximum = memory->memory().maximum();206 if (! actualMaximum)199 Wasm::PageCount declaredInitial = moduleInformation.memory.initial(); 200 Wasm::PageCount importedInitial = memory->memory().initial(); 201 if (importedInitial < declaredInitial) 202 return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory import provided an 'initial' that is smaller than the module's declared 'initial' import memory size"))); 203 204 if (Wasm::PageCount declaredMaximum = moduleInformation.memory.maximum()) { 205 Wasm::PageCount importedMaximum = memory->memory().maximum(); 206 if (!importedMaximum) 207 207 return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory import did not have a 'maximum' but the module requires that it does"))); 208 208 209 if ( actualMaximum > expectedMaximum)210 return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory import s 'maximum' is larger than the module's expected 'maximum'")));209 if (importedMaximum > declaredMaximum) 210 return exception(createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory import provided a 'maximum' that is larger than the module's declared 'maximum' import memory size"))); 211 211 } 212 212
Note: See TracChangeset
for help on using the changeset viewer.