Ignore:
Timestamp:
Aug 18, 2014, 12:11:41 PM (11 years ago)
Author:
[email protected]
Message:

The parser should generate AST nodes the var declarations with no initializers
https://bugs.webkit.org/show_bug.cgi?id=135545

Patch by Saam Barati <[email protected]> on 2014-08-18
Reviewed by Geoffrey Garen.

Currently, JSC's parser ignores variable declarations
that have no assignment initializer value because all
variables are implicitly assigned to undefined. But,
type profiling needs an AST node to be generated for these
empty variable declarations because it needs to be able to
profile their text locations and to see that their type
is undefined.

  • bytecompiler/NodesCodegen.cpp:

(JSC::EmptyVarExpression::emitBytecode):

  • parser/ASTBuilder.h:

(JSC::ASTBuilder::createVarStatement):
(JSC::ASTBuilder::createEmptyVarExpression):

  • parser/NodeConstructors.h:

(JSC::EmptyVarExpression::EmptyVarExpression):

  • parser/Nodes.h:
  • parser/Parser.cpp:

(JSC::Parser<LexerType>::parseVarDeclarationList):

  • parser/SyntaxChecker.h:

(JSC::SyntaxChecker::createEmptyVarExpression):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/Nodes.h

    r172176 r172717  
    12131213    };
    12141214
     1215    class EmptyVarExpression : public ExpressionNode {
     1216    public:
     1217        EmptyVarExpression(const JSTokenLocation&, const Identifier&);
     1218
     1219    private:
     1220        virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
     1221
     1222        const Identifier& m_ident;
     1223    };
     1224
     1225
    12151226    class IfElseNode : public StatementNode {
    12161227    public:
Note: See TracChangeset for help on using the changeset viewer.