Maintain the invariant that all HGraphBuilder::VisitFoo methods return void.

Additionally, this enables the use of a CHECK_ALIVE macro instead of
copy-n-paste code at one place.

This CL is part of a series of several yak-shaving CLs to prepare the inlining
of JavaScript accessors.

Review URL: https://chromiumcodereview.appspot.com/10783017

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12093 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent fac81414
...@@ -2992,12 +2992,9 @@ void HGraphBuilder::VisitForControl(Expression* expr, ...@@ -2992,12 +2992,9 @@ void HGraphBuilder::VisitForControl(Expression* expr,
} }
HValue* HGraphBuilder::VisitArgument(Expression* expr) { void HGraphBuilder::VisitArgument(Expression* expr) {
VisitForValue(expr); CHECK_ALIVE(VisitForValue(expr));
if (HasStackOverflow() || current_block() == NULL) return NULL; Push(AddInstruction(new(zone()) HPushArgument(Pop())));
HValue* value = Pop();
Push(AddInstruction(new(zone()) HPushArgument(value)));
return value;
} }
...@@ -7450,8 +7447,8 @@ void HGraphBuilder::VisitCallNew(CallNew* expr) { ...@@ -7450,8 +7447,8 @@ void HGraphBuilder::VisitCallNew(CallNew* expr) {
} else { } else {
// The constructor function is both an operand to the instruction and an // The constructor function is both an operand to the instruction and an
// argument to the construct call. // argument to the construct call.
HValue* constructor = NULL; CHECK_ALIVE(VisitArgument(expr->expression()));
CHECK_ALIVE(constructor = VisitArgument(expr->expression())); HValue* constructor = HPushArgument::cast(Top())->argument();
CHECK_ALIVE(VisitArgumentList(expr->arguments())); CHECK_ALIVE(VisitArgumentList(expr->arguments()));
HInstruction* call = HInstruction* call =
new(zone()) HCallNew(context, constructor, argument_count); new(zone()) HCallNew(context, constructor, argument_count);
......
...@@ -976,9 +976,8 @@ class HGraphBuilder: public AstVisitor { ...@@ -976,9 +976,8 @@ class HGraphBuilder: public AstVisitor {
HBasicBlock* true_block, HBasicBlock* true_block,
HBasicBlock* false_block); HBasicBlock* false_block);
// Visit an argument subexpression and emit a push to the outgoing // Visit an argument subexpression and emit a push to the outgoing arguments.
// arguments. Returns the hydrogen value that was pushed. void VisitArgument(Expression* expr);
HValue* VisitArgument(Expression* expr);
void VisitArgumentList(ZoneList<Expression*>* arguments); void VisitArgumentList(ZoneList<Expression*>* arguments);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment