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

Side by Side Diff: src/data-flow.h

Issue 11745027: Replaced a bailout ID assertion with quadratic time complexity by a linear one. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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
« no previous file with comments | « no previous file | src/full-codegen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 #ifdef DEBUG 192 #ifdef DEBUG
193 void Print(); 193 void Print();
194 #endif 194 #endif
195 195
196 private: 196 private:
197 int length_; 197 int length_;
198 int data_length_; 198 int data_length_;
199 uint32_t* data_; 199 uint32_t* data_;
200 }; 200 };
201 201
202 class GrowableBitVector BASE_EMBEDDED {
203 public:
204 GrowableBitVector() : bits_(NULL) { }
205
206 bool Contains(int value) const {
207 if (!InBitsRange(value)) return false;
208 return bits_->Contains(value);
209 }
210
211 void Add(int value, Zone* zone) {
212 EnsureCapacity(value, zone);
213 bits_->Add(value);
214 }
215
216 private:
217 static const int kInitialLength = 1024;
218
219 bool InBitsRange(int value) const {
220 return bits_ != NULL && bits_->length() > value;
221 }
222
223 void EnsureCapacity(int value, Zone* zone) {
224 if (InBitsRange(value)) return;
225 int new_length = bits_ == NULL ? kInitialLength : bits_->length();
226 while (new_length <= value) new_length *= 2;
227 BitVector* new_bits = new(zone) BitVector(new_length, zone);
228 if (bits_ != NULL) new_bits->CopyFrom(*bits_);
229 bits_ = new_bits;
230 }
231
232 BitVector* bits_;
233 };
234
235
202 } } // namespace v8::internal 236 } } // namespace v8::internal
203 237
204 238
205 #endif // V8_DATAFLOW_H_ 239 #endif // V8_DATAFLOW_H_
OLDNEW
« no previous file with comments | « no previous file | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698