Changeset 209899 in webkit
- Timestamp:
- Dec 15, 2016 6:38:27 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r209891 r209899 1 2016-12-15 Keith Miller <keith_miller@apple.com> 2 3 Fix validation of non-void if blocks with no else 4 https://bugs.webkit.org/show_bug.cgi?id=165938 5 6 Reviewed by Saam Barati. 7 8 Add a new failing test and a fix an existing one. 9 10 * wasm/function-tests/dead-call.js: 11 * wasm/function-tests/if-no-else-non-void.js: Added. 12 1 13 2016-12-15 Keith Miller <keith_miller@apple.com> 2 14 -
trunk/JSTests/wasm/function-tests/dead-call.js
r209891 r209899 15 15 .Function("dead-call", { params: [], ret: "i32" }) 16 16 .I32Const(0) 17 .If("i32", b => b.Call(0).Return()) 18 .I32Const(1) 17 .If("i32", b => 18 b.Call(0) 19 .Return() 20 .Else() 21 .I32Const(1) 22 ) 19 23 .End() 20 24 -
trunk/Source/JavaScriptCore/ChangeLog
r209897 r209899 1 2016-12-15 Keith Miller <keith_miller@apple.com> 2 3 Fix validation of non-void if blocks with no else 4 https://bugs.webkit.org/show_bug.cgi?id=165938 5 6 Reviewed by Saam Barati. 7 8 We should not have been allowing non-void if-blocks that don't 9 have an else. Since this causes a value to be placed on the 10 stack that only appears under some control flow and not another. 11 12 * wasm/WasmValidate.cpp: 13 1 14 2016-12-15 Filip Pizlo <fpizlo@apple.com> 2 15 -
trunk/Source/JavaScriptCore/wasm/WasmValidate.cpp
r209880 r209899 291 291 return { }; 292 292 293 WASM_VALIDATOR_FAIL_IF(block.type() == BlockType::If, "If-block had a non-void result type: ", block.signature(), " but had no else-block"); 293 294 WASM_VALIDATOR_FAIL_IF(stack.isEmpty(), "typed block falls through on empty stack"); 294 295 WASM_VALIDATOR_FAIL_IF(block.signature() != stack.last(), "block fallthrough doesn't match its declared type"); … … 300 301 auto Validate::addEndToUnreachable(ControlEntry& entry) -> Result 301 302 { 302 if (entry.controlData.signature() != Void) 303 entry.enclosedExpressionStack.append(entry.controlData.signature()); 303 auto block = entry.controlData; 304 if (block.signature() != Void) { 305 WASM_VALIDATOR_FAIL_IF(block.type() == BlockType::If, "If-block had a non-void result type: ", block.signature(), " but had no else-block"); 306 entry.enclosedExpressionStack.append(block.signature()); 307 } 304 308 return { }; 305 309 }
Note: See TracChangeset
for help on using the changeset viewer.