Bug 117614

Summary: Function names on Object.prototype should be common identifiers
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: New BugsAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Fixes the bug darin: review+

Description Ryosuke Niwa 2013-06-13 16:11:54 PDT
Function names on Object.prototype should be common identifiers
Comment 1 Ryosuke Niwa 2013-06-13 16:17:06 PDT
Created attachment 204649 [details]
Fixes the bug
Comment 2 Darin Adler 2013-06-13 17:39:11 PDT
Comment on attachment 204649 [details]
Fixes the bug

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

> Source/JavaScriptCore/runtime/JSObject.h:1472
> +#define JSC_NATIVE_INTRINSIC_FUNCTION_IDENT(jsName, cppName, attributes, length, intrinsic) \

We can do this without a second macro. We just need this inline function:

    inline Identifier makeIdentifier(ExecState* exec, const char* name)
    {
        return Identifier(exec, name);
    }

    inline Identifier makeIdentifier(ExecState*, const Identifier& identifier)
    {
        return identifier;
    }

Then change the existing macro to use this function instead of calling the Identifier constructor directly. I’d love to not add a new macro. I also have no idea why this is a macro instead of an inline function in the first place.
Comment 3 Ryosuke Niwa 2013-06-14 13:36:14 PDT
Comment on attachment 204649 [details]
Fixes the bug

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

>> Source/JavaScriptCore/runtime/JSObject.h:1472
>> +#define JSC_NATIVE_INTRINSIC_FUNCTION_IDENT(jsName, cppName, attributes, length, intrinsic) \
> 
> We can do this without a second macro. We just need this inline function:
> 
>     inline Identifier makeIdentifier(ExecState* exec, const char* name)
>     {
>         return Identifier(exec, name);
>     }
> 
>     inline Identifier makeIdentifier(ExecState*, const Identifier& identifier)
>     {
>         return identifier;
>     }
> 
> Then change the existing macro to use this function instead of calling the Identifier constructor directly. I’d love to not add a new macro. I also have no idea why this is a macro instead of an inline function in the first place.

Done.
Comment 4 Ryosuke Niwa 2013-06-14 13:36:41 PDT
Committed r151605: <http://trac.webkit.org/changeset/151605>