Stop pretending that statements return a value
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Apr 2013 23:16:20 +0000 (23:16 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Apr 2013 23:16:20 +0000 (23:16 +0000)
commit14abb35dbd2d58e14b4af5268db320c4f507d802
tree3166421df573b6798b4c02807ee148105d00e305
parent4b5e079c0cbb73da95124f67c52ba7a2597aa163
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@147677 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
Source/JavaScriptCore/parser/NodeConstructors.h
Source/JavaScriptCore/parser/Nodes.h