Commit 0d30fac2 authored by Seth Brenith's avatar Seth Brenith Committed by Commit Bot

[interpreter] Include Star lookahead for more bytecodes

I made some temporary changes in BytecodeArrayWriter to log counts of
how often each pair of bytecodes is adjacent. In data I collected on a
Facebook page with those changes enabled, I noticed that the following
bytecodes were commonly followed by Star, but do not appear in
IsStarLookahead.

LdaImmutableCurrentContextSlot:
  4.4% of all instructions, 66% chance to be followed by Star
CreateClosure:
  3.9% of all instructions, 57% chance to be followed by Star
LdaImmutableContextSlot:
  1.7% of all instructions, 95% chance to be followed by Star
CreateObjectLiteral:
  1.4% of all instructions, 92% chance to be followed by Star
CreateArrayLiteral:
  1.4% of all instructions, 99% chance to be followed by Star
ThrowReferenceErrorIfHole:
  0.7% of all instructions, 100% chance to be followed by Star
GetTemplateObject:
  0.6% of all instructions, 100% chance to be followed by Star
CreateEmptyArrayLiteral:
  0.4% of all instructions, 87% chance to be followed by Star
CreateEmptyObjectLiteral:
  0.2% of all instructions, 79% chance to be followed by Star

I cross-referenced this list with data from google.com and youtube.com
(the top two sites according to Alexa), and found that CreateClosure and
CreateEmpty*Literal are not likely followed by Star on those sites.
Without those three, I suggest that the following bytecode handlers
would likely benefit from Star lookahead:

LdaImmutableCurrentContextSlot
LdaImmutableContextSlot
CreateObjectLiteral
CreateArrayLiteral
ThrowReferenceErrorIfHole
GetTemplateObject

I also ran Octane with --noopt and got the following results.

Name               Median change (95% CI)    U test result
-----------------  ------------------------  -------------------
Richards           +1.02% to +3.28%          improved  p=1.8e-05
DeltaBlue          -1.47% to +0.12%          regressed p=0.05
Crypto             -1.11% to +0.93%          inconclusive
RayTrace           -1.10% to +0.48%          inconclusive
EarleyBoyer        -0.25% to +1.29%          inconclusive
RegExp             -1.46% to +0.08%          inconclusive
Splay              -1.10% to +0.03%          inconclusive
SplayLatency       +0.13% to +0.92%          improved  p=5.8e-05
NavierStokes       -0.22% to +1.24%          inconclusive
PdfJS              -0.69% to +1.04%          inconclusive
Mandreel           -0.66% to +0.66%          inconclusive
MandreelLatency    +0.32% to +1.77%          improved  p=0.00024
Gameboy            -1.13% to +0.38%          inconclusive
CodeLoad           -0.27% to +0.43%          inconclusive
Box2D              -0.53% to +0.82%          inconclusive
zlib               -0.19% to +0.19%          inconclusive
Typescript         -0.23% to +0.59%          inconclusive
Score (version 9)  -0.18% to +0.68%          inconclusive

I'm somewhat puzzled by the DeltaBlue regression, since DeltaBlue
agrees that all of the selected bytecodes are likely to precede Star,
but overall I think this change is more benefit than harm.

Change-Id: Ib9b4033f3cda273e99c9f0252d0055e203921916
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2615946Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#71987}
parent e4675193
......@@ -274,7 +274,9 @@ bool Bytecodes::IsStarLookahead(Bytecode bytecode, OperandScale operand_scale) {
case Bytecode::kLdaNamedProperty:
case Bytecode::kLdaKeyedProperty:
case Bytecode::kLdaContextSlot:
case Bytecode::kLdaImmutableContextSlot:
case Bytecode::kLdaCurrentContextSlot:
case Bytecode::kLdaImmutableCurrentContextSlot:
case Bytecode::kAdd:
case Bytecode::kSub:
case Bytecode::kMul:
......@@ -295,6 +297,10 @@ bool Bytecodes::IsStarLookahead(Bytecode bytecode, OperandScale operand_scale) {
case Bytecode::kCallUndefinedReceiver2:
case Bytecode::kConstruct:
case Bytecode::kConstructWithSpread:
case Bytecode::kCreateObjectLiteral:
case Bytecode::kCreateArrayLiteral:
case Bytecode::kThrowReferenceErrorIfHole:
case Bytecode::kGetTemplateObject:
return true;
default:
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment