Revision: 7877
Author: [email protected]
Date: Thu May 12 07:56:56 2011
Log: Don't use environment values at certain deoptimize-instructions.
If a HDeoptimize does not cut away parts of the control-flow-graph
we don't need to insert uses to correctly elimiate dead phis since
the full function is visible to the optimizing compiler.
This is a small improvement of the change r7221 which fixed a problem
when deoptimizing on never executed case-clauses.
Review URL: http://codereview.chromium.org/7012010
http://code.google.com/p/v8/source/detail?r=7877
Modified:
/branches/bleeding_edge/src/hydrogen-instructions.h
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/hydrogen.h
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Wed May 11 05:50:04
2011
+++ /branches/bleeding_edge/src/hydrogen-instructions.h Thu May 12 07:56:56
2011
@@ -862,6 +862,11 @@
DECLARE_CONCRETE_INSTRUCTION(Deoptimize)
+ enum UseEnvironment {
+ kNoUses,
+ kUseAll
+ };
+
protected:
virtual void InternalSetOperandAt(int index, HValue* value) {
values_[index] = value;
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Thu May 12 06:36:49 2011
+++ /branches/bleeding_edge/src/hydrogen.cc Thu May 12 07:56:56 2011
@@ -115,12 +115,13 @@
}
-HDeoptimize* HBasicBlock::CreateDeoptimize() {
+HDeoptimize* HBasicBlock::CreateDeoptimize(
+ HDeoptimize::UseEnvironment has_uses) {
ASSERT(HasEnvironment());
- HEnvironment* environment = last_environment();
-
+ if (has_uses == HDeoptimize::kNoUses) return new(zone()) HDeoptimize(0);
+
+ HEnvironment* environment = last_environment();
HDeoptimize* instr = new(zone()) HDeoptimize(environment->length());
-
for (int i = 0; i < environment->length(); i++) {
HValue* val = environment->values()->at(i);
instr->AddEnvironmentValue(val);
@@ -2490,7 +2491,9 @@
// Unconditionally deoptimize on the first non-smi compare.
clause->RecordTypeFeedback(oracle());
if (!clause->IsSmiCompare()) {
- current_block()->FinishExitWithDeoptimization();
+ // Finish with deoptimize and add uses of enviroment values to
+ // account for invisible uses.
+ current_block()->FinishExitWithDeoptimization(HDeoptimize::kUseAll);
set_current_block(NULL);
break;
}
@@ -3237,7 +3240,7 @@
// know about and do not want to handle ones we've never seen. Otherwise
// use a generic IC.
if (count == types->length() && FLAG_deoptimize_uncommon_cases) {
- current_block()->FinishExitWithDeoptimization();
+ current_block()->FinishExitWithDeoptimization(HDeoptimize::kNoUses);
} else {
HInstruction* instr = BuildStoreNamedGeneric(object, name, value);
instr->set_position(expr->position());
@@ -3916,7 +3919,7 @@
// know about and do not want to handle ones we've never seen. Otherwise
// use a generic IC.
if (count == types->length() && FLAG_deoptimize_uncommon_cases) {
- current_block()->FinishExitWithDeoptimization();
+ current_block()->FinishExitWithDeoptimization(HDeoptimize::kNoUses);
} else {
HValue* context = environment()->LookupContext();
HCallNamed* call = new(zone()) HCallNamed(context, name,
argument_count);
=======================================
--- /branches/bleeding_edge/src/hydrogen.h Thu May 12 06:36:49 2011
+++ /branches/bleeding_edge/src/hydrogen.h Thu May 12 07:56:56 2011
@@ -125,8 +125,8 @@
void AddSimulate(int id) { AddInstruction(CreateSimulate(id)); }
void AssignCommonDominator(HBasicBlock* other);
- void FinishExitWithDeoptimization() {
- FinishExit(CreateDeoptimize());
+ void FinishExitWithDeoptimization(HDeoptimize::UseEnvironment has_uses) {
+ FinishExit(CreateDeoptimize(has_uses));
}
// Add the inlined function exit sequence, adding an HLeaveInlined
@@ -153,7 +153,7 @@
void AddDominatedBlock(HBasicBlock* block);
HSimulate* CreateSimulate(int id);
- HDeoptimize* CreateDeoptimize();
+ HDeoptimize* CreateDeoptimize(HDeoptimize::UseEnvironment has_uses);
int block_id_;
HGraph* graph_;
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev