WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
135545
The parser should generate AST nodes the var declarations with no initializers
https://bugs.webkit.org/show_bug.cgi?id=135545
Summary
The parser should generate AST nodes the var declarations with no initializers
Saam Barati
Reported
2014-08-02 15:49:30 PDT
Currently, when the parser is parsing a variable declaration list and sees a var declarator without an initializer, it just adds the variable name to the environment in the parsing context, but does not actually create an AST node when there is no initializer. Because it doesn't create an AST node, the helper function that calls this parsing method may emit an EmptyExpression AST node, or may emit a CommaNode where there aren't nodes in the CommaNode representing empty initializers. We should emit an AST node here that represents declaring variables without initializers because it gives high fidelity type profiling the opportunity to emit code that observes this variable.
Attachments
work in progress
(7.87 KB, patch)
2014-08-02 16:09 PDT
,
Saam Barati
ggaren
: review-
Details
Formatted Diff
Diff
patch
(8.56 KB, patch)
2014-08-15 16:43 PDT
,
Saam Barati
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Saam Barati
Comment 1
2014-08-02 16:09:54 PDT
Created
attachment 235940
[details]
work in progress What do you guys think of this patch?
Geoffrey Garen
Comment 2
2014-08-04 15:20:04 PDT
Comment on
attachment 235940
[details]
work in progress View in context:
https://bugs.webkit.org/attachment.cgi?id=235940&action=review
I think this approach is good. Some edits are in order.
> Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:1789 > + generator.emitDebugHook(WillExecuteStatement, lineNo(), startOffset(), lineStartOffset());
This seems like it might be too much debug hook. Now, we'll have two debug hooks for the statement "var x;": one for the VarStatementNode, and one for the EmptyVarExpressionNode. Probably the right thing to do is not to debug hook here, since usually only statements debug hook, and we don't stop the debugger in the middle of expressions.
> Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:1791 > + if (generator.isProfilingTypesWithHighFidelity()) {
It's nice to make this a "not" check followed by early return. That way, the rest of the code doesn't have to indent, and you rarely get super-indented code.
> Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:1796 > + //RegisterID* finalDest = generator.finalDestination(dst);
Nix this.
> Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:1804 > + // It's safe to return null here because this node will always be part of VarStatementNode which ignores our return value.
"part of" => "a child node of"
> Source/JavaScriptCore/parser/ASTBuilder.h:649 > - > +
Revert whitespace change please.
Saam Barati
Comment 3
2014-08-15 16:43:14 PDT
Created
attachment 236691
[details]
patch Patch with Geoff's suggestions.
Geoffrey Garen
Comment 4
2014-08-18 11:39:25 PDT
Comment on
attachment 236691
[details]
patch r=me
WebKit Commit Bot
Comment 5
2014-08-18 12:11:55 PDT
Comment on
attachment 236691
[details]
patch Clearing flags on attachment: 236691 Committed
r172717
: <
http://trac.webkit.org/changeset/172717
>
WebKit Commit Bot
Comment 6
2014-08-18 12:11:58 PDT
All reviewed patches have been landed. Closing 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