WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
194675
Move bytecode cache-related filesystem code out of CodeCache
https://bugs.webkit.org/show_bug.cgi?id=194675
Summary
Move bytecode cache-related filesystem code out of CodeCache
Tadeu Zagallo
Reported
2019-02-14 14:37:07 PST
That code is only used for the bytecode-cache tests, so it should probably live in jsc.cpp rather than in the CodeCache.
Attachments
Patch
(11.64 KB, patch)
2019-02-14 14:46 PST
,
Tadeu Zagallo
no flags
Details
Formatted Diff
Diff
Patch
(12.26 KB, patch)
2019-02-15 03:07 PST
,
Tadeu Zagallo
no flags
Details
Formatted Diff
Diff
Patch
(12.28 KB, patch)
2019-02-15 04:52 PST
,
Tadeu Zagallo
no flags
Details
Formatted Diff
Diff
Patch
(13.07 KB, patch)
2019-02-18 01:39 PST
,
Tadeu Zagallo
no flags
Details
Formatted Diff
Diff
Patch
(13.10 KB, patch)
2019-02-18 02:42 PST
,
Tadeu Zagallo
no flags
Details
Formatted Diff
Diff
Patch
(12.95 KB, patch)
2019-02-18 13:20 PST
,
Tadeu Zagallo
no flags
Details
Formatted Diff
Diff
Patch for landing
(13.11 KB, patch)
2019-02-19 01:26 PST
,
Tadeu Zagallo
no flags
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Tadeu Zagallo
Comment 1
2019-02-14 14:46:15 PST
Created
attachment 362064
[details]
Patch
Saam Barati
Comment 2
2019-02-14 15:41:35 PST
Comment on
attachment 362064
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=362064&action=review
This is a nice improvement, but I have one comment. Also you probably need to comment out more code on non-darwin platforms.
> Source/JavaScriptCore/runtime/CodeCache.cpp:206 > + CachedBytecode cachedBytecode { WTFMove(result.first), result.second }; > + key.source().provider().cacheBytecode(cachedBytecode);
Seems weird to have this function predicated on the cachePath above. Why not just make source provider tell you if it can cache or not?
Saam Barati
Comment 3
2019-02-14 15:42:04 PST
Comment on
attachment 362064
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=362064&action=review
> Source/JavaScriptCore/ChangeLog:8 > + That code is only used for the bytecode-cache tests, so it should probably
no "probably"
> Source/JavaScriptCore/jsc.cpp:957 > +class CliSourceProvider : public StringSourceProvider {
I'd just call this "ShellSourceProvider" or "CommandLineSourceProvider"
Tadeu Zagallo
Comment 4
2019-02-15 03:07:19 PST
Created
attachment 362108
[details]
Patch
Tadeu Zagallo
Comment 5
2019-02-15 03:07:42 PST
Comment on
attachment 362064
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=362064&action=review
>> Source/JavaScriptCore/runtime/CodeCache.cpp:206 >> + key.source().provider().cacheBytecode(cachedBytecode); > > Seems weird to have this function predicated on the cachePath above. Why not just make source provider tell you if it can cache or not?
Oops, this was an oversight. It shouldn't be darwin-specific either.
Tadeu Zagallo
Comment 6
2019-02-15 04:52:34 PST
Created
attachment 362111
[details]
Patch
WebKit Commit Bot
Comment 7
2019-02-15 13:28:00 PST
Comment on
attachment 362111
[details]
Patch Clearing flags on attachment: 362111 Committed
r241612
: <
https://trac.webkit.org/changeset/241612
>
WebKit Commit Bot
Comment 8
2019-02-15 13:28:01 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9
2019-02-15 13:28:27 PST
<
rdar://problem/48122052
>
Saam Barati
Comment 10
2019-02-17 10:09:10 PST
Comment on
attachment 362111
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=362111&action=review
> Source/JavaScriptCore/runtime/CodeCache.cpp:199 > std::pair<MallocPtr<uint8_t>, size_t> result = encodeCodeBlock(vm, key, codeBlock);
This patch made it so that we're now eagerly encoding CodeBlocks even if we can't cache it. And we're doing it as we remove entries from the cache. That's not the behavior we want
WebKit Commit Bot
Comment 11
2019-02-17 10:10:06 PST
Re-opened since this is blocked by
bug 194762
Tadeu Zagallo
Comment 12
2019-02-17 10:30:41 PST
(In reply to Saam Barati from
comment #10
)
> Comment on
attachment 362111
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=362111&action=review
> > > Source/JavaScriptCore/runtime/CodeCache.cpp:199 > > std::pair<MallocPtr<uint8_t>, size_t> result = encodeCodeBlock(vm, key, codeBlock); > > This patch made it so that we're now eagerly encoding CodeBlocks even if we > can't cache it. And we're doing it as we remove entries from the cache. > That's not the behavior we want
Oops, that's not good... I'll upload a correct patch soon.
Tadeu Zagallo
Comment 13
2019-02-18 01:39:21 PST
Created
attachment 362271
[details]
Patch
Tadeu Zagallo
Comment 14
2019-02-18 01:43:56 PST
I attached the new patch, which now has SourceProvider::useBytecodeCache to avoid the wasteful computations. I also merged the `flock` flags into `open` and added the `makeScopeExit` as Saam suggested in
https://bugs.webkit.org/show_bug.cgi?id=194768
.
Tadeu Zagallo
Comment 15
2019-02-18 02:42:04 PST
Created
attachment 362281
[details]
Patch Rebase
Saam Barati
Comment 16
2019-02-18 11:35:56 PST
Comment on
attachment 362281
[details]
Patch r=me. I think you need to also return true for useBytecodeCache in JSScriptSourceProvider
Tadeu Zagallo
Comment 17
2019-02-18 12:34:04 PST
(In reply to Saam Barati from
comment #16
)
> Comment on
attachment 362281
[details]
> Patch > > r=me. I think you need to also return true for useBytecodeCache in > JSScriptSourceProvider
Good point. I'll update it. Thanks!
Tadeu Zagallo
Comment 18
2019-02-18 13:20:38 PST
Created
attachment 362322
[details]
Patch
Tadeu Zagallo
Comment 19
2019-02-18 13:25:39 PST
(In reply to Tadeu Zagallo from
comment #17
)
> (In reply to Saam Barati from
comment #16
) > > Comment on
attachment 362281
[details]
> > Patch > > > > r=me. I think you need to also return true for useBytecodeCache in > > JSScriptSourceProvider > > Good point. I'll update it. Thanks!
When I went to update JSScriptSourceProvider, I realized that we would still unnecessarily encode all the CodeBlocks for it, since it'd return `true` from `useBytecodeCache` in order to be able to provide a cache, but it never writes through the `cacheBytecode` callback. I changed `cacheBytecode` to take a function that generates the cached bytecode, so I put it up for review again just in case.
Saam Barati
Comment 20
2019-02-18 15:07:36 PST
Comment on
attachment 362322
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=362322&action=review
r=me
> Source/JavaScriptCore/ChangeLog:9 > + That code is only used for the bytecode-cache tests, so it should live in > + jsc.cpp rather than in the CodeCache.
You should make a couple comments about how this changes the interface for caching.
> Source/JavaScriptCore/parser/SourceProvider.h:120 > + virtual void cacheBytecode(const BytecodeCacheGenerator&) const { }
I agree this is nicer than the canCache and solves the issue you found.
> Source/JavaScriptCore/runtime/CodeCache.cpp:202 > + key.source().provider().cacheBytecode([&]() {
style nit: no need for "()"
Tadeu Zagallo
Comment 21
2019-02-19 01:26:19 PST
Created
attachment 362374
[details]
Patch for landing
WebKit Commit Bot
Comment 22
2019-02-19 02:04:58 PST
Comment on
attachment 362374
[details]
Patch for landing Clearing flags on attachment: 362374 Committed
r241758
: <
https://trac.webkit.org/changeset/241758
>
WebKit Commit Bot
Comment 23
2019-02-19 02:05:00 PST
All reviewed patches have been landed. Closing bug.
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