WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
155336
Implement Function.name and Function#toString for ES6 class.
https://bugs.webkit.org/show_bug.cgi?id=155336
Summary
Implement Function.name and Function#toString for ES6 class.
Mark Lam
Reported
2016-03-10 16:22:33 PST
Patch coming.
Attachments
proposed patch.
(62.31 KB, patch)
2016-03-11 06:56 PST
,
Mark Lam
mark.lam
: commit-queue-
Details
Formatted Diff
Diff
proposed patch with more tests, some additional comments, + darin's feedback.
(69.19 KB, patch)
2016-03-11 12:59 PST
,
Mark Lam
no flags
Details
Formatted Diff
Diff
diff of the old patch vs the current one: for your reviewing convenience.
(11.84 KB, text/plain)
2016-03-11 13:00 PST
,
Mark Lam
no flags
Details
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2016-03-10 16:23:27 PST
<
rdar://problem/25098147
>
Mark Lam
Comment 2
2016-03-11 06:56:52 PST
Created
attachment 273725
[details]
proposed patch. Still need to run benchmarks. This patch has passed the JSC and layout tests.
Geoffrey Garen
Comment 3
2016-03-11 09:17:17 PST
Comment on
attachment 273725
[details]
proposed patch. r=me
Saam Barati
Comment 4
2016-03-11 09:23:39 PST
Comment on
attachment 273725
[details]
proposed patch. View in context:
https://bugs.webkit.org/attachment.cgi?id=273725&action=review
> Source/JavaScriptCore/runtime/Executable.cpp:513 > + m_classSource = unlinkedExecutable->classSource();
Is this correct with code caching? Is it possible to construct a conflict here where we get instantiated with an unlinked code block that isn't from a class constructor?
Mark Lam
Comment 5
2016-03-11 09:25:27 PST
Comment on
attachment 273725
[details]
proposed patch. Let me double check the UnlinkedFunctionExecutable caching issue.
Saam Barati
Comment 6
2016-03-11 09:27:48 PST
To me it seems like we could construct the same exact normal "function(){...}" function, call new on it, and then have a class' constructor be the same source code, and get a conflict. I don't remember exactly how the hash is determined, but it seems possible that this could happen.
Saam Barati
Comment 7
2016-03-11 09:38:00 PST
(In reply to
comment #6
)
> To me it seems like we could construct the same exact > normal "function(){...}" function, call new on it, and then > have a class' constructor be the same source code, and get a > conflict. I don't remember exactly how the hash is determined, > but it seems possible that this could happen.
Or even two different classes with the same constructor
Mark Lam
Comment 8
2016-03-11 09:48:30 PST
(In reply to
comment #7
)
> (In reply to
comment #6
) > > To me it seems like we could construct the same exact > > normal "function(){...}" function, call new on it, and then > > have a class' constructor be the same source code, and get a > > conflict. I don't remember exactly how the hash is determined, > > but it seems possible that this could happen. > > Or even two different classes with the same constructor
I'm aware of the theoretical issue, but testing shows that there's no issue. I'll dig into the code a bit and will update later with reasons why there is / isn't an issue.
Darin Adler
Comment 9
2016-03-11 12:47:31 PST
Comment on
attachment 273725
[details]
proposed patch. View in context:
https://bugs.webkit.org/attachment.cgi?id=273725&action=review
> Source/JavaScriptCore/parser/ParserFunctionInfo.h:46 > const Identifier* className = 0;
nullptr
> Source/JavaScriptCore/parser/ParserFunctionInfo.h:50 > + unsigned startOffset = 0; > + unsigned endOffset = 0; > + int startLine = 0; > + unsigned startColumn = 0;
In other WebKit code we have been using the brace syntax: unsigned startOffset { 0 }; Not sure it’s better, but it would be nice to be consistent in style.
Mark Lam
Comment 10
2016-03-11 12:59:15 PST
Created
attachment 273755
[details]
proposed patch with more tests, some additional comments, + darin's feedback. I investigated the potential code caching issue, and concluded that there is no issue. This is because we currently only do caching of unlinked executables for global programs or dynamically created functions via the Function constructor. Class constructors are not cached, and hence, it is safe to stash the class source in its unlinked function executable. function-toString-vs-name.js already tests for this caching behavior, and I've also added some additional tests to check for global, eval, and Function constructor cases in this revised patch. If the code caching behavior changes in the future, the tests in function-toString-vs-name.js will catch it.
Mark Lam
Comment 11
2016-03-11 13:00:09 PST
Created
attachment 273757
[details]
diff of the old patch vs the current one: for your reviewing convenience.
Mark Lam
Comment 12
2016-03-11 13:02:10 PST
Comment on
attachment 273755
[details]
proposed patch with more tests, some additional comments, + darin's feedback. Saam tells me (offline) that he doesn't think this need additional review. Will land.
Mark Lam
Comment 13
2016-03-11 13:08:42 PST
Thanks for all the reviews. Landed in
r198042
: <
http://trac.webkit.org/r198042
>.
Ryosuke Niwa
Comment 14
2016-03-30 22:50:26 PDT
***
Bug 144285
has been marked as a duplicate of this bug. ***
Joseph Pecoraro
Comment 15
2016-06-06 20:39:35 PDT
***
Bug 149743
has been marked as a duplicate of this bug. ***
Jordan Harband
Comment 16
2016-06-06 23:23:32 PDT
***
Bug 149743
has been marked as a duplicate of this bug. ***
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