WebKit Bugzilla
Attachment 361375 Details for
Bug 194374
: [JSC] Use BufferInternal single character StringImpl for SmallStrings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194374-20190206205930.patch (text/plain), 4.00 KB, created by
Yusuke Suzuki
on 2019-02-06 20:59:30 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2019-02-06 20:59:30 PST
Size:
4.00 KB
patch
obsolete
>Subversion Revision: 241114 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 9ca525e7f7b1f02d723cf095ae71c5933e011227..97d5bdd9d86c634ddc2f76bebe2df26ef5ff86c9 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,19 @@ >+2019-02-06 Yusuke Suzuki <ysuzuki@apple.com> >+ >+ [JSC] Use BufferInternal single character StringImpl for SmallStrings >+ https://bugs.webkit.org/show_bug.cgi?id=194374 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Currently, we first create a large StringImpl, and create bunch of substrings with length = 1. >+ But pointer is larger than single character. BufferInternal StringImpl with single character >+ is more memory efficient. >+ >+ * runtime/SmallStrings.cpp: >+ (JSC::SmallStringsStorage::SmallStringsStorage): >+ (JSC::SmallStrings::SmallStrings): >+ * runtime/SmallStrings.h: >+ > 2019-02-06 Yusuke Suzuki <ysuzuki@apple.com> > > [JSC] InitializeEntrypointArguments should produce SpecCellCheck if FlushFormat is FlushedCell >diff --git a/Source/JavaScriptCore/runtime/SmallStrings.cpp b/Source/JavaScriptCore/runtime/SmallStrings.cpp >index 60e21b6cf46e13e462358448ff28b7da91422fce..8f26b3e1e2a164e7f3c3347287c0f4e33734747f 100644 >--- a/Source/JavaScriptCore/runtime/SmallStrings.cpp >+++ b/Source/JavaScriptCore/runtime/SmallStrings.cpp >@@ -52,28 +52,18 @@ class SmallStringsStorage { > > SmallStringsStorage::SmallStringsStorage() > { >- LChar* characterBuffer = 0; >- auto baseString = StringImpl::createUninitialized(singleCharacterStringCount, characterBuffer); > for (unsigned i = 0; i < singleCharacterStringCount; ++i) { >- characterBuffer[i] = i; >- m_reps[i] = AtomicStringImpl::add(StringImpl::createSubstringSharingImpl(baseString.get(), i, 1).ptr()); >+ const LChar string[] = { static_cast<LChar>(i) }; >+ m_reps[i] = AtomicStringImpl::add(StringImpl::create(string, 1).ptr()); > } > } > > SmallStrings::SmallStrings() >- : m_emptyString(0) >-#define JSC_COMMON_STRINGS_ATTRIBUTE_INITIALIZE(name) , m_##name(0) >- JSC_COMMON_STRINGS_EACH_NAME(JSC_COMMON_STRINGS_ATTRIBUTE_INITIALIZE) >-#undef JSC_COMMON_STRINGS_ATTRIBUTE_INITIALIZE >- , m_objectStringStart(nullptr) >- , m_nullObjectString(nullptr) >- , m_undefinedObjectString(nullptr) >- , m_needsToBeVisited(true) > { > COMPILE_ASSERT(singleCharacterStringCount == sizeof(m_singleCharacterStrings) / sizeof(m_singleCharacterStrings[0]), IsNumCharactersConstInSyncWithClassUsage); > > for (unsigned i = 0; i < singleCharacterStringCount; ++i) >- m_singleCharacterStrings[i] = 0; >+ m_singleCharacterStrings[i] = nullptr; > } > > void SmallStrings::initializeCommonStrings(VM& vm) >diff --git a/Source/JavaScriptCore/runtime/SmallStrings.h b/Source/JavaScriptCore/runtime/SmallStrings.h >index 8850c4a9a34394f18f75a35d67ba3a45a19fe47e..769d494f320c403eff6f1539e22396f09cf83486 100644 >--- a/Source/JavaScriptCore/runtime/SmallStrings.h >+++ b/Source/JavaScriptCore/runtime/SmallStrings.h >@@ -131,16 +131,16 @@ class SmallStrings { > > void initialize(VM*, JSString*&, const char* value); > >- JSString* m_emptyString; >-#define JSC_COMMON_STRINGS_ATTRIBUTE_DECLARATION(name) JSString* m_##name; >+ JSString* m_emptyString { nullptr }; >+#define JSC_COMMON_STRINGS_ATTRIBUTE_DECLARATION(name) JSString* m_##name { nullptr }; > JSC_COMMON_STRINGS_EACH_NAME(JSC_COMMON_STRINGS_ATTRIBUTE_DECLARATION) > #undef JSC_COMMON_STRINGS_ATTRIBUTE_DECLARATION >- JSString* m_objectStringStart; >- JSString* m_nullObjectString; >- JSString* m_undefinedObjectString; >- JSString* m_singleCharacterStrings[singleCharacterStringCount]; >+ JSString* m_objectStringStart { nullptr }; >+ JSString* m_nullObjectString { nullptr }; >+ JSString* m_undefinedObjectString { nullptr }; >+ JSString* m_singleCharacterStrings[singleCharacterStringCount] { nullptr }; > std::unique_ptr<SmallStringsStorage> m_storage; >- bool m_needsToBeVisited; >+ bool m_needsToBeVisited { true }; > }; > > } // namespace JSC
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
Flags:
ggaren
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194374
: 361375