Bug 18736
Summary: | SQUIRRELFISH: switch statements with no default have incorrect codegen | ||
---|---|---|---|
Product: | WebKit | Reporter: | Cameron Zwarich (cpst) <zwarich> |
Component: | JavaScriptCore | Assignee: | Cameron Zwarich (cpst) <zwarich> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | ||
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | All | ||
OS: | All | ||
Bug Depends on: | |||
Bug Blocks: | 18624 |
Cameron Zwarich (cpst)
If no conditions match, we should skip all the case
clauses, but instead we fall through to the first.
function f2(i) {
switch (i) {
case 0:
case 1:
return 1;
case 2:
return 2;
}
// with no default, control will fall through
return 3;
}
[ 0] load tr0, 0(@k0)
[ 3] stricteq tr0, tr0, lr1
[ 7] jtrue tr0, 21(->30)
[ 10] load tr0, 1(@k1)
[ 13] stricteq tr0, tr0, lr1
[ 17] jtrue tr0, 11(->30)
[ 20] load tr0, 2(@k2)
[ 23] stricteq tr0, tr0, lr1
[ 27] jtrue tr0, 6(->35)
[ 30] load tr0, 1(@k1)
[ 33] ret tr0
[ 35] load tr0, 2(@k2)
[ 38] ret tr0
[ 40] load tr0, 3(@k3)
[ 43] ret tr0
This affects the JavaScriptCore regression test js1_2/statements/switch2.js.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Oliver Hunt
Committed r32547