Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 785430a358874ac63cdffb87e8c5c5e973d7b8ed..0c05ff5a013a4a95a5a03c21a3692d62c27f8b9e 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -743,8 +743,7 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess( |
HCheckMaps* mapcheck, |
bool is_js_array, |
ElementsKind elements_kind, |
- bool is_store, |
- Representation checked_index_representation) { |
+ bool is_store) { |
Zone* zone = this->zone(); |
// No GVNFlag is necessary for ElementsKind if there is an explicit dependency |
// on a HElementsTransition instruction. The flag can also be removed if the |
@@ -772,8 +771,8 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess( |
HInstruction* checked_key = NULL; |
if (IsExternalArrayElementsKind(elements_kind)) { |
length = AddInstruction(new(zone) HFixedArrayBaseLength(elements)); |
- checked_key = AddInstruction(new(zone) HBoundsCheck( |
- key, length, ALLOW_SMI_KEY, checked_index_representation)); |
+ checked_key = AddInstruction(new(zone) HBoundsCheck(key, length, |
+ ALLOW_SMI_KEY)); |
HLoadExternalArrayPointer* external_elements = |
new(zone) HLoadExternalArrayPointer(elements); |
AddInstruction(external_elements); |
@@ -790,8 +789,8 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess( |
} else { |
length = AddInstruction(new(zone) HFixedArrayBaseLength(elements)); |
} |
- checked_key = AddInstruction(new(zone) HBoundsCheck( |
- key, length, ALLOW_SMI_KEY, checked_index_representation)); |
+ checked_key = AddInstruction(new(zone) HBoundsCheck(key, length, |
+ ALLOW_SMI_KEY)); |
return BuildFastElementAccess(elements, checked_key, val, mapcheck, |
elements_kind, is_store); |
} |
@@ -3504,12 +3503,10 @@ bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) { |
HStackCheckEliminator sce(this); |
sce.Process(); |
- if (FLAG_array_bounds_checks_elimination) EliminateRedundantBoundsChecks(); |
- if (FLAG_array_index_dehoisting) DehoistSimpleArrayIndexComputations(); |
+ EliminateRedundantBoundsChecks(); |
+ DehoistSimpleArrayIndexComputations(); |
if (FLAG_dead_code_elimination) DeadCodeElimination(); |
- ApplyActualValues(); |
- |
return true; |
} |
@@ -3669,7 +3666,7 @@ class BoundsCheckBbData: public ZoneObject { |
} |
if (!keep_new_check) { |
- new_check->DeleteAndReplaceWith(new_check->ActualValue()); |
+ new_check->DeleteAndReplaceWith(NULL); |
} |
return true; |
@@ -3805,6 +3802,10 @@ void HGraph::EliminateRedundantBoundsChecks(HBasicBlock* bb, |
if (!i->IsBoundsCheck()) continue; |
HBoundsCheck* check = HBoundsCheck::cast(i); |
+ check->ReplaceAllUsesWith(check->index()); |
+ |
+ if (!FLAG_array_bounds_checks_elimination) continue; |
+ |
int32_t offset; |
BoundsCheckKey* key = |
BoundsCheckKey::Create(zone(), check, &offset); |
@@ -3822,7 +3823,7 @@ void HGraph::EliminateRedundantBoundsChecks(HBasicBlock* bb, |
NULL); |
*data_p = bb_data_list; |
} else if (data->OffsetIsCovered(offset)) { |
- check->DeleteAndReplaceWith(check->ActualValue()); |
+ check->DeleteAndReplaceWith(NULL); |
} else if (data->BasicBlock() != bb || |
!data->CoverCheck(check, offset)) { |
// If the check is in the current BB we try to modify it by calling |
@@ -3919,6 +3920,8 @@ static void DehoistArrayIndex(ArrayInstructionInterface* array_operation) { |
void HGraph::DehoistSimpleArrayIndexComputations() { |
+ if (!FLAG_array_index_dehoisting) return; |
+ |
HPhase phase("H_Dehoist index computations", this); |
for (int i = 0; i < blocks()->length(); ++i) { |
for (HInstruction* instr = blocks()->at(i)->first(); |
@@ -3970,30 +3973,6 @@ void HGraph::DeadCodeElimination() { |
} |
-void HGraph::ApplyActualValues() { |
- HPhase phase("H_Apply actual values", this); |
- |
- for (int block_index = 0; block_index < blocks()->length(); block_index++) { |
- HBasicBlock* block = blocks()->at(block_index); |
- |
-#ifdef DEBUG |
- for (int i = 0; i < block->phis()->length(); i++) { |
- HPhi* phi = block->phis()->at(i); |
- ASSERT(phi->ActualValue() == phi); |
- } |
-#endif |
- |
- for (HInstruction* instruction = block->first(); |
- instruction != NULL; |
- instruction = instruction->next()) { |
- if (instruction->ActualValue() != instruction) { |
- instruction->ReplaceAllUsesWith(instruction->ActualValue()); |
- } |
- } |
- } |
-} |
- |
- |
void HOptimizedGraphBuilder::AddPhi(HPhi* instr) { |
ASSERT(current_block() != NULL); |
current_block()->AddPhi(instr); |