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

Side by Side Diff: src/handles.h

Issue 12049012: Avoid handle dereference during graph optimization. (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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 a = b; // Fake assignment to enforce type checks. 58 a = b; // Fake assignment to enforce type checks.
59 USE(a); 59 USE(a);
60 #endif 60 #endif
61 location_ = reinterpret_cast<T**>(handle.location()); 61 location_ = reinterpret_cast<T**>(handle.location());
62 } 62 }
63 63
64 INLINE(T* operator ->() const) { return operator*(); } 64 INLINE(T* operator ->() const) { return operator*(); }
65 65
66 // Check if this handle refers to the exact same object as the other handle. 66 // Check if this handle refers to the exact same object as the other handle.
67 bool is_identical_to(const Handle<T> other) const { 67 bool is_identical_to(const Handle<T> other) const {
68 return operator*() == *other; 68 return *location_ == *other.location();
Jakob Kummerow 2013/01/23 12:09:18 Why "location_" vs "location()"? Let's be consiste
Yang 2013/01/23 13:34:25 Done.
69 } 69 }
70 70
71 // Provides the C++ dereference operator. 71 // Provides the C++ dereference operator.
72 INLINE(T* operator*() const); 72 INLINE(T* operator*() const);
73 73
74 // Returns the address to where the raw pointer is stored. 74 // Returns the address to where the raw pointer is stored.
75 T** location() const { 75 T** location() const {
76 ASSERT(location_ == NULL || 76 ASSERT(location_ == NULL ||
77 reinterpret_cast<Address>(*location_) != kZapValue); 77 reinterpret_cast<Address>(*location_) != kZapValue);
78 return location_; 78 return location_;
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 ~NoHandleAllocation() {} 332 ~NoHandleAllocation() {}
333 #else 333 #else
334 inline NoHandleAllocation(); 334 inline NoHandleAllocation();
335 inline ~NoHandleAllocation(); 335 inline ~NoHandleAllocation();
336 private: 336 private:
337 int level_; 337 int level_;
338 bool active_; 338 bool active_;
339 #endif 339 #endif
340 }; 340 };
341 341
342
343 class NoHandleDereference BASE_EMBEDDED {
344 public:
345 #ifndef DEBUG
346 NoHandleDereference() {}
347 ~NoHandleDereference() {}
348 #else
349 inline NoHandleDereference();
350 inline ~NoHandleDereference();
351 private:
352 int old_state_;
Jakob Kummerow 2013/01/23 12:09:18 This is used to store bools, so it should be a boo
Yang 2013/01/23 13:34:25 Done.
353 bool active_;
354 #endif
355 };
356
357
358 class AllowHandleDereference BASE_EMBEDDED {
359 public:
360 #ifndef DEBUG
361 AllowHandleDereference() {}
362 ~AllowHandleDereference() {}
363 #else
364 inline AllowHandleDereference();
365 inline ~AllowHandleDereference();
366 private:
367 int old_state_;
Jakob Kummerow 2013/01/23 12:09:18 Same here.
Yang 2013/01/23 13:34:25 Done.
368 bool active_;
369 #endif
370 };
371
342 } } // namespace v8::internal 372 } } // namespace v8::internal
343 373
344 #endif // V8_HANDLES_H_ 374 #endif // V8_HANDLES_H_
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/handles-inl.h » ('j') | src/handles-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698