Ignore:
Timestamp:
Jul 24, 2013, 9:03:03 PM (12 years ago)
Author:
[email protected]
Message:

fourthTier: Add CFG simplification for Switch
https://bugs.webkit.org/show_bug.cgi?id=117677

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

This is for completeness. It only speeds up a microbenchmark at this point.
Broadly, we want all control constructs to be known to the CFG simplifier.

  • dfg/DFGCFGSimplificationPhase.cpp:

(JSC::DFG::CFGSimplificationPhase::run):
(JSC::DFG::CFGSimplificationPhase::convertToJump):
(CFGSimplificationPhase):
(JSC::DFG::CFGSimplificationPhase::noBlocks):
(JSC::DFG::CFGSimplificationPhase::oneBlock):
(JSC::DFG::CFGSimplificationPhase::mergeBlocks):

  • runtime/JSCJSValue.h:

(JSValue):

  • runtime/JSCJSValueInlines.h:

(JSC::JSValue::pureStrictEqual):
(JSC):

Source/WTF:

Reviewed by Mark Hahnenberg.

  • wtf/TriState.h:
  • wtf/text/StringImpl.h:

LayoutTests:

Reviewed by Mark Hahnenberg.

  • fast/js/regress/script-tests/switch-constant.js: Added.

(foo):
(bar):

  • fast/js/regress/script-tests/switch.js: Added.

(foo):
(bar):

  • fast/js/regress/switch-constant-expected.txt: Added.
  • fast/js/regress/switch-constant.html: Added.
  • fast/js/regress/switch-expected.txt: Added.
  • fast/js/regress/switch.html: Added.
File:
1 edited

Legend:

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

    r153145 r153229  
    794794}
    795795
     796inline TriState JSValue::pureStrictEqual(JSValue v1, JSValue v2)
     797{
     798    if (v1.isInt32() && v2.isInt32())
     799        return triState(v1 == v2);
     800
     801    if (v1.isNumber() && v2.isNumber())
     802        return triState(v1.asNumber() == v2.asNumber());
     803
     804    if (!v1.isCell() || !v2.isCell())
     805        return triState(v1 == v2);
     806   
     807    if (v1.asCell()->isString() && v2.asCell()->isString()) {
     808        const StringImpl* v1String = asString(v1)->tryGetValueImpl();
     809        const StringImpl* v2String = asString(v2)->tryGetValueImpl();
     810        if (!v1String || !v2String)
     811            return MixedTriState;
     812        return triState(WTF::equal(v1String, v2String));
     813    }
     814   
     815    return triState(v1 == v2);
     816}
     817
    796818inline TriState JSValue::pureToBoolean() const
    797819{
Note: See TracChangeset for help on using the changeset viewer.