WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
147742
[ES6] Implement ES6 arrow function syntax. Prototype of arrow function should be undefined
https://bugs.webkit.org/show_bug.cgi?id=147742
Summary
[ES6] Implement ES6 arrow function syntax. Prototype of arrow function should...
GSkachkov
Reported
2015-08-06 13:02:08 PDT
Arrow function should support following condition: var af = ()=>{}; typeof af.prototype === 'undefined';
Attachments
Patch
(11.23 KB, patch)
2015-08-19 08:43 PDT
,
GSkachkov
no flags
Details
Formatted Diff
Diff
Patch
(11.23 KB, patch)
2015-08-19 08:59 PDT
,
GSkachkov
no flags
Details
Formatted Diff
Diff
Patch
(11.28 KB, patch)
2015-08-20 01:03 PDT
,
GSkachkov
no flags
Details
Formatted Diff
Diff
Patch
(9.33 KB, patch)
2015-08-26 03:58 PDT
,
GSkachkov
no flags
Details
Formatted Diff
Diff
Patch
(8.54 KB, patch)
2015-09-03 15:38 PDT
,
GSkachkov
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
GSkachkov
Comment 1
2015-08-19 08:43:07 PDT
Created
attachment 259371
[details]
Patch Implemented feature
GSkachkov
Comment 2
2015-08-19 08:59:25 PDT
Created
attachment 259372
[details]
Patch Upload after rebase
GSkachkov
Comment 3
2015-08-20 01:03:28 PDT
Created
attachment 259456
[details]
Patch Fix build
Filip Pizlo
Comment 4
2015-08-25 14:13:13 PDT
Comment on
attachment 259456
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=259456&action=review
> Source/JavaScriptCore/runtime/JSArrowFunction.cpp:70 > + removeDirect(vm, vm.propertyNames->prototype);
This is not necessary, and it's also quite wrong. It's quite bad to remove properties; it puts the object into a conservative (i.e. slow) mode. Also, there is no way for the object to have a "prototype" property at this point, since it's added lazily.
GSkachkov
Comment 5
2015-08-26 03:58:13 PDT
Created
attachment 259943
[details]
Patch Fix comments
GSkachkov
Comment 6
2015-08-26 06:39:06 PDT
(In reply to
comment #4
)
> Comment on
attachment 259456
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=259456&action=review
> > > Source/JavaScriptCore/runtime/JSArrowFunction.cpp:70 > > + removeDirect(vm, vm.propertyNames->prototype); > > This is not necessary, and it's also quite wrong. It's quite bad to remove > properties; it puts the object into a conservative (i.e. slow) mode. Also, > there is no way for the object to have a "prototype" property at this point, > since it's added lazily.
Hmm, it is really unnecessary. I've removed this code. Could you please make review one more time? Also something wrong with tests during build, because tests don't pass without my patch.
Saam Barati
Comment 7
2015-09-01 16:49:38 PDT
Comment on
attachment 259943
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=259943&action=review
> Source/JavaScriptCore/runtime/JSFunction.cpp:481 > + || (propertyName == exec->propertyNames().prototype && !executable->isArrowFunction())
Why the isArrowFunction check here? If we're an arrow function, don't we want to prevent deletion here?
GSkachkov
Comment 8
2015-09-02 02:51:03 PDT
How I understand this rule: If an arrow function doesn't have own prototype so it can be initialized by custom js code. And if it possible to init this property so there has to be way to delete it. Does it make sense? Possible I need add this to task description or ChangeLog
Saam Barati
Comment 9
2015-09-02 22:39:01 PDT
Comment on
attachment 259943
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=259943&action=review
r=me with comment. If you upload again I'll cq+
> Source/JavaScriptCore/runtime/JSFunction.cpp:361 > if (propertyName == exec->propertyNames().prototype) {
I think this code is more clear if we just check !executable->isArrowFunction() here instead of doing it twice below.
Saam Barati
Comment 10
2015-09-02 22:40:18 PDT
(In reply to
comment #8
)
> How I understand this rule: > If an arrow function doesn't have own prototype so it can be initialized by > custom js code. And if it possible to init this property so there has to be > way to delete it. > Does it make sense? > Possible I need add this to task description or ChangeLog
Okay. I see. So for normal functions, we're definitely not allowed to delete "prototype", but for arrow functions, we start with no prototype, but we're allowed to define one and delete one?
GSkachkov
Comment 11
2015-09-03 15:36:43 PDT
(In reply to
comment #10
)
> (In reply to
comment #8
) > > How I understand this rule: > > If an arrow function doesn't have own prototype so it can be initialized by > > custom js code. And if it possible to init this property so there has to be > > way to delete it. > > Does it make sense? > > Possible I need add this to task description or ChangeLog > > Okay. I see. So for normal functions, we're definitely > not allowed to delete "prototype", but for arrow functions, > we start with no prototype, but we're allowed to define > one and delete one?
Yes, that is correct. I've double checked the es6 spec, and did not find any mention that related to 'prototype' property in arrow function section(14.2), only in "usual" function section(14.1.20 Note 2)
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-definitions-runtime-semantics-evaluation
, so I expect that 'prototype' property of arrow function should behave as ordinary property, in contrast with 'prototype' property of "usual" function that automatically created, can be changed, but can't be deleted.
GSkachkov
Comment 12
2015-09-03 15:38:36 PDT
Created
attachment 260532
[details]
Patch Increate code readability
Saam Barati
Comment 13
2015-09-03 23:12:27 PDT
Comment on
attachment 260532
[details]
Patch LGTM
WebKit Commit Bot
Comment 14
2015-09-03 23:58:46 PDT
Comment on
attachment 260532
[details]
Patch Clearing flags on attachment: 260532 Committed
r189341
: <
http://trac.webkit.org/changeset/189341
>
WebKit Commit Bot
Comment 15
2015-09-03 23:58:51 PDT
All reviewed patches have been landed. Closing bug.
Csaba Osztrogonác
Comment 16
2015-09-04 02:32:03 PDT
(In reply to
comment #14
)
> Comment on
attachment 260532
[details]
> Patch > > Clearing flags on attachment: 260532 > > Committed
r189341
: <
http://trac.webkit.org/changeset/189341
>
es6.yaml/es6/arrow_functions_no_prototype_property.js.default fails on all JSC tester bot, please check what happened. Don't you run JSC tests before commiting a patch?
Alexey Proskuryakov
Comment 17
2015-09-04 09:09:37 PDT
Is anyone available to fix this soon? If not, I'm going to roll out the patch.
Basile Clement
Comment 18
2015-09-04 09:33:33 PDT
This patch actually made the test pass, but it is marked as "must fail" in the harness.
r189350
<
http://trac.webkit.org/changeset/189350
> marks the test as "must succeed".
Alexey Proskuryakov
Comment 19
2015-09-04 10:18:47 PDT
Thank you Basile!
GSkachkov
Comment 20
2015-09-04 22:20:57 PDT
Basile Clemen Thank you for the fix. I'll try to avoid such think in future!(Run all tests on the lastest jsc version)
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug