From: whesse@chromium.org Date: Wed, 4 May 2011 15:00:04 +0000 (+0000) Subject: Tiny refactoring - change compilation phase parameter for CopyForInlining from a... X-Git-Tag: upstream/4.7.83~19498 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=788db8aedc63007ca56551316a74dbf89ba76fea;p=platform%2Fupstream%2Fv8.git Tiny refactoring - change compilation phase parameter for CopyForInlining from a boolean to an enum. BUG= TEST= Review URL: http://codereview.chromium.org/6913021 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7782 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc index 71d8474..417927f 100644 --- a/src/arm/lithium-arm.cc +++ b/src/arm/lithium-arm.cc @@ -2127,7 +2127,7 @@ LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { HConstant* undefined = graph()->GetConstantUndefined(); HEnvironment* inner = outer->CopyForInlining(instr->closure(), instr->function(), - false, + HEnvironment::LITHIUM, undefined); current_block_->UpdateEnvironment(inner); chunk_->AddInlinedClosure(instr->closure()); diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 3b57f9f..a0d7837 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -4106,7 +4106,10 @@ bool HGraphBuilder::TryInline(Call* expr) { HConstant* undefined = graph()->GetConstantUndefined(); HEnvironment* inner_env = - environment()->CopyForInlining(target, function, true, undefined); + environment()->CopyForInlining(target, + function, + HEnvironment::HYDROGEN, + undefined); HBasicBlock* body_entry = CreateBasicBlock(inner_env); current_block()->Goto(body_entry); @@ -5735,7 +5738,7 @@ HEnvironment* HEnvironment::CopyAsLoopHeader(HBasicBlock* loop_header) const { HEnvironment* HEnvironment::CopyForInlining(Handle target, FunctionLiteral* function, - bool is_speculative, + CompilationPhase compilation_phase, HConstant* undefined) const { // Outer environment is a copy of this one without the arguments. int arity = function->scope()->num_parameters(); @@ -5746,14 +5749,16 @@ HEnvironment* HEnvironment::CopyForInlining(Handle target, HEnvironment* inner = new(zone) HEnvironment(outer, function->scope(), target); // Get the argument values from the original environment. - if (is_speculative) { + if (compilation_phase == HYDROGEN) { for (int i = 0; i <= arity; ++i) { // Include receiver. HValue* push = ExpressionStackAt(arity - i); inner->SetValueAt(i, push); } } else { + ASSERT(compilation_phase == LITHIUM); for (int i = 0; i <= arity; ++i) { // Include receiver. - inner->SetValueAt(i, ExpressionStackAt(arity - i)); + HValue* push = ExpressionStackAt(arity - i); + inner->SetValueAt(i, push); } } diff --git a/src/hydrogen.h b/src/hydrogen.h index 22b82d7..595dba3 100644 --- a/src/hydrogen.h +++ b/src/hydrogen.h @@ -308,6 +308,8 @@ Zone* HBasicBlock::zone() { return graph_->zone(); } class HEnvironment: public ZoneObject { public: + enum CompilationPhase { HYDROGEN, LITHIUM }; + HEnvironment(HEnvironment* outer, Scope* scope, Handle closure); @@ -384,7 +386,7 @@ class HEnvironment: public ZoneObject { // instructions, otherwise they are the actual values. HEnvironment* CopyForInlining(Handle target, FunctionLiteral* function, - bool is_speculative, + CompilationPhase compilation_phase, HConstant* undefined) const; void AddIncomingEdge(HBasicBlock* block, HEnvironment* other); diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc index 18c6480..7329660 100644 --- a/src/ia32/lithium-ia32.cc +++ b/src/ia32/lithium-ia32.cc @@ -2190,7 +2190,7 @@ LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { HConstant* undefined = graph()->GetConstantUndefined(); HEnvironment* inner = outer->CopyForInlining(instr->closure(), instr->function(), - false, + HEnvironment::LITHIUM, undefined); current_block_->UpdateEnvironment(inner); chunk_->AddInlinedClosure(instr->closure()); diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc index 94cdd04..7ca7c05 100644 --- a/src/x64/lithium-x64.cc +++ b/src/x64/lithium-x64.cc @@ -2122,7 +2122,7 @@ LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { HConstant* undefined = graph()->GetConstantUndefined(); HEnvironment* inner = outer->CopyForInlining(instr->closure(), instr->function(), - false, + HEnvironment::LITHIUM, undefined); current_block_->UpdateEnvironment(inner); chunk_->AddInlinedClosure(instr->closure());