Ignore:
Timestamp:
Aug 26, 2020, 10:27:16 PM (5 years ago)
Author:
Alexey Shvayka
Message:

Use jsTypeofIsObject() in DFG AI and operationTypeOfIsObject()
https://bugs.webkit.org/show_bug.cgi?id=144457

Reviewed by Saam Barati.

Source/JavaScriptCore:

This patch refactors jsTypeofIsObject(), leveraging fast path of isCallable(),
moves it to the header, and utilizes it in operationTypeOfIsObject() & DFG AI
(minding concurrency) to eliminate code duplication.

Also, removes orphaned slow_path_is_object declaration.

No behavior change, typeof microbenchmarks are neutral.

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):

  • dfg/DFGOperations.cpp:
  • runtime/CommonSlowPaths.h:
  • runtime/Operations.cpp:

(JSC::jsTypeofIsObject): Deleted.

  • runtime/Operations.h:

(JSC::jsTypeofIsObjectWithConcurrency):
(JSC::jsTypeofIsObject):

Source/WTF:

  • wtf/TriState.h:

(WTF::invert):

File:
1 edited

Legend:

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

    r266107 r266223  
    3333NEVER_INLINE JSValue jsAddSlowCase(JSGlobalObject*, JSValue, JSValue);
    3434JSString* jsTypeStringForValueWithConcurrency(VM&, JSGlobalObject*, JSValue, Concurrency);
    35 bool jsTypeofIsObject(JSGlobalObject*, JSValue);
    3635size_t normalizePrototypeChain(JSGlobalObject*, JSCell*, bool& sawPolyProto);
     36
     37template<Concurrency concurrency>
     38ALWAYS_INLINE TriState jsTypeofIsObjectWithConcurrency(JSGlobalObject* globalObject, JSValue value)
     39{
     40    VM& vm = globalObject->vm();
     41    if (!value.isObject())
     42        return triState(value.isNull());
     43    JSObject* object = asObject(value);
     44    if (object->structure(vm)->masqueradesAsUndefined(globalObject))
     45        return TriState::False;
     46    return invert(object->isCallableWithConcurrency<concurrency>(vm));
     47}
    3748
    3849template<Concurrency concurrency>
     
    5162{
    5263    return jsTypeStringForValueWithConcurrency(getVM(globalObject), globalObject, value, Concurrency::MainThread);
     64}
     65
     66ALWAYS_INLINE bool jsTypeofIsObject(JSGlobalObject* globalObject, JSValue value)
     67{
     68    auto result = jsTypeofIsObjectWithConcurrency<Concurrency::MainThread>(globalObject, value);
     69    ASSERT(result != TriState::Indeterminate);
     70    return result == TriState::True;
    5371}
    5472
Note: See TracChangeset for help on using the changeset viewer.