WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
154604
Function.name and Function.length should be configurable.
https://bugs.webkit.org/show_bug.cgi?id=154604
Summary
Function.name and Function.length should be configurable.
Mark Lam
Reported
2016-02-23 13:49:20 PST
According to
https://tc39.github.io/ecma262/#sec-ecmascript-language-functions-and-classes
, "Unless otherwise specified, the name property of a built-in Function object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }."
Attachments
work in progress: changed 'name' and 'length' properties to be reified on access.
(11.89 KB, patch)
2016-02-25 13:44 PST
,
Mark Lam
no flags
Details
Formatted Diff
Diff
proposed patch.
(222.44 KB, patch)
2016-02-26 11:49 PST
,
Mark Lam
no flags
Details
Formatted Diff
Diff
proposed patch: rebased.
(222.44 KB, patch)
2016-02-26 11:53 PST
,
Mark Lam
saam
: review+
Details
Formatted Diff
Diff
proposed patch 2: addressed Saam's feedback w/ new test.
(224.53 KB, patch)
2016-02-26 14:19 PST
,
Mark Lam
saam
: review+
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2016-02-23 13:51:50 PST
<
rdar://problem/24799540
>
Mark Lam
Comment 2
2016-02-25 13:44:43 PST
Created
attachment 272233
[details]
work in progress: changed 'name' and 'length' properties to be reified on access.
Mark Lam
Comment 3
2016-02-26 11:48:11 PST
https://tc39.github.io/ecma262/#sec-ecmascript-language-functions-and-classe
also says "the length property of a built-in Function object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }."
Mark Lam
Comment 4
2016-02-26 11:49:38 PST
Created
attachment 272353
[details]
proposed patch.
Mark Lam
Comment 5
2016-02-26 11:53:22 PST
Created
attachment 272354
[details]
proposed patch: rebased.
Saam Barati
Comment 6
2016-02-26 12:31:02 PST
Comment on
attachment 272354
[details]
proposed patch: rebased. View in context:
https://bugs.webkit.org/attachment.cgi?id=272354&action=review
r=me with comment
> Source/JavaScriptCore/runtime/JSFunction.cpp:522 > + if (propertyName == exec->propertyNames().length) > + thisObject->reifyLengthIfNeeded(exec); > + else if (propertyName == exec->propertyNames().name) > + thisObject->reifyNameIfNeeded(exec);
This code is repeated a lot. It might be worth having an inlined helper here that reifies if necessary. You could call it reifyIfNecessary(PropertyName) or something.
Saam Barati
Comment 7
2016-02-26 12:31:44 PST
It might be worth adding some tests that will gracefully handle structure transitions after reification.
Saam Barati
Comment 8
2016-02-26 12:40:39 PST
It's also worth adding tests that do indeed verify that the property is configurable.
Mark Lam
Comment 9
2016-02-26 14:19:48 PST
Created
attachment 272371
[details]
proposed patch 2: addressed Saam's feedback w/ new test.
Mark Lam
Comment 10
2016-02-26 14:31:15 PST
Thanks for the review. Landed in
r197205
: <
http://trac.webkit.org/r197205
>.
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