Bug 154982 - JSArrayBuffers should be collected less aggressively
Summary: JSArrayBuffers should be collected less aggressively
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Keith Miller
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-03 14:20 PST by Keith Miller
Modified: 2016-03-03 19:19 PST (History)
4 users (show)

See Also:


Attachments
Patch (19.06 KB, patch)
2016-03-03 14:34 PST, Keith Miller
no flags Details | Formatted Diff | Diff
Patch (19.72 KB, patch)
2016-03-03 16:33 PST, Keith Miller
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Miller 2016-03-03 14:20:54 PST
JSArrayBuffers should be collected less aggressively
Comment 1 Keith Miller 2016-03-03 14:34:37 PST
Created attachment 272777 [details]
Patch
Comment 2 Geoffrey Garen 2016-03-03 15:48:20 PST
Comment on attachment 272777 [details]
Patch

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

> Source/JavaScriptCore/runtime/JSArrayBuffer.h:43
> +    enum class WrapperMode {
> +        Wrap,
> +        DontWrap
> +    };

Let's not do these modes just to avoid one virtual function call -- unless you have some benchmark data that says we need to. We're already on the slow path, so the goal is to be reliable, understandable, and correct.

> Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h:-439
> -        RELEASE_ASSERT(thisObject->existingBufferInButterfly());

Why isn't this ASSERT valid? This is the kind of thing you should explain in the ChangeLog.

> Source/JavaScriptCore/runtime/SimpleTypedArrayController.h:52
> +    virtual void registerWrapper(JSGlobalObject*, ArrayBuffer*, JSArrayBuffer*) override;

Please update the comment above about "and it didn't die" -- that's not really how this works anymore.

> Source/WebCore/bindings/js/JSDOMBinding.h:-412
> -    buffer->ref();

You should explain in the ChangeLog that this ref() was balanced by a deref() in finalize(), but both were unnecessary because...

What is the other mechanism that manages this lifetime?
Comment 3 Keith Miller 2016-03-03 16:33:17 PST
Created attachment 272795 [details]
Patch
Comment 4 Geoffrey Garen 2016-03-03 16:46:37 PST
Comment on attachment 272795 [details]
Patch

r=me
Comment 5 WebKit Commit Bot 2016-03-03 19:19:03 PST
Comment on attachment 272795 [details]
Patch

Clearing flags on attachment: 272795

Committed r197543: <http://trac.webkit.org/changeset/197543>
Comment 6 WebKit Commit Bot 2016-03-03 19:19:06 PST
All reviewed patches have been landed.  Closing bug.