-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 1ed1e4a. rdar://problem/98392410
[JSC] Make JSMap and JSSet construction more simple and efficient https://bugs.webkit.org/show_bug.cgi?id=243557 rdar://98068082 Reviewed by Mark Lam and Saam Barati. This patch makes the initial buffer of JSMap / JSSet nullptr so that we can make allocation of them simpler and efficient for non-using case. It cleans up many code in module loader etc. And it paves the way to allocating them from DFG and FTL efficiently. It also cleans up SerializedScriptValue implementation. * JSTests/stress/map-clear-get.js: Added. (shouldBe): (test): * JSTests/stress/set-clear-has.js: Added. (shouldBe): (set clear): (set shouldBe): (set new): * Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq): * Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp: (JSC::AbstractModuleRecord::finishCreation): * Source/JavaScriptCore/runtime/HashMapImpl.h: (JSC::HashMapBuffer::tryCreate): (JSC::HashMapImpl::HashMapImpl): (JSC::HashMapBuffer::create): Deleted. (JSC::HashMapImpl::shouldRehashAfterAdd const): Deleted. * Source/JavaScriptCore/runtime/HashMapImplInlines.h: (JSC::shouldShrink): (JSC::shouldRehash): (JSC::nextCapacity): (JSC::HashMapImpl<HashMapBucketType>::finishCreation): (JSC::HashMapImpl<HashMapBucketType>::add): (JSC::HashMapImpl<HashMapBucketType>::addNormalized): (JSC::HashMapImpl<HashMapBucketType>::remove): (JSC::HashMapImpl<HashMapBucketType>::clear): (JSC::HashMapImpl<HashMapBucketType>::setUpHeadAndTail): (JSC::HashMapImpl<HashMapBucketType>::addNormalizedNonExistingForCloning): (JSC::HashMapImpl<HashMapBucketType>::addNormalizedNonExistingForCloningInternal): (JSC::HashMapImpl<HashMapBucketType>::addNormalizedInternal): (JSC::HashMapImpl<HashMapBucketType>::findBucketAlreadyHashedAndNormalized): (JSC::HashMapImpl<HashMapBucketType>::rehash): (JSC::HashMapImpl<HashMapBucketType>::makeAndSetNewBuffer): (JSC::HashMapImpl<HashMapBucketType>::assertBufferIsEmpty): (JSC::shouldRehashAfterAdd): Deleted. (JSC::HashMapImpl<HashMapBucketType>::assertBufferIsEmpty const): Deleted. * Source/JavaScriptCore/runtime/JSMap.h: * Source/JavaScriptCore/runtime/JSModuleLoader.cpp: (JSC::JSModuleLoader::finishCreation): * Source/JavaScriptCore/runtime/JSSet.h: * Source/JavaScriptCore/runtime/MapConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/MapPrototype.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/SetConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/SetPrototype.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/WeakMapImplInlines.h: (JSC::WeakMapImpl<WeakMapBucket>::shouldRehashAfterAdd const): * Source/WebCore/bindings/js/JSDOMMapLike.cpp: (WebCore::getBackingMap): * Source/WebCore/bindings/js/JSDOMSetLike.cpp: (WebCore::getBackingSet): * Source/WebCore/bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::deserialize): Canonical link: https://commits.webkit.org/253133@main Canonical link: https://commits.webkit.org/252432.107@safari-7614.1.25.1-branch
- Loading branch information
1 parent
b3b6b3a
commit d4dbf96
Showing
18 changed files
with
170 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
function shouldBe(actual, expected) { | ||
if (actual !== expected) | ||
throw new Error('bad value: ' + actual); | ||
} | ||
|
||
function test(map, key) | ||
{ | ||
return map.get(key); | ||
} | ||
noInline(test); | ||
|
||
var map = new Map(); | ||
for (var i = 0; i < 1e4; ++i) { | ||
map.clear(); | ||
shouldBe(test(map, {}), undefined); | ||
shouldBe(test(map, {t:42}), undefined); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
function shouldBe(actual, expected) { | ||
if (actual !== expected) | ||
throw new Error('bad value: ' + actual); | ||
} | ||
|
||
function test(set, key) | ||
{ | ||
return set.has(key); | ||
} | ||
noInline(test); | ||
|
||
var set = new Set(); | ||
for (var i = 0; i < 1e4; ++i) { | ||
set.clear(); | ||
shouldBe(test(set, {}), false); | ||
shouldBe(test(set, {t:42}), false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.