Bug 183746

Summary: FunctionPtr should be passed by value.
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, fpizlo, jfbastien, keith_miller, msaboff, rmorisset, saam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
proposed patch.
jfbastien: review+, mark.lam: commit-queue-
patch for landing. none

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.