Ignore:
Timestamp:
Apr 26, 2013, 11:43:33 PM (12 years ago)
Author:
[email protected]
Message:

Source/JavaScriptCore: Re-landing <http://trac.webkit.org/changeset/148999>

Filled out more cases of branch folding in bytecode when emitting
expressions into a branching context
https://bugs.webkit.org/show_bug.cgi?id=115057

Reviewed by Phil Pizlo.

We can't fold the number == 1 case to boolean because all non-zero numbers
down-cast to true, but only 1 is == to true.

Source/WTF: Filled out more cases of branch folding in bytecode when emitting expressions into a branching context
https://bugs.webkit.org/show_bug.cgi?id=115057

Reviewed by Filip Pizlo.

Added a helper constructor for TriState so clients can make one without
branching or making assumptions about the integer values of TriStates.

  • wtf/TriState.h:

(WTF::triState):
(WTF):

LayoutTests: Re-landing <http://trac.webkit.org/changeset/148999>

Filled out more cases of branch folding in bytecode when emitting
expressions into a branching context
https://bugs.webkit.org/show_bug.cgi?id=115057

Reviewed by Phil Pizlo.

Added a more exhaustive correctness test.

  • fast/js/branch-fold-correctness-expected.txt: Added.
  • fast/js/branch-fold-correctness.html: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSCJSValueInlines.h

    r149158 r149236  
    801801        return (asDouble() > 0.0 || asDouble() < 0.0) ? TrueTriState : FalseTriState; // false for NaN
    802802    if (isCell())
    803         return MixedTriState;
     803        return asCell()->pureToBoolean();
    804804    return isTrue() ? TrueTriState : FalseTriState;
    805805}
Note: See TracChangeset for help on using the changeset viewer.