Bug 198482

Summary: JSScript should not keep bytecode cache in memory
Product: WebKit Reporter: Tadeu Zagallo <tzagallo>
Component: JavaScriptCoreAssignee: Tadeu Zagallo <tzagallo>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, fpizlo, keith_miller, mark.lam, msaboff, rmorisset, saam, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch for landing none

Description Tadeu Zagallo 2019-06-03 05:31:55 PDT
...
Comment 1 Tadeu Zagallo 2019-06-03 05:41:06 PDT
Created attachment 371185 [details]
Patch
Comment 2 Tadeu Zagallo 2019-06-03 07:06:04 PDT
Created attachment 371189 [details]
Patch

Fix windows build
Comment 3 Saam Barati 2019-06-03 13:40:54 PDT
Comment on attachment 371189 [details]
Patch

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

r=me

> Source/JavaScriptCore/runtime/CachedTypes.cpp:176
> +    Ref<CachedBytecode> releaseMapped(BytecodeCacheError& error)

Kinda weird this returns ref instead of ptr. Why not RefPtr and make nullptr mean there was an error? I feel like it's weird to construct an empty CachedBytecode here.

> Source/JavaScriptCore/runtime/CachedTypes.cpp:180
> +            error.standardError(errno);

nit: This style feels kinda weird. Why not just make error something you assign to? And by default it's empty? And you can make this a static function that is a factory constructor. I feel like that's more in line with the style of error handling I've seen elsewhere in WK. So something like:
```
error = BytecodeCacheError::standardError(errno)
return nullptr 
```

> Source/JavaScriptCore/runtime/CachedTypes.cpp:2411
> +    Encoder encoder(vm, -1);

You could also make -1 the default argument of this function.
Comment 4 Tadeu Zagallo 2019-06-04 03:28:39 PDT
Created attachment 371264 [details]
Patch for landing
Comment 5 WebKit Commit Bot 2019-06-04 04:14:16 PDT
Comment on attachment 371264 [details]
Patch for landing

Clearing flags on attachment: 371264

Committed r246060: <https://trac.webkit.org/changeset/246060>
Comment 6 WebKit Commit Bot 2019-06-04 04:14:18 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2019-06-04 04:15:21 PDT
<rdar://problem/51392697>