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

Side by Side Diff: runtime/vm/bit_vector.cc

Issue 11505002: Improve redundant load elimination (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix for real Created 8 years 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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/bit_vector.h" 5 #include "vm/bit_vector.h"
6 6
7 #include "vm/os.h" 7 #include "vm/os.h"
8 8
9 namespace dart { 9 namespace dart {
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 for (intptr_t i = 0; i < data_length_; i++) { 55 for (intptr_t i = 0; i < data_length_; i++) {
56 const uword before = data_[i]; 56 const uword before = data_[i];
57 const uword after = data_[i] | from->data_[i]; 57 const uword after = data_[i] | from->data_[i];
58 if (before != after) changed = true; 58 if (before != after) changed = true;
59 data_[i] = after; 59 data_[i] = after;
60 } 60 }
61 return changed; 61 return changed;
62 } 62 }
63 63
64 64
65 bool BitVector::RemoveAll(const BitVector* from) {
Florian Schneider 2012/12/13 13:21:06 Please also add a test case to bit_vector_test.cc.
Vyacheslav Egorov (Google) 2012/12/13 14:02:59 Done.
66 ASSERT(data_length_ == from->data_length_);
67 bool changed = false;
68 for (intptr_t i = 0; i < data_length_; i++) {
69 const uword before = data_[i];
70 const uword after = data_[i] & ~from->data_[i];
71 if (before != after) changed = true;
72 data_[i] = after;
73 }
74 return changed;
75 }
76
65 bool BitVector::KillAndAdd(BitVector* kill, BitVector* gen) { 77 bool BitVector::KillAndAdd(BitVector* kill, BitVector* gen) {
66 ASSERT(data_length_ == kill->data_length_); 78 ASSERT(data_length_ == kill->data_length_);
67 ASSERT(data_length_ == gen->data_length_); 79 ASSERT(data_length_ == gen->data_length_);
68 bool changed = false; 80 bool changed = false;
69 for (intptr_t i = 0; i < data_length_; i++) { 81 for (intptr_t i = 0; i < data_length_; i++) {
70 const uword before = data_[i]; 82 const uword before = data_[i];
71 const uword after = data_[i] | (gen->data_[i] & ~kill->data_[i]); 83 const uword after = data_[i] | (gen->data_[i] & ~kill->data_[i]);
72 if (before != after) changed = true; 84 if (before != after) changed = true;
73 data_[i] = after; 85 data_[i] = after;
74 } 86 }
(...skipping 11 matching lines...) Expand all
86 98
87 void BitVector::Print() const { 99 void BitVector::Print() const {
88 OS::Print("["); 100 OS::Print("[");
89 for (intptr_t i = 0; i < length_; i++) { 101 for (intptr_t i = 0; i < length_; i++) {
90 OS::Print(Contains(i) ? "1" : "0"); 102 OS::Print(Contains(i) ? "1" : "0");
91 } 103 }
92 OS::Print("]"); 104 OS::Print("]");
93 } 105 }
94 106
95 } // namespace dart 107 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698