Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b250c04ecf7f8f4c76db0ebf41bafe2886346e81
      
https://github.com/WebKit/WebKit/commit/b250c04ecf7f8f4c76db0ebf41bafe2886346e81
  Author: Yijia Huang <[email protected]>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M JSTests/microbenchmarks/js-map-get-int-no-dfg-no-inline.js
    M JSTests/microbenchmarks/js-map-get-int.js
    M JSTests/microbenchmarks/js-map-get-string-no-dfg-no-inline.js
    M JSTests/microbenchmarks/js-map-get-string.js
    M Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
    M Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
    M Source/JavaScriptCore/dfg/DFGClobberize.h
    M Source/JavaScriptCore/dfg/DFGDoesGC.cpp
    M Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
    M Source/JavaScriptCore/dfg/DFGHeapLocation.cpp
    M Source/JavaScriptCore/dfg/DFGHeapLocation.h
    M Source/JavaScriptCore/dfg/DFGNode.h
    M Source/JavaScriptCore/dfg/DFGNodeType.h
    M Source/JavaScriptCore/dfg/DFGOperations.cpp
    M Source/JavaScriptCore/dfg/DFGOperations.h
    M Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
    M Source/JavaScriptCore/dfg/DFGSafeToExecute.h
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
    M Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.h
    M Source/JavaScriptCore/ftl/FTLCapabilities.cpp
    M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
    M Source/JavaScriptCore/runtime/OrderedHashTable.h
    M Source/JavaScriptCore/runtime/OrderedHashTableHelper.h

  Log Message:
  -----------
  [JSC] Optimize JSMap::Get for DFG and FTL by utilizing data pointer instead 
of data index
https://bugs.webkit.org/show_bug.cgi?id=276650
rdar://131813452

Reviewed by Yusuke Suzuki.

JSMap is backed by a single array. Previously, JSMap::Get generates two
DFG nodes `MapKeyIndex` and `MapValue`, where:
* MapKeyIndex: Find the key index with a map storage and a key value.
* MapValue: Load the corresponding value with a map storage and a key index.

So, instead of loading and using the same map storage twice, we could do
* MapGet: Find the key slot in the map storage.
* MapValue: Load the value with the corresponding key slot.

Microbenchmark results with 20 iterations:

                                             without                     with

js-map-get-string                         5.6139+-0.0185     ^      
5.5335+-0.0207        ^ definitely 1.0145x faster
js-map-get-string-no-dfg-no-inline       14.2257+-0.0283           
14.1996+-0.0162
js-map-get-int                            5.7287+-0.0175     ^      
5.5497+-0.0185        ^ definitely 1.0323x faster
js-map-get-int-no-dfg-no-inline          20.2157+-0.0181     ?     
20.2332+-0.0168        ?

<geometric>                               9.8062+-0.0158     ^      
9.6913+-0.0162        ^ definitely 1.0119x faster

* JSTests/microbenchmarks/js-map-get-int-no-dfg-no-inline.js:
(testSet):
(testGet):
* JSTests/microbenchmarks/js-map-get-int.js:
(testGet):
* JSTests/microbenchmarks/js-map-get-string-no-dfg-no-inline.js:
(testSet):
(testGet):
* JSTests/microbenchmarks/js-map-get-string.js:
(testGet):
* Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* Source/JavaScriptCore/dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* Source/JavaScriptCore/dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* Source/JavaScriptCore/dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* Source/JavaScriptCore/dfg/DFGHeapLocation.cpp:
(WTF::printInternal):
* Source/JavaScriptCore/dfg/DFGHeapLocation.h:
* Source/JavaScriptCore/dfg/DFGNode.h:
(JSC::DFG::Node::hasHeapPrediction):
* Source/JavaScriptCore/dfg/DFGNodeType.h:
* Source/JavaScriptCore/dfg/DFGOperations.cpp:
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/dfg/DFGOperations.h:
* Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp:
* Source/JavaScriptCore/dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compileMapGetImpl):
(JSC::DFG::SpeculativeJIT::compileMapGet):
(JSC::DFG::SpeculativeJIT::compileLoadMapValue):
(JSC::DFG::SpeculativeJIT::compile):
(JSC::DFG::SpeculativeJIT::compileGetMapIndexImpl): Deleted.
(JSC::DFG::SpeculativeJIT::compileMapKeyIndex): Deleted.
(JSC::DFG::SpeculativeJIT::compileMapValue): Deleted.
* Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.h:
* Source/JavaScriptCore/ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
* Source/JavaScriptCore/runtime/OrderedHashTable.h:
(JSC::OrderedHashTable::getKeySlot):
(JSC::OrderedHashTable::getKeyIndex): Deleted.
* Source/JavaScriptCore/runtime/OrderedHashTableHelper.h:
(JSC::OrderedHashTableHelper::find):

Canonical link: https://commits.webkit.org/281039@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to