Skip to content

Commit

Permalink
Merge pull request mozilla#54 from bytecodealliance/cfallin/fix-if-co…
Browse files Browse the repository at this point in the history
…nversion-on-pbl-branches

PBL/weval: value-specialize on two-way conditional inputs to avoid issues with if-conversion.
  • Loading branch information
cfallin authored Jul 31, 2024
2 parents b7935be + 7d24061 commit b44d44f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions js/src/vm/PortableBaselineInterpret.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6350,7 +6350,8 @@ PBIResult PortableBaselineInterpret(JSContext* cx_, State& state, Stack& stack,
result = Value::fromRawBits(ic_ret).toBoolean();
}
int32_t jumpOffset = GET_JUMP_OFFSET(pc);
if (!result) {
int choice = PBL_SPECIALIZE_VALUE(uint32_t(result), 0, 1);
if (!choice) {
ADVANCE(jumpOffset);
PREDICT_NEXT(JumpTarget);
PREDICT_NEXT(LoopHead);
Expand All @@ -6376,7 +6377,8 @@ PBIResult PortableBaselineInterpret(JSContext* cx_, State& state, Stack& stack,
result = Value::fromRawBits(ic_ret).toBoolean();
}
int32_t jumpOffset = GET_JUMP_OFFSET(pc);
if (result) {
int choice = PBL_SPECIALIZE_VALUE(uint32_t(result), 0, 1);
if (choice) {
ADVANCE(jumpOffset);
PREDICT_NEXT(JumpTarget);
PREDICT_NEXT(LoopHead);
Expand Down Expand Up @@ -6404,7 +6406,8 @@ PBIResult PortableBaselineInterpret(JSContext* cx_, State& state, Stack& stack,
result = Value::fromRawBits(ic_ret).toBoolean();
}
int32_t jumpOffset = GET_JUMP_OFFSET(pc);
if (result) {
int choice = PBL_SPECIALIZE_VALUE(uint32_t(result), 0, 1);
if (choice) {
ADVANCE(jumpOffset);
PREDICT_NEXT(JumpTarget);
PREDICT_NEXT(LoopHead);
Expand Down Expand Up @@ -6432,7 +6435,8 @@ PBIResult PortableBaselineInterpret(JSContext* cx_, State& state, Stack& stack,
result = Value::fromRawBits(ic_ret).toBoolean();
}
int32_t jumpOffset = GET_JUMP_OFFSET(pc);
if (!result) {
int choice = PBL_SPECIALIZE_VALUE(uint32_t(result), 0, 1);
if (!choice) {
ADVANCE(jumpOffset);
PREDICT_NEXT(JumpTarget);
PREDICT_NEXT(LoopHead);
Expand Down

0 comments on commit b44d44f

Please sign in to comment.