Bug 194912 - Make JSScript:cacheBytecodeWithError update the cache when the script changes
Summary: Make JSScript:cacheBytecodeWithError update the cache when the script changes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords: InRadar
Depends on: 194517
Blocks:
  Show dependency treegraph
 
Reported: 2019-02-21 12:21 PST by Saam Barati
Modified: 2019-03-01 03:08 PST (History)
14 users (show)

See Also:


Attachments
WIP (20.72 KB, patch)
2019-02-22 16:10 PST, Saam Barati
no flags Details | Formatted Diff | Diff
patch (22.19 KB, patch)
2019-02-22 16:40 PST, Saam Barati
mark.lam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2019-02-21 12:21:08 PST
...
Comment 1 Saam Barati 2019-02-22 13:49:33 PST
gonna look at this now.
Comment 2 Saam Barati 2019-02-22 16:10:46 PST
Created attachment 362778 [details]
WIP
Comment 3 Saam Barati 2019-02-22 16:40:34 PST
Created attachment 362785 [details]
patch
Comment 4 Tadeu Zagallo 2019-02-23 05:01:26 PST
Comment on attachment 362785 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=362785&action=review

Looks good to me. I just have a couple questions that are not directly related to the patch, and the windows build is broken.

> Source/JavaScriptCore/runtime/CachedTypes.cpp:221
> +        , m_baseAddress(bitwise_cast<const uint8_t*>(baseAddress))

This should probably be `static_cast`, no?

> Source/JavaScriptCore/runtime/CachedTypes.cpp:338
> +        return bitwise_cast<const uint8_t*>(this) + m_offset;

why do you need bitwise_cast here instead of reinterpret_cast?

> Source/JavaScriptCore/runtime/CachedTypes.cpp:2164
> +    if (m_cacheVersion != JSC_BYTECODE_CACHE_VERSION)
> +        return false;
> +    if (m_bootSessionUUID.decode(decoder) != bootSessionUUIDString())
> +        return false;

Do you think it's worth moving it into a helper method, since it's done here and in decode?
Comment 5 Saam Barati 2019-02-24 11:47:49 PST
Comment on attachment 362785 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=362785&action=review

>> Source/JavaScriptCore/runtime/CachedTypes.cpp:221
>> +        , m_baseAddress(bitwise_cast<const uint8_t*>(baseAddress))
> 
> This should probably be `static_cast`, no?

yeah it should be

>> Source/JavaScriptCore/runtime/CachedTypes.cpp:338
>> +        return bitwise_cast<const uint8_t*>(this) + m_offset;
> 
> why do you need bitwise_cast here instead of reinterpret_cast?

I like bitwise_cast because of the static assert it does that the from type should be the same size as the to type.

>> Source/JavaScriptCore/runtime/CachedTypes.cpp:2164
>> +        return false;
> 
> Do you think it's worth moving it into a helper method, since it's done here and in decode?

Yeah I do.
Comment 6 Mark Lam 2019-02-25 17:48:34 PST
Comment on attachment 362785 [details]
patch

LGTM
Comment 7 Saam Barati 2019-02-28 15:58:33 PST
landed in:
https://trac.webkit.org/changeset/242239/webkit
Comment 8 Radar WebKit Bug Importer 2019-02-28 15:59:18 PST
<rdar://problem/48492608>
Comment 9 Saam Barati 2019-02-28 17:44:38 PST
Attempting Windows build fix in:
https://trac.webkit.org/changeset/242247/webkit
Comment 10 Dominik Inführ 2019-03-01 02:35:36 PST
Hi, I think that patch broke debug builds with gcc: In Source/JavaScriptCore/runtime/CachedTypes.cpp ASSERT_NOT_REACHED (a non-constexpr function) is invoked from the constexpr-function tagFromSourceCodeType.

See https://trac.webkit.org/browser/webkit/trunk/Source/JavaScriptCore/runtime/CachedTypes.cpp#L1827
Comment 11 Dominik Inführ 2019-03-01 02:44:48 PST
Additional note: With "broken debug build" I meant that compilation is failing on (probably) all architectures (I tested x64 & ARM).
Comment 12 Saam Barati 2019-03-01 02:47:33 PST
(In reply to Dominik Inführ from comment #11)
> Additional note: With "broken debug build" I meant that compilation is
> failing on (probably) all architectures (I tested x64 & ARM).

Can you land a fix to remove constexpr from it? FWIW, clang debug builds I think are fine
Comment 13 Dominik Inführ 2019-03-01 02:59:22 PST
Should we use ASSERT_UNDER_CONSTEXPR_CONTEXT instead?
Comment 14 Dominik Inführ 2019-03-01 03:01:33 PST
Nevermind this isn't building as well...
Comment 15 Dominik Inführ 2019-03-01 03:05:39 PST
Here is the patch for the build issue: https://bugs.webkit.org/show_bug.cgi?id=195205.
Comment 16 Dominik Inführ 2019-03-01 03:08:24 PST
BTW thanks for responding so fast!