Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Unified Diff: src/hydrogen.cc

Issue 10581014: BoundsCheck should be extended to support array_bounds_checks_elimination (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
===================================================================
--- src/hydrogen.cc (revision 11854)
+++ src/hydrogen.cc (working copy)
@@ -3306,27 +3306,11 @@
ASSERT(false);
}
- BuildOffsetAdd(&added_index_,
- &added_index_offset_,
- Key()->IndexBase(),
- new_check->index()->representation(),
- lower_offset_);
- Check()->SetOperandAt(0, added_index_);
- BuildOffsetAdd(&added_length_,
- &added_length_offset_,
- Key()->Length(),
- new_check->length()->representation(),
- lower_offset_ - upper_offset_);
- Check()->SetOperandAt(1, added_length_);
-
+ Check()->SetOperandAt(0, Key()->IndexBase());
+ Check()->set_offset(lower_offset_, upper_offset_);
new_check->DeleteAndReplaceWith(NULL);
}
- void RemoveZeroOperations() {
- RemoveZeroAdd(&added_index_, &added_index_offset_);
- RemoveZeroAdd(&added_length_, &added_length_offset_);
- }
-
BoundsCheckBbData(BoundsCheckKey* key,
int32_t lower_offset,
int32_t upper_offset,
@@ -3339,12 +3323,10 @@
upper_offset_(upper_offset),
basic_block_(bb),
check_(check),
- added_index_offset_(NULL),
- added_index_(NULL),
- added_length_offset_(NULL),
- added_length_(NULL),
next_in_bb_(next_in_bb),
- father_in_dt_(father_in_dt) { }
+ father_in_dt_(father_in_dt) {
+ ASSERT(check->index()->representation().IsInteger32());
+ }
private:
BoundsCheckKey* key_;
@@ -3352,41 +3334,8 @@
int32_t upper_offset_;
HBasicBlock* basic_block_;
HBoundsCheck* check_;
- HConstant* added_index_offset_;
- HAdd* added_index_;
- HConstant* added_length_offset_;
- HAdd* added_length_;
BoundsCheckBbData* next_in_bb_;
BoundsCheckBbData* father_in_dt_;
-
- void BuildOffsetAdd(HAdd** add,
- HConstant** constant,
- HValue* original_value,
- Representation representation,
- int32_t new_offset) {
- HConstant* new_constant = new(BasicBlock()->zone())
- HConstant(Handle<Object>(Smi::FromInt(new_offset)),
- Representation::Integer32());
- if (*add == NULL) {
- new_constant->InsertBefore(Check());
- *add = new(BasicBlock()->zone()) HAdd(NULL,
- original_value,
- new_constant);
- (*add)->AssumeRepresentation(representation);
- (*add)->InsertBefore(Check());
- } else {
- new_constant->InsertBefore(*add);
- (*constant)->DeleteAndReplaceWith(new_constant);
- }
- *constant = new_constant;
- }
-
- void RemoveZeroAdd(HAdd** add, HConstant** constant) {
- if (*add != NULL && (*constant)->Integer32Value() == 0) {
- (*add)->DeleteAndReplaceWith((*add)->left());
- (*constant)->DeleteAndReplaceWith(NULL);
- }
- }
};
@@ -3478,7 +3427,6 @@
for (BoundsCheckBbData* data = bb_data_list;
data != NULL;
data = data->NextInBasicBlock()) {
- data->RemoveZeroOperations();
if (data->FatherInDominatorTree()) {
table->Insert(data->Key(), data->FatherInDominatorTree(), zone());
} else {
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698