Bug 149554 - Add support for WebIDL JSBuiltin attributes
Summary: Add support for WebIDL JSBuiltin attributes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords:
Depends on:
Blocks: 147092
  Show dependency treegraph
 
Reported: 2015-09-25 02:46 PDT by youenn fablet
Modified: 2015-09-29 01:01 PDT (History)
5 users (show)

See Also:


Attachments
Patch (14.84 KB, patch)
2015-09-25 06:41 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (15.23 KB, patch)
2015-09-29 00:13 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2015-09-25 02:46:40 PDT
JSBuiltin is currently only supported for methods.
Comment 1 youenn fablet 2015-09-25 06:41:33 PDT
Created attachment 261922 [details]
Patch
Comment 2 WebKit Commit Bot 2015-09-25 10:47:41 PDT
Attachment 261922 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/Lookup.cpp:39:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/runtime/Lookup.cpp:40:  Wrong number of spaces before statement. (expected: 16)  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/runtime/Lookup.cpp:42:  Wrong number of spaces before statement. (expected: 16)  [whitespace/indent] [4]
Total errors found: 3 in 10 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Xabier Rodríguez Calvar 2015-09-28 02:11:53 PDT
LGTM
Comment 4 Darin Adler 2015-09-28 16:01:42 PDT
Comment on attachment 261922 [details]
Patch

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

> Source/JavaScriptCore/runtime/Lookup.cpp:40
> +        accessor->setGetter(vm, globalObject, value.attributes() & Builtin ?
> +            JSFunction::createBuiltinFunction(vm, value.builtinAccessorGetterGenerator()(vm), globalObject, *getterName) :
> +            JSFunction::create(vm, globalObject, 0, *getterName, value.accessorGetter()));

WebKit coding style formatting for this puts the ? and the : at the beginning of the second and third lines, not the end of the first and second.

> Source/JavaScriptCore/runtime/Lookup.h:82
> +    BuiltinGenerator builtinAccessorGetterGenerator() const { ASSERT(m_attributes & Accessor && m_attributes & Builtin); return reinterpret_cast<BuiltinGenerator>(m_values.value1); }
> +    BuiltinGenerator builtinAccessorSetterGenerator() const { ASSERT(m_attributes & Accessor && m_attributes & Builtin); return reinterpret_cast<BuiltinGenerator>(m_values.value2); }

Normally we’d write these as two separate assertions rather than using &&.
Comment 5 youenn fablet 2015-09-29 00:13:27 PDT
Created attachment 262046 [details]
Patch for landing
Comment 6 youenn fablet 2015-09-29 00:14:53 PDT
Thanks for the review!

(In reply to comment #4)
> Comment on attachment 261922 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=261922&action=review
> 
> > Source/JavaScriptCore/runtime/Lookup.cpp:40
> > +        accessor->setGetter(vm, globalObject, value.attributes() & Builtin ?
> > +            JSFunction::createBuiltinFunction(vm, value.builtinAccessorGetterGenerator()(vm), globalObject, *getterName) :
> > +            JSFunction::create(vm, globalObject, 0, *getterName, value.accessorGetter()));
> 
> WebKit coding style formatting for this puts the ? and the : at the
> beginning of the second and third lines, not the end of the first and second.

Fixed.

> 
> > Source/JavaScriptCore/runtime/Lookup.h:82
> > +    BuiltinGenerator builtinAccessorGetterGenerator() const { ASSERT(m_attributes & Accessor && m_attributes & Builtin); return reinterpret_cast<BuiltinGenerator>(m_values.value1); }
> > +    BuiltinGenerator builtinAccessorSetterGenerator() const { ASSERT(m_attributes & Accessor && m_attributes & Builtin); return reinterpret_cast<BuiltinGenerator>(m_values.value2); }
> 
> Normally we’d write these as two separate assertions rather than using &&.

Fixed by moving the implementation as inline.
Comment 7 WebKit Commit Bot 2015-09-29 01:01:34 PDT
Comment on attachment 262046 [details]
Patch for landing

Clearing flags on attachment: 262046

Committed r190305: <http://trac.webkit.org/changeset/190305>
Comment 8 WebKit Commit Bot 2015-09-29 01:01:41 PDT
All reviewed patches have been landed.  Closing bug.