Skip to content

Commit

Permalink
Merge pull request bytecodealliance#57 from bytecodealliance/cfallin/…
Browse files Browse the repository at this point in the history
…fix-tableswitch

PBL: fix specialization range on TableSwitch index.
  • Loading branch information
cfallin authored Aug 6, 2024
2 parents d84423f + 56a85d2 commit dc07fd2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/src/vm/PortableBaselineInterpret.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8375,11 +8375,11 @@ PBIResult PortableBaselineInterpret(JSContext* cx_, State& state, Stack& stack,
DISPATCH();
}

i = PBL_SPECIALIZE_VALUE(i - low, low, high);

if ((uint32_t(i) < uint32_t(high - low + 1))) {
if (i >= low && i <= high) {
uint32_t idx =
PBL_SPECIALIZE_VALUE(uint32_t(i) - uint32_t(low), 0, uint32_t(high - low + 1));
uint32_t firstResumeIndex = GET_RESUMEINDEX(pc + 3 * JUMP_OFFSET_LEN);
pc = entryPC + resumeOffsets[firstResumeIndex + i];
pc = entryPC + resumeOffsets[firstResumeIndex + idx];
DISPATCH();
}
ADVANCE(len);
Expand Down

0 comments on commit dc07fd2

Please sign in to comment.