Provide a helper to generate multiple Lithium instructions for one Hydrogen instruction.

R=jkummerow@chromium.org, ulan@chromium.org

Review URL: https://codereview.chromium.org/296993002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21465 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7c55f645
......@@ -835,9 +835,18 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
ASSERT(argument_count_ >= 0);
if (instr != NULL) {
AddInstruction(instr, current);
}
current_instruction_ = old_current;
}
void LChunkBuilder::AddInstruction(LInstruction* instr,
HInstruction* hydrogen_val) {
// Associate the hydrogen instruction first, since we may need it for
// the ClobbersRegisters() or ClobbersDoubleRegisters() calls below.
instr->set_hydrogen_value(current);
instr->set_hydrogen_value(hydrogen_val);
#if DEBUG
// Make sure that the lithium instruction has either no fixed register
......@@ -878,10 +887,10 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
chunk_->AddInstruction(instr, current_block_);
if (instr->IsCall()) {
HValue* hydrogen_value_for_lazy_bailout = current;
HValue* hydrogen_value_for_lazy_bailout = hydrogen_val;
LInstruction* instruction_needing_environment = NULL;
if (current->HasObservableSideEffects()) {
HSimulate* sim = HSimulate::cast(current->next());
if (hydrogen_val->HasObservableSideEffects()) {
HSimulate* sim = HSimulate::cast(hydrogen_val->next());
instruction_needing_environment = instr;
sim->ReplayEnvironment(current_block_->last_environment());
hydrogen_value_for_lazy_bailout = sim;
......@@ -896,8 +905,6 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
SetDeferredLazyDeoptimizationEnvironment(bailout->environment());
}
}
}
current_instruction_ = old_current;
}
......
......@@ -2837,6 +2837,7 @@ class LChunkBuilder V8_FINAL : public LChunkBuilderBase {
CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
void VisitInstruction(HInstruction* current);
void AddInstruction(LInstruction* instr, HInstruction* current);
void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
......
......@@ -679,9 +679,18 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
ASSERT(argument_count_ >= 0);
if (instr != NULL) {
AddInstruction(instr, current);
}
current_instruction_ = old_current;
}
void LChunkBuilder::AddInstruction(LInstruction* instr,
HInstruction* hydrogen_val) {
// Associate the hydrogen instruction first, since we may need it for
// the ClobbersRegisters() or ClobbersDoubleRegisters() calls below.
instr->set_hydrogen_value(current);
instr->set_hydrogen_value(hydrogen_val);
#if DEBUG
// Make sure that the lithium instruction has either no fixed register
......@@ -722,10 +731,10 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
chunk_->AddInstruction(instr, current_block_);
if (instr->IsCall()) {
HValue* hydrogen_value_for_lazy_bailout = current;
HValue* hydrogen_value_for_lazy_bailout = hydrogen_val;
LInstruction* instruction_needing_environment = NULL;
if (current->HasObservableSideEffects()) {
HSimulate* sim = HSimulate::cast(current->next());
if (hydrogen_val->HasObservableSideEffects()) {
HSimulate* sim = HSimulate::cast(hydrogen_val->next());
instruction_needing_environment = instr;
sim->ReplayEnvironment(current_block_->last_environment());
hydrogen_value_for_lazy_bailout = sim;
......@@ -740,8 +749,6 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
SetDeferredLazyDeoptimizationEnvironment(bailout->environment());
}
}
}
current_instruction_ = old_current;
}
......
......@@ -3137,6 +3137,7 @@ class LChunkBuilder V8_FINAL : public LChunkBuilderBase {
LInstruction* AssignEnvironment(LInstruction* instr);
void VisitInstruction(HInstruction* current);
void AddInstruction(LInstruction* instr, HInstruction* current);
void DoBasicBlock(HBasicBlock* block);
int JSShiftAmountFromHConstant(HValue* constant) {
......
......@@ -889,9 +889,18 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
ASSERT(argument_count_ >= 0);
if (instr != NULL) {
AddInstruction(instr, current);
}
current_instruction_ = old_current;
}
void LChunkBuilder::AddInstruction(LInstruction* instr,
HInstruction* hydrogen_val) {
// Associate the hydrogen instruction first, since we may need it for
// the ClobbersRegisters() or ClobbersDoubleRegisters() calls below.
instr->set_hydrogen_value(current);
instr->set_hydrogen_value(hydrogen_val);
#if DEBUG
// Make sure that the lithium instruction has either no fixed register
......@@ -932,10 +941,10 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
chunk_->AddInstruction(instr, current_block_);
if (instr->IsCall()) {
HValue* hydrogen_value_for_lazy_bailout = current;
HValue* hydrogen_value_for_lazy_bailout = hydrogen_val;
LInstruction* instruction_needing_environment = NULL;
if (current->HasObservableSideEffects()) {
HSimulate* sim = HSimulate::cast(current->next());
if (hydrogen_val->HasObservableSideEffects()) {
HSimulate* sim = HSimulate::cast(hydrogen_val->next());
instruction_needing_environment = instr;
sim->ReplayEnvironment(current_block_->last_environment());
hydrogen_value_for_lazy_bailout = sim;
......@@ -950,8 +959,6 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
SetDeferredLazyDeoptimizationEnvironment(bailout->environment());
}
}
}
current_instruction_ = old_current;
}
......
......@@ -2831,6 +2831,7 @@ class LChunkBuilder V8_FINAL : public LChunkBuilderBase {
CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
void VisitInstruction(HInstruction* current);
void AddInstruction(LInstruction* instr, HInstruction* current);
void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
......
......@@ -843,9 +843,18 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
ASSERT(argument_count_ >= 0);
if (instr != NULL) {
// Associate the hydrogen instruction first, since we may need it for
AddInstruction(instr, current);
}
current_instruction_ = old_current;
}
void LChunkBuilder::AddInstruction(LInstruction* instr,
HInstruction* hydrogen_val) {
// Associate the hydrogen instruction first, since we may need it for
// the ClobbersRegisters() or ClobbersDoubleRegisters() calls below.
instr->set_hydrogen_value(current);
instr->set_hydrogen_value(hydrogen_val);
#if DEBUG
// Make sure that the lithium instruction has either no fixed register
......@@ -886,10 +895,10 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
chunk_->AddInstruction(instr, current_block_);
if (instr->IsCall()) {
HValue* hydrogen_value_for_lazy_bailout = current;
HValue* hydrogen_value_for_lazy_bailout = hydrogen_val;
LInstruction* instruction_needing_environment = NULL;
if (current->HasObservableSideEffects()) {
HSimulate* sim = HSimulate::cast(current->next());
if (hydrogen_val->HasObservableSideEffects()) {
HSimulate* sim = HSimulate::cast(hydrogen_val->next());
instruction_needing_environment = instr;
sim->ReplayEnvironment(current_block_->last_environment());
hydrogen_value_for_lazy_bailout = sim;
......@@ -904,8 +913,6 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
SetDeferredLazyDeoptimizationEnvironment(bailout->environment());
}
}
}
current_instruction_ = old_current;
}
......
......@@ -2792,6 +2792,7 @@ class LChunkBuilder V8_FINAL : public LChunkBuilderBase {
CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
void VisitInstruction(HInstruction* current);
void AddInstruction(LInstruction* instr, HInstruction* current);
void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
......
......@@ -856,9 +856,18 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
ASSERT(argument_count_ >= 0);
if (instr != NULL) {
AddInstruction(instr, current);
}
current_instruction_ = old_current;
}
void LChunkBuilder::AddInstruction(LInstruction* instr,
HInstruction* hydrogen_val) {
// Associate the hydrogen instruction first, since we may need it for
// the ClobbersRegisters() or ClobbersDoubleRegisters() calls below.
instr->set_hydrogen_value(current);
instr->set_hydrogen_value(hydrogen_val);
#if DEBUG
// Make sure that the lithium instruction has either no fixed register
......@@ -899,10 +908,10 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
chunk_->AddInstruction(instr, current_block_);
if (instr->IsCall()) {
HValue* hydrogen_value_for_lazy_bailout = current;
HValue* hydrogen_value_for_lazy_bailout = hydrogen_val;
LInstruction* instruction_needing_environment = NULL;
if (current->HasObservableSideEffects()) {
HSimulate* sim = HSimulate::cast(current->next());
if (hydrogen_val->HasObservableSideEffects()) {
HSimulate* sim = HSimulate::cast(hydrogen_val->next());
instruction_needing_environment = instr;
sim->ReplayEnvironment(current_block_->last_environment());
hydrogen_value_for_lazy_bailout = sim;
......@@ -917,8 +926,6 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
SetDeferredLazyDeoptimizationEnvironment(bailout->environment());
}
}
}
current_instruction_ = old_current;
}
......
......@@ -2806,6 +2806,7 @@ class LChunkBuilder V8_FINAL : public LChunkBuilderBase {
CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
void VisitInstruction(HInstruction* current);
void AddInstruction(LInstruction* instr, HInstruction* current);
void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
......
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