Commit 788db8ae authored by whesse@chromium.org's avatar whesse@chromium.org

Tiny refactoring - change compilation phase parameter for CopyForInlining from...

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
parent 82a04c7f
......@@ -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());
......
......@@ -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<JSFunction> 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<JSFunction> 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);
}
}
......
......@@ -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<JSFunction> closure);
......@@ -384,7 +386,7 @@ class HEnvironment: public ZoneObject {
// instructions, otherwise they are the actual values.
HEnvironment* CopyForInlining(Handle<JSFunction> target,
FunctionLiteral* function,
bool is_speculative,
CompilationPhase compilation_phase,
HConstant* undefined) const;
void AddIncomingEdge(HBasicBlock* block, HEnvironment* other);
......
......@@ -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());
......
......@@ -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());
......
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