Bug 183746 - FunctionPtr should be passed by value.
Summary: FunctionPtr should be passed by value.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-03-19 10:52 PDT by Mark Lam
Modified: 2018-03-19 13:22 PDT (History)
8 users (show)

See Also:


Attachments
proposed patch. (11.03 KB, patch)
2018-03-19 11:02 PDT, Mark Lam
jfbastien: review+
mark.lam: commit-queue-
Details | Formatted Diff | Diff
patch for landing. (11.09 KB, patch)
2018-03-19 12:45 PDT, Mark Lam
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2018-03-19 10:52:53 PDT
It's meant to be an encapsulation of a C/C++ function pointer.  There's no need to pass it by reference.
Comment 1 Radar WebKit Bug Importer 2018-03-19 10:53:25 PDT
<rdar://problem/38625311>
Comment 2 Mark Lam 2018-03-19 11:02:04 PDT
Created attachment 336056 [details]
proposed patch.
Comment 3 JF Bastien 2018-03-19 11:06:38 PDT
Comment on attachment 336056 [details]
proposed patch.

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

r=me with suggested assert.

> Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h:129
> +static_assert(sizeof(FunctionPtr) == sizeof(void*), "");

You probably also want std::is_trivially_copyable<FunctionPtr>::value so that passing it by values is just a register thing.
Comment 4 Mark Lam 2018-03-19 12:45:01 PDT
Created attachment 336069 [details]
patch for landing.
Comment 5 WebKit Commit Bot 2018-03-19 13:22:35 PDT
Comment on attachment 336069 [details]
patch for landing.

Clearing flags on attachment: 336069

Committed r229709: <https://trac.webkit.org/changeset/229709>
Comment 6 WebKit Commit Bot 2018-03-19 13:22:36 PDT
All reviewed patches have been landed.  Closing bug.