WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
144602
[Content Extensions] Use less memory when writing byte code to file
https://bugs.webkit.org/show_bug.cgi?id=144602
Summary
[Content Extensions] Use less memory when writing byte code to file
Alex Christensen
Reported
2015-05-04 15:55:20 PDT
Right now we keep several copies of all the data in memory at the same time. We only need one copy of one DFA's byte code alive at a time.
Attachments
Patch
(12.80 KB, patch)
2015-05-04 15:57 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(19.05 KB, patch)
2015-05-04 16:55 PDT
,
Alex Christensen
darin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Alex Christensen
Comment 1
2015-05-04 15:57:22 PDT
Created
attachment 252343
[details]
Patch
Darin Adler
Comment 2
2015-05-04 16:04:09 PDT
Comment on
attachment 252343
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=252343&action=review
> Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp:77 > +const size_t ContentExtensionFileHeaderSize = sizeof(uint32_t) + 2 * sizeof(uint64_t);
Why do this instead of sizeof(ContentExtensionMetaData)? Because of alignment, I suspect the expression above will be wrong.
Alex Christensen
Comment 3
2015-05-04 16:06:01 PDT
Comment on
attachment 252343
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=252343&action=review
>> Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp:77 >> +const size_t ContentExtensionFileHeaderSize = sizeof(uint32_t) + 2 * sizeof(uint64_t); > > Why do this instead of sizeof(ContentExtensionMetaData)? Because of alignment, I suspect the expression above will be wrong.
When writing the header, we only want to write 20 bytes. Otherwise we would be writing uninitialized memory to file.
Alex Christensen
Comment 4
2015-05-04 16:55:39 PDT
Created
attachment 252355
[details]
Patch
Darin Adler
Comment 5
2015-05-05 09:07:52 PDT
Comment on
attachment 252355
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=252355&action=review
> Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp:84 > static Data encodeContentExtensionMetaData(const ContentExtensionMetaData& metaData)
I think you want to add this to the end of this function: ASSERT(encoder.bufferSize() == ContentExtensionFileHeaderSize);
> Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp:218 > + memset(invalidHeader, 0xff, sizeof(invalidHeader));
We normally use capitalized hex, 0xFF, in WebKit code.
Alex Christensen
Comment 6
2015-05-05 10:14:43 PDT
http://trac.webkit.org/changeset/183817
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug