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

Side by Side Diff: src/handles.h

Issue 12832002: Parallel recompilation: fewer handle dereferences and tighter checks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 9 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/flags.cc ('k') | src/handles-inl.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 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 S* b = NULL; 57 S* b = NULL;
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 INLINE(bool is_identical_to(const Handle<T> other) const);
68 return *location_ == *other.location_;
69 }
70 68
71 // Provides the C++ dereference operator. 69 // Provides the C++ dereference operator.
72 INLINE(T* operator*() const); 70 INLINE(T* operator*() const);
73 71
74 // Returns the address to where the raw pointer is stored. 72 // Returns the address to where the raw pointer is stored.
75 INLINE(T** location() const); 73 INLINE(T** location() const);
76 74
77 template <class S> static Handle<T> cast(Handle<S> that) { 75 template <class S> static Handle<T> cast(Handle<S> that) {
78 T::cast(*that); 76 T::cast(*that);
79 return Handle<T>(reinterpret_cast<T**>(that.location())); 77 return Handle<T>(reinterpret_cast<T**>(that.location()));
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 explicit inline NoHandleAllocation(Isolate* isolate); 332 explicit inline NoHandleAllocation(Isolate* isolate);
335 inline ~NoHandleAllocation(); 333 inline ~NoHandleAllocation();
336 private: 334 private:
337 Isolate* isolate_; 335 Isolate* isolate_;
338 int level_; 336 int level_;
339 bool active_; 337 bool active_;
340 #endif 338 #endif
341 }; 339 };
342 340
343 341
344 class NoHandleDereference BASE_EMBEDDED { 342 class HandleDereferenceGuard BASE_EMBEDDED {
345 public: 343 public:
344 enum State { ALLOW, DISALLOW };
346 #ifndef DEBUG 345 #ifndef DEBUG
347 explicit NoHandleDereference(Isolate* isolate) {} 346 HandleDereferenceGuard(Isolate* isolate, State state) { }
348 ~NoHandleDereference() {} 347 ~HandleDereferenceGuard() { }
349 #else 348 #else
350 explicit inline NoHandleDereference(Isolate* isolate); 349 inline HandleDereferenceGuard(Isolate* isolate, State state);
351 inline ~NoHandleDereference(); 350 inline ~HandleDereferenceGuard();
352 private: 351 private:
353 Isolate* isolate_; 352 Isolate* isolate_;
354 bool old_state_; 353 bool old_state_;
355 #endif
356 };
357
358
359 class AllowHandleDereference BASE_EMBEDDED {
360 public:
361 #ifndef DEBUG
362 explicit AllowHandleDereference(Isolate* isolate) {}
363 ~AllowHandleDereference() {}
364 #else
365 explicit inline AllowHandleDereference(Isolate* isolate);
366 inline ~AllowHandleDereference();
367 private:
368 Isolate* isolate_;
369 bool old_state_;
370 #endif 354 #endif
371 }; 355 };
372 356
373 } } // namespace v8::internal 357 } } // namespace v8::internal
374 358
375 #endif // V8_HANDLES_H_ 359 #endif // V8_HANDLES_H_
OLDNEW
« no previous file with comments | « src/flags.cc ('k') | src/handles-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698