From a333094165b2d0e03729cbc5fb332723bc0faddb Mon Sep 17 00:00:00 2001 From: "ishell@chromium.org" Date: Wed, 23 Oct 2013 12:34:39 +0000 Subject: [PATCH] PushAndAdd() usages refactored. R=bmeurer@chromium.org Review URL: https://codereview.chromium.org/36893002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17339 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/hydrogen.cc | 29 +++++++++++------------------ src/hydrogen.h | 2 -- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/hydrogen.cc b/src/hydrogen.cc index f46e467..218859f 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -3215,12 +3215,6 @@ void HGraph::RestoreActualValues() { } -void HGraphBuilder::PushAndAdd(HInstruction* instr) { - Push(instr); - AddInstruction(instr); -} - - template HInstruction* HOptimizedGraphBuilder::PreProcessCall(Instruction* call) { int count = call->argument_count(); @@ -3898,9 +3892,7 @@ void HOptimizedGraphBuilder::VisitForInStatement(ForInStatement* stmt) { set_current_block(body_exit); HValue* current_index = Pop(); - HInstruction* new_index = New(current_index, - graph()->GetConstant1()); - PushAndAdd(new_index); + Push(Add(current_index, graph()->GetConstant1())); body_exit = current_block(); } @@ -5327,7 +5319,8 @@ void HOptimizedGraphBuilder::HandleCompoundAssignment(Assignment* expr) { HValue* left = Pop(); HInstruction* instr = BuildBinaryOperation(operation, left, right); - PushAndAdd(instr); + AddInstruction(instr); + Push(instr); if (instr->HasObservableSideEffects()) { Add(operation->id(), REMOVABLE_SIMULATE); } @@ -6962,9 +6955,9 @@ bool HOptimizedGraphBuilder::TryCallApply(Call* expr) { } Drop(arguments_count - 1); - PushAndAdd(New(Pop())); + Push(Add(Pop())); for (int i = 1; i < arguments_count; i++) { - PushAndAdd(New(arguments_values->at(i))); + Push(Add(arguments_values->at(i))); } HInvokeFunction* call = New(function, @@ -7077,8 +7070,8 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) { if (known_global_function) { // Push the global object instead of the global receiver because // code generated by the full code generator expects it. - HGlobalObject* global_object = New(); - PushAndAdd(global_object); + HGlobalObject* global_object = Add(); + Push(global_object); CHECK_ALIVE(VisitExpressions(expr->arguments())); CHECK_ALIVE(VisitForValue(expr->expression())); @@ -7117,7 +7110,7 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) { } } else { HGlobalObject* receiver = Add(); - PushAndAdd(New(receiver)); + Push(Add(receiver)); CHECK_ALIVE(VisitArgumentList(expr->arguments())); call = New(var->name(), argument_count); @@ -7130,8 +7123,8 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) { CHECK_ALIVE(VisitForValue(expr->expression())); HValue* function = Top(); HGlobalObject* global = Add(); - HGlobalReceiver* receiver = New(global); - PushAndAdd(receiver); + HGlobalReceiver* receiver = Add(global); + Push(receiver); CHECK_ALIVE(VisitExpressions(expr->arguments())); Add(function, expr->target()); @@ -7157,7 +7150,7 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) { HValue* function = Top(); HGlobalObject* global_object = Add(); HGlobalReceiver* receiver = Add(global_object); - PushAndAdd(New(receiver)); + Push(Add(receiver)); CHECK_ALIVE(VisitArgumentList(expr->arguments())); call = New(function, argument_count); diff --git a/src/hydrogen.h b/src/hydrogen.h index cb3688c..b5046bd 100644 --- a/src/hydrogen.h +++ b/src/hydrogen.h @@ -1309,8 +1309,6 @@ class HGraphBuilder { HValue* EnforceNumberType(HValue* number, Handle expected); HValue* TruncateToNumber(HValue* value, Handle* expected); - void PushAndAdd(HInstruction* instr); - void FinishExitWithHardDeoptimization(const char* reason, HBasicBlock* continuation); -- 2.7.4