[webkit-reviews] review granted: [Bug 235581] Add support for WASM branch hinting proposal : [Attachment 450087] Updated patch after review

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 28 04:14:15 PST 2022


Yusuke Suzuki <ysuzuki at apple.com> has granted tom at leaningtech.com's request for
review:
Bug 235581: Add support for WASM branch hinting proposal
https://bugs.webkit.org/show_bug.cgi?id=235581

Attachment 450087: Updated patch after review

https://bugs.webkit.org/attachment.cgi?id=450087&action=review




--- Comment #8 from Yusuke Suzuki <ysuzuki at apple.com> ---
Comment on attachment 450087
  --> https://bugs.webkit.org/attachment.cgi?id=450087
Updated patch after review

View in context: https://bugs.webkit.org/attachment.cgi?id=450087&action=review

r=me

> Source/JavaScriptCore/wasm/WasmAirIRGenerator.cpp:3186
> +	   if (hint == BranchHint::Unlikely)
> +	       takenFrequency = B3::FrequencyClass::Rare;
> +	   else if (hint == BranchHint::Likely)
> +	       notTakenFrequency = B3::FrequencyClass::Rare;

Let's use switch.

> Source/JavaScriptCore/wasm/WasmAirIRGenerator.cpp:3439
> +	   if (hint == BranchHint::Unlikely)
> +	       targetFrequency = B3::FrequencyClass::Rare;
> +	   else if (hint == BranchHint::Likely)
> +	       continuationFrequency = B3::FrequencyClass::Rare;

Ditto.

> Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:2486
> +	   if (hint == BranchHint::Unlikely)
> +	       takenFrequency = FrequencyClass::Rare;
> +	   else if (hint == BranchHint::Likely)
> +	       notTakenFrequency = FrequencyClass::Rare;

Let's use switch, which can ensure that all enums are handled.

switch (hint) {
case BranchHint::Unlikely:
    takenFrequency = FrequencyClass::Rare;
    break;
case BranchHint::Likely:
    notTakenFrequency = FrequencyClass::Rare;
    break;
}

> Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:2742
> +	   if (hint == BranchHint::Unlikely)
> +	       targetFrequency = FrequencyClass::Rare;
> +	   else if (hint == BranchHint::Likely)
> +	       continuationFrequency = FrequencyClass::Rare;

Ditto.

> Source/JavaScriptCore/wasm/WasmBranchHintsSectionParser.cpp:70
> +	       BranchHint branchHint =
static_cast<BranchHint>(parsedBranchHint);

Let's add

ASSERT(isValidBranchHint(branchHint));

It should be due to parseVarUInt1. But such an ASSERT is helpful if this branch
hint is extended to have more values (then, assert hits and we can fix the
issue :)).


More information about the webkit-reviews mailing list