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

Side by Side Diff: src/effects.h

Issue 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes Created 6 years, 4 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 | « src/dtoa.cc ('k') | src/elements.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_EFFECTS_H_ 5 #ifndef V8_EFFECTS_H_
6 #define V8_EFFECTS_H_ 6 #define V8_EFFECTS_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/types.h" 10 #include "src/types.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 typedef Var Key; 188 typedef Var Key;
189 typedef Effect Value; 189 typedef Effect Value;
190 static const Var kNoKey = kNoVar; 190 static const Var kNoKey = kNoVar;
191 static Effect NoValue() { return Effect(); } 191 static Effect NoValue() { return Effect(); }
192 static int Compare(int x, int y) { return y - x; } 192 static int Compare(int x, int y) { return y - x; }
193 }; 193 };
194 typedef ZoneSplayTree<SplayTreeConfig> Mapping; 194 typedef ZoneSplayTree<SplayTreeConfig> Mapping;
195 typedef typename Mapping::Locator Locator; 195 typedef typename Mapping::Locator Locator;
196 196
197 bool Contains(Var var) { 197 bool Contains(Var var) {
198 ASSERT(var != kNoVar); 198 DCHECK(var != kNoVar);
199 return map_->Contains(var); 199 return map_->Contains(var);
200 } 200 }
201 bool Find(Var var, Locator* locator) { 201 bool Find(Var var, Locator* locator) {
202 ASSERT(var != kNoVar); 202 DCHECK(var != kNoVar);
203 return map_->Find(var, locator); 203 return map_->Find(var, locator);
204 } 204 }
205 bool Insert(Var var, Locator* locator) { 205 bool Insert(Var var, Locator* locator) {
206 ASSERT(var != kNoVar); 206 DCHECK(var != kNoVar);
207 return map_->Insert(var, locator); 207 return map_->Insert(var, locator);
208 } 208 }
209 209
210 template<class Callback> 210 template<class Callback>
211 void ForEach(Callback* callback) { 211 void ForEach(Callback* callback) {
212 return map_->ForEach(callback); 212 return map_->ForEach(callback);
213 } 213 }
214 214
215 private: 215 private:
216 Mapping* map_; 216 Mapping* map_;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 protected: 252 protected:
253 typedef typename EffectsBase<Var, kNoVar>::Locator Locator; 253 typedef typename EffectsBase<Var, kNoVar>::Locator Locator;
254 254
255 Zone* zone() { return node_->zone; } 255 Zone* zone() { return node_->zone; }
256 256
257 void push() { node_ = new(node_->zone) Node(node_->zone, node_); } 257 void push() { node_ = new(node_->zone) Node(node_->zone, node_); }
258 void pop() { node_ = node_->previous; } 258 void pop() { node_ = node_->previous; }
259 bool is_empty() { return node_ == NULL; } 259 bool is_empty() { return node_ == NULL; }
260 260
261 bool Contains(Var var) { 261 bool Contains(Var var) {
262 ASSERT(var != kNoVar); 262 DCHECK(var != kNoVar);
263 for (Node* node = node_; node != NULL; node = node->previous) { 263 for (Node* node = node_; node != NULL; node = node->previous) {
264 if (node->effects.Contains(var)) return true; 264 if (node->effects.Contains(var)) return true;
265 } 265 }
266 return false; 266 return false;
267 } 267 }
268 268
269 bool Find(Var var, Locator* locator) { 269 bool Find(Var var, Locator* locator) {
270 ASSERT(var != kNoVar); 270 DCHECK(var != kNoVar);
271 for (Node* node = node_; node != NULL; node = node->previous) { 271 for (Node* node = node_; node != NULL; node = node->previous) {
272 if (node->effects.Find(var, locator)) return true; 272 if (node->effects.Find(var, locator)) return true;
273 } 273 }
274 return false; 274 return false;
275 } 275 }
276 276
277 bool Insert(Var var, Locator* locator); 277 bool Insert(Var var, Locator* locator);
278 278
279 private: 279 private:
280 struct Node: ZoneObject { 280 struct Node: ZoneObject {
281 Zone* zone; 281 Zone* zone;
282 Effects<Var, kNoVar> effects; 282 Effects<Var, kNoVar> effects;
283 Node* previous; 283 Node* previous;
284 explicit Node(Zone* zone, Node* previous = NULL) 284 explicit Node(Zone* zone, Node* previous = NULL)
285 : zone(zone), effects(zone), previous(previous) {} 285 : zone(zone), effects(zone), previous(previous) {}
286 }; 286 };
287 287
288 explicit NestedEffectsBase(Node* node) : node_(node) {} 288 explicit NestedEffectsBase(Node* node) : node_(node) {}
289 289
290 Node* node_; 290 Node* node_;
291 }; 291 };
292 292
293 293
294 template<class Var, Var kNoVar> 294 template<class Var, Var kNoVar>
295 bool NestedEffectsBase<Var, kNoVar>::Insert(Var var, Locator* locator) { 295 bool NestedEffectsBase<Var, kNoVar>::Insert(Var var, Locator* locator) {
296 ASSERT(var != kNoVar); 296 DCHECK(var != kNoVar);
297 if (!node_->effects.Insert(var, locator)) return false; 297 if (!node_->effects.Insert(var, locator)) return false;
298 Locator shadowed; 298 Locator shadowed;
299 for (Node* node = node_->previous; node != NULL; node = node->previous) { 299 for (Node* node = node_->previous; node != NULL; node = node->previous) {
300 if (node->effects.Find(var, &shadowed)) { 300 if (node->effects.Find(var, &shadowed)) {
301 // Initialize with shadowed entry. 301 // Initialize with shadowed entry.
302 locator->set_value(shadowed.value()); 302 locator->set_value(shadowed.value());
303 return false; 303 return false;
304 } 304 }
305 } 305 }
306 return true; 306 return true;
(...skipping 12 matching lines...) Expand all
319 // be modified while the extension is in use. 319 // be modified while the extension is in use.
320 NestedEffects Push() { 320 NestedEffects Push() {
321 NestedEffects result = *this; 321 NestedEffects result = *this;
322 result.push(); 322 result.push();
323 return result; 323 return result;
324 } 324 }
325 325
326 NestedEffects Pop() { 326 NestedEffects Pop() {
327 NestedEffects result = *this; 327 NestedEffects result = *this;
328 result.pop(); 328 result.pop();
329 ASSERT(!this->is_empty()); 329 DCHECK(!this->is_empty());
330 return result; 330 return result;
331 } 331 }
332 }; 332 };
333 333
334 } } // namespace v8::internal 334 } } // namespace v8::internal
335 335
336 #endif // V8_EFFECTS_H_ 336 #endif // V8_EFFECTS_H_
OLDNEW
« no previous file with comments | « src/dtoa.cc ('k') | src/elements.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698