Ignore:
Timestamp:
Apr 4, 2013, 4:16:20 PM (12 years ago)
Author:
[email protected]
Message:

Stop pretending that statements return a value
https://bugs.webkit.org/show_bug.cgi?id=113969

Reviewed by Oliver Hunt.

Expressions have an intrinsic value, which they return to their parent
in the AST.

Statements just execute for effect in sequence.

This patch moves emitBytecode into the ExpressionNode and StatementNode
subclasses, and changes the SatementNode subclass to return void. This
eliminates some cruft where we used to return 0, or try to save a bogus
register and return it, as if a statement had a consuming parent in the
AST.

  • bytecompiler/BytecodeGenerator.h:

(JSC::BytecodeGenerator::emitNode):
(BytecodeGenerator):
(JSC::BytecodeGenerator::emitNodeInConditionContext):

  • bytecompiler/NodesCodegen.cpp:

(JSC::ConstStatementNode::emitBytecode):
(JSC::BlockNode::emitBytecode):
(JSC::EmptyStatementNode::emitBytecode):
(JSC::DebuggerStatementNode::emitBytecode):
(JSC::ExprStatementNode::emitBytecode):
(JSC::VarStatementNode::emitBytecode):
(JSC::IfNode::emitBytecode):
(JSC::IfElseNode::emitBytecode):
(JSC::DoWhileNode::emitBytecode):
(JSC::WhileNode::emitBytecode):
(JSC::ForNode::emitBytecode):
(JSC::ForInNode::emitBytecode):
(JSC::ContinueNode::emitBytecode):
(JSC::BreakNode::emitBytecode):
(JSC::ReturnNode::emitBytecode):
(JSC::WithNode::emitBytecode):
(JSC::CaseClauseNode::emitBytecode):
(JSC::CaseBlockNode::emitBytecodeForBlock):
(JSC::SwitchNode::emitBytecode):
(JSC::LabelNode::emitBytecode):
(JSC::ThrowNode::emitBytecode):
(JSC::TryNode::emitBytecode):
(JSC::ScopeNode::emitStatementsBytecode):
(JSC::ProgramNode::emitBytecode):
(JSC::EvalNode::emitBytecode):
(JSC::FunctionBodyNode::emitBytecode):
(JSC::FuncDeclNode::emitBytecode):

  • parser/NodeConstructors.h:

(JSC::PropertyListNode::PropertyListNode):
(JSC::ArgumentListNode::ArgumentListNode):

  • parser/Nodes.h:

(Node):
(ExpressionNode):
(StatementNode):
(ConstStatementNode):
(BlockNode):
(EmptyStatementNode):
(DebuggerStatementNode):
(ExprStatementNode):
(VarStatementNode):
(IfNode):
(IfElseNode):
(DoWhileNode):
(WhileNode):
(ForNode):
(ForInNode):
(ContinueNode):
(BreakNode):
(ReturnNode):
(WithNode):
(LabelNode):
(ThrowNode):
(TryNode):
(ProgramNode):
(EvalNode):
(FunctionBodyNode):
(FuncDeclNode):
(CaseBlockNode):
(SwitchNode):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r147670 r147677  
     12013-04-04  Geoffrey Garen  <[email protected]>
     2
     3        Stop pretending that statements return a value
     4        https://bugs.webkit.org/show_bug.cgi?id=113969
     5
     6        Reviewed by Oliver Hunt.
     7
     8        Expressions have an intrinsic value, which they return to their parent
     9        in the AST.
     10
     11        Statements just execute for effect in sequence.
     12
     13        This patch moves emitBytecode into the ExpressionNode and StatementNode
     14        subclasses, and changes the SatementNode subclass to return void. This
     15        eliminates some cruft where we used to return 0, or try to save a bogus
     16        register and return it, as if a statement had a consuming parent in the
     17        AST.
     18
     19        * bytecompiler/BytecodeGenerator.h:
     20        (JSC::BytecodeGenerator::emitNode):
     21        (BytecodeGenerator):
     22        (JSC::BytecodeGenerator::emitNodeInConditionContext):
     23        * bytecompiler/NodesCodegen.cpp:
     24        (JSC::ConstStatementNode::emitBytecode):
     25        (JSC::BlockNode::emitBytecode):
     26        (JSC::EmptyStatementNode::emitBytecode):
     27        (JSC::DebuggerStatementNode::emitBytecode):
     28        (JSC::ExprStatementNode::emitBytecode):
     29        (JSC::VarStatementNode::emitBytecode):
     30        (JSC::IfNode::emitBytecode):
     31        (JSC::IfElseNode::emitBytecode):
     32        (JSC::DoWhileNode::emitBytecode):
     33        (JSC::WhileNode::emitBytecode):
     34        (JSC::ForNode::emitBytecode):
     35        (JSC::ForInNode::emitBytecode):
     36        (JSC::ContinueNode::emitBytecode):
     37        (JSC::BreakNode::emitBytecode):
     38        (JSC::ReturnNode::emitBytecode):
     39        (JSC::WithNode::emitBytecode):
     40        (JSC::CaseClauseNode::emitBytecode):
     41        (JSC::CaseBlockNode::emitBytecodeForBlock):
     42        (JSC::SwitchNode::emitBytecode):
     43        (JSC::LabelNode::emitBytecode):
     44        (JSC::ThrowNode::emitBytecode):
     45        (JSC::TryNode::emitBytecode):
     46        (JSC::ScopeNode::emitStatementsBytecode):
     47        (JSC::ProgramNode::emitBytecode):
     48        (JSC::EvalNode::emitBytecode):
     49        (JSC::FunctionBodyNode::emitBytecode):
     50        (JSC::FuncDeclNode::emitBytecode):
     51        * parser/NodeConstructors.h:
     52        (JSC::PropertyListNode::PropertyListNode):
     53        (JSC::ArgumentListNode::ArgumentListNode):
     54        * parser/Nodes.h:
     55        (Node):
     56        (ExpressionNode):
     57        (StatementNode):
     58        (ConstStatementNode):
     59        (BlockNode):
     60        (EmptyStatementNode):
     61        (DebuggerStatementNode):
     62        (ExprStatementNode):
     63        (VarStatementNode):
     64        (IfNode):
     65        (IfElseNode):
     66        (DoWhileNode):
     67        (WhileNode):
     68        (ForNode):
     69        (ForInNode):
     70        (ContinueNode):
     71        (BreakNode):
     72        (ReturnNode):
     73        (WithNode):
     74        (LabelNode):
     75        (ThrowNode):
     76        (TryNode):
     77        (ProgramNode):
     78        (EvalNode):
     79        (FunctionBodyNode):
     80        (FuncDeclNode):
     81        (CaseBlockNode):
     82        (SwitchNode):
     83
    1842013-04-04  Oliver Hunt  <[email protected]>
    285
Note: See TracChangeset for help on using the changeset viewer.