OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 static int SizeFor(int length) { | 105 static int SizeFor(int length) { |
106 return 1 + ((length - 1) / 32); | 106 return 1 + ((length - 1) / 32); |
107 } | 107 } |
108 | 108 |
109 BitVector& operator=(const BitVector& rhs) { | 109 BitVector& operator=(const BitVector& rhs) { |
110 if (this != &rhs) CopyFrom(rhs); | 110 if (this != &rhs) CopyFrom(rhs); |
111 return *this; | 111 return *this; |
112 } | 112 } |
113 | 113 |
114 void CopyFrom(const BitVector& other) { | 114 void CopyFrom(const BitVector& other) { |
115 ASSERT(other.length() == length()); | 115 ASSERT(other.length() <= length()); |
116 for (int i = 0; i < data_length_; i++) { | 116 for (int i = 0; i < other.data_length_; i++) { |
117 data_[i] = other.data_[i]; | 117 data_[i] = other.data_[i]; |
118 } | 118 } |
| 119 for (int i = other.data_length_; i < data_length_; i++) { |
| 120 data_[i] = 0; |
| 121 } |
119 } | 122 } |
120 | 123 |
121 bool Contains(int i) const { | 124 bool Contains(int i) const { |
122 ASSERT(i >= 0 && i < length()); | 125 ASSERT(i >= 0 && i < length()); |
123 uint32_t block = data_[i / 32]; | 126 uint32_t block = data_[i / 32]; |
124 return (block & (1U << (i % 32))) != 0; | 127 return (block & (1U << (i % 32))) != 0; |
125 } | 128 } |
126 | 129 |
127 void Add(int i) { | 130 void Add(int i) { |
128 ASSERT(i >= 0 && i < length()); | 131 ASSERT(i >= 0 && i < length()); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 BitVector av_; | 370 BitVector av_; |
368 | 371 |
369 DISALLOW_COPY_AND_ASSIGN(AssignedVariablesAnalyzer); | 372 DISALLOW_COPY_AND_ASSIGN(AssignedVariablesAnalyzer); |
370 }; | 373 }; |
371 | 374 |
372 | 375 |
373 } } // namespace v8::internal | 376 } } // namespace v8::internal |
374 | 377 |
375 | 378 |
376 #endif // V8_DATAFLOW_H_ | 379 #endif // V8_DATAFLOW_H_ |
OLD | NEW |