Graph::methodOfGettingAValueProfileFor compares NodeOrigin instead of the semantic...
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Sep 2017 03:05:39 +0000 (03:05 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Sep 2017 03:05:39 +0000 (03:05 +0000)
commit3e138c90a4a14b8a1137ffb35c92207bd932aea7
tree51d81eb11cbffce00ee87bc7c36cd4d4915eeb13
parentba5c5323070a98b4177515c08f32c3ab44a55140
Graph::methodOfGettingAValueProfileFor compares NodeOrigin instead of the semantic CodeOrigin
https://bugs.webkit.org/show_bug.cgi?id=176206

Reviewed by Keith Miller.

JSTests:

* stress/compare-semantic-origin-op-negate-method-of-getting-a-value-profile.js: Added.
(a):
(b):
(foo):

Source/JavaScriptCore:

Mark fixed the main issue in Graph::methodOfGettingAValueProfileFor in r208560
when he fixed it from overwriting invalid parts of the ArithProfile when the
currentNode and the operandNode are from the same bytecode. However, the
mechanism used to determine same bytecode was comparing NodeOrigin. That's
slightly wrong. We need to compare semantic origin, since two NodeOrigins can
have the same semantic origin, but differ only in exitOK. For example,
in the below IR, the DoubleRep and the Phi have the same semantic
origin, but different NodeOrigins.

43 Phi(JS|PureInt, NonBoolInt32|NonIntAsdouble, W:SideState, bc#63, ExitInvalid)
58 ExitOK(MustGen, W:SideState, bc#63)
51 DoubleRep(Check:Number:Kill:@43, Double|PureInt, BytecodeDouble, Exits, bc#63)
54 ArithNegate(DoubleRep:Kill:@51<Double>, Double|UseAsOther|MayHaveDoubleResult, AnyIntAsDouble|NonIntAsdouble, NotSet, Exits, bc#63)

* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::methodOfGettingAValueProfileFor):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221470 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/stress/compare-semantic-origin-op-negate-method-of-getting-a-value-profile.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGGraph.cpp