Ignore:
Timestamp:
May 29, 2015, 1:26:37 PM (10 years ago)
Author:
[email protected]
Message:

Non-speculative Branch should be fast in the FTL
https://bugs.webkit.org/show_bug.cgi?id=145452

Reviewed by Andreas Kling.
Source/JavaScriptCore:


Inlines the code for convertJSValueToBoolean into the FTL. This also includes some other
clean-ups that I found along the way.

I found this by looking at the hottest functions in DeltaBlue. Despite having so many
Branch specializations, apparently there was still a hot one that we missed that was going
down the untyped path. It was either Int32 or Other. Maybe we could specialize for that
combo, but it makes so much sense to just make all of this nonsense fast.

  • dfg/DFGWatchpointCollectionPhase.cpp:

(JSC::DFG::WatchpointCollectionPhase::handle): Need to watch the masquerades watchpoint on UntypedUse: forms of Branch now.

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::boolify): The actual fix.
(JSC::FTL::LowerDFGToLLVM::int52ToStrictInt52):
(JSC::FTL::LowerDFGToLLVM::isInt32):
(JSC::FTL::LowerDFGToLLVM::isNotInt32):
(JSC::FTL::LowerDFGToLLVM::unboxInt32):

  • runtime/JSCellInlines.h:

(JSC::JSCell::toBoolean): Symbol is always true.
(JSC::JSCell::pureToBoolean): Symbol is always true.

  • runtime/JSString.cpp:

(JSC::JSString::getPrimitiveNumber):
(JSC::JSString::toNumber):
(JSC::JSString::toBoolean): Deleted. This is a tiny method. It doesn't need to be out-of-line.

  • runtime/JSString.h:

(JSC::JSString::length):
(JSC::JSString::toBoolean): This method shouldbe inline.

  • runtime/Symbol.cpp:

(JSC::Symbol::toPrimitive):
(JSC::Symbol::getPrimitiveNumber):
(JSC::Symbol::toBoolean): Deleted. A Symbol is always true, so we don't need a method for this.

  • runtime/Symbol.h:

LayoutTests:

  • js/regress/logical-not-weird-types-expected.txt: Added.
  • js/regress/logical-not-weird-types.html: Added.
  • js/regress/script-tests/logical-not-weird-types.js: Added.

(foo):

File:
1 edited

Legend:

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

    r184865 r185002  
    151151
    152152    JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
    153     JS_EXPORT_PRIVATE bool toBoolean() const;
     153    bool toBoolean() const { return !!m_length; }
    154154    bool getPrimitiveNumber(ExecState*, double& number, JSValue&) const;
    155155    JSObject* toObject(ExecState*, JSGlobalObject*) const;
Note: See TracChangeset for help on using the changeset viewer.