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

Side by Side Diff: src/hydrogen.cc

Issue 10905232: Fixed bounds check removal by restricting it to int32 indexes (and reenabled both ABCR and index de… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added test. Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3414 matching lines...) Expand 10 before | Expand all | Expand 10 after
3425 HValue* IndexBase() const { return index_base_; } 3425 HValue* IndexBase() const { return index_base_; }
3426 HValue* Length() const { return length_; } 3426 HValue* Length() const { return length_; }
3427 3427
3428 uint32_t Hash() { 3428 uint32_t Hash() {
3429 return static_cast<uint32_t>(index_base_->Hashcode() ^ length_->Hashcode()); 3429 return static_cast<uint32_t>(index_base_->Hashcode() ^ length_->Hashcode());
3430 } 3430 }
3431 3431
3432 static BoundsCheckKey* Create(Zone* zone, 3432 static BoundsCheckKey* Create(Zone* zone,
3433 HBoundsCheck* check, 3433 HBoundsCheck* check,
3434 int32_t* offset) { 3434 int32_t* offset) {
3435 if (!check->index()->representation().IsInteger32()) return NULL;
3436
3435 HValue* index_base = NULL; 3437 HValue* index_base = NULL;
3436 HConstant* constant = NULL; 3438 HConstant* constant = NULL;
3437 bool is_sub = false; 3439 bool is_sub = false;
3438 3440
3439 if (check->index()->IsAdd()) { 3441 if (check->index()->IsAdd()) {
3440 HAdd* index = HAdd::cast(check->index()); 3442 HAdd* index = HAdd::cast(check->index());
3441 if (index->left()->IsConstant()) { 3443 if (index->left()->IsConstant()) {
3442 constant = HConstant::cast(index->left()); 3444 constant = HConstant::cast(index->left());
3443 index_base = index->right(); 3445 index_base = index->right();
3444 } else if (index->right()->IsConstant()) { 3446 } else if (index->right()->IsConstant()) {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
3675 if (!i->IsBoundsCheck()) continue; 3677 if (!i->IsBoundsCheck()) continue;
3676 3678
3677 HBoundsCheck* check = HBoundsCheck::cast(i); 3679 HBoundsCheck* check = HBoundsCheck::cast(i);
3678 check->ReplaceAllUsesWith(check->index()); 3680 check->ReplaceAllUsesWith(check->index());
3679 3681
3680 if (!FLAG_array_bounds_checks_elimination) continue; 3682 if (!FLAG_array_bounds_checks_elimination) continue;
3681 3683
3682 int32_t offset; 3684 int32_t offset;
3683 BoundsCheckKey* key = 3685 BoundsCheckKey* key =
3684 BoundsCheckKey::Create(zone(), check, &offset); 3686 BoundsCheckKey::Create(zone(), check, &offset);
3687 if (key == NULL) continue;
3685 BoundsCheckBbData** data_p = table->LookupOrInsert(key, zone()); 3688 BoundsCheckBbData** data_p = table->LookupOrInsert(key, zone());
3686 BoundsCheckBbData* data = *data_p; 3689 BoundsCheckBbData* data = *data_p;
3687 if (data == NULL) { 3690 if (data == NULL) {
3688 bb_data_list = new(zone()) BoundsCheckBbData(key, 3691 bb_data_list = new(zone()) BoundsCheckBbData(key,
3689 offset, 3692 offset,
3690 offset, 3693 offset,
3691 bb, 3694 bb,
3692 check, 3695 check,
3693 check, 3696 check,
3694 bb_data_list, 3697 bb_data_list,
(...skipping 6282 matching lines...) Expand 10 before | Expand all | Expand 10 after
9977 } 9980 }
9978 } 9981 }
9979 9982
9980 #ifdef DEBUG 9983 #ifdef DEBUG
9981 if (graph_ != NULL) graph_->Verify(false); // No full verify. 9984 if (graph_ != NULL) graph_->Verify(false); // No full verify.
9982 if (allocator_ != NULL) allocator_->Verify(); 9985 if (allocator_ != NULL) allocator_->Verify();
9983 #endif 9986 #endif
9984 } 9987 }
9985 9988
9986 } } // namespace v8::internal 9989 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698