WebKit Bugzilla
Attachment 362705 Details for
Bug 194937
: Avoid hashing CompactVariableEnvironment when decoding CompactVariableMap::Handle
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194937-20190222095847.patch (text/plain), 2.98 KB, created by
Tadeu Zagallo
on 2019-02-22 00:59:26 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tadeu Zagallo
Created:
2019-02-22 00:59:26 PST
Size:
2.98 KB
patch
obsolete
>Subversion Revision: 241937 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 2c212dd8852421f0dadb6c8b8b6e9de5a2a0fdd4..d9b8a81b602c0c6bb9d61293d5b5eca02bffabc0 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,19 @@ >+2019-02-22 Tadeu Zagallo <tzagallo@apple.com> >+ >+ Avoid hashing CompactVariableEnvironment when decoding CompactVariableMap::Handle >+ https://bugs.webkit.org/show_bug.cgi?id=194937 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Hashing the CompactVariableEnvironment is expensive and we could avoid it >+ when decoding multiple handles to the same environment. This is sound because >+ a pointer to the same CompactVariableEnvironment will hash the same. >+ >+ * runtime/CachedTypes.cpp: >+ (JSC::Decoder::handleForEnvironment const): >+ (JSC::Decoder::setHandleForEnvironment): >+ (JSC::CachedCompactVariableMapHandle::decode const): >+ > 2019-02-22 Tadeu Zagallo <tzagallo@apple.com> > > Remove unnecessary WTF:: prefixes in CachedTypes >diff --git a/Source/JavaScriptCore/runtime/CachedTypes.cpp b/Source/JavaScriptCore/runtime/CachedTypes.cpp >index a87adc7ccb7ec4607061c763f3b433220fd04431..9942993451fb1f91f014ff462c0033205b2157ce 100644 >--- a/Source/JavaScriptCore/runtime/CachedTypes.cpp >+++ b/Source/JavaScriptCore/runtime/CachedTypes.cpp >@@ -259,6 +259,19 @@ public: > m_finalizers.append(finalizer); > } > >+ CompactVariableMap::Handle handleForEnvironment(CompactVariableEnvironment* environment) const >+ { >+ auto it = m_environmentToHandleMap.find(environment); >+ ASSERT(it != m_environmentToHandleMap.end()); >+ return it->value; >+ } >+ >+ void setHandleForEnvironment(CompactVariableEnvironment* environment, const CompactVariableMap::Handle& handle) >+ { >+ auto addResult = m_environmentToHandleMap.add(environment, handle); >+ ASSERT_UNUSED(addResult, addResult.isNewEntry); >+ } >+ > private: > VM& m_vm; > const uint8_t* m_baseAddress; >@@ -267,6 +280,7 @@ private: > #endif > HashMap<ptrdiff_t, void*> m_offsetToPtrMap; > Vector<std::function<void()>> m_finalizers; >+ HashMap<CompactVariableEnvironment*, CompactVariableMap::Handle> m_environmentToHandleMap; > }; > > template<typename T> >@@ -938,15 +952,16 @@ public: > { > bool isNewAllocation; > CompactVariableEnvironment* environment = m_environment.decode(decoder, isNewAllocation); >+ if (!isNewAllocation) >+ return decoder.handleForEnvironment(environment); > bool isNewEntry; > CompactVariableMap::Handle handle = decoder.vm().m_compactVariableMap->get(environment, isNewEntry); >- if (!isNewAllocation) >- ASSERT(!isNewEntry); >- else if (!isNewEntry) { >+ if (!isNewEntry) { > decoder.addFinalizer([=] { > delete environment; > }); > } >+ decoder.setHandleForEnvironment(environment, handle); > return handle; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194937
:
362705
|
362908