OLD | NEW |
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 INLINE(bool ToHandle(Handle<T>* out)) { | 75 INLINE(bool ToHandle(Handle<T>* out)) { |
76 if (location_ == NULL) { | 76 if (location_ == NULL) { |
77 *out = Handle<T>::null(); | 77 *out = Handle<T>::null(); |
78 return false; | 78 return false; |
79 } else { | 79 } else { |
80 *out = Handle<T>(location_); | 80 *out = Handle<T>(location_); |
81 return true; | 81 return true; |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
| 85 bool is_null() const { return location_ == NULL; } |
| 86 |
85 protected: | 87 protected: |
86 T** location_; | 88 T** location_; |
87 | 89 |
88 // MaybeHandles of different classes are allowed to access each | 90 // MaybeHandles of different classes are allowed to access each |
89 // other's location_. | 91 // other's location_. |
90 template<class S> friend class MaybeHandle; | 92 template<class S> friend class MaybeHandle; |
91 }; | 93 }; |
92 | 94 |
93 // ---------------------------------------------------------------------------- | 95 // ---------------------------------------------------------------------------- |
94 // A Handle provides a reference to an object that survives relocation by | 96 // A Handle provides a reference to an object that survives relocation by |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 381 |
380 void Initialize() { | 382 void Initialize() { |
381 next = limit = NULL; | 383 next = limit = NULL; |
382 level = 0; | 384 level = 0; |
383 } | 385 } |
384 }; | 386 }; |
385 | 387 |
386 } } // namespace v8::internal | 388 } } // namespace v8::internal |
387 | 389 |
388 #endif // V8_HANDLES_H_ | 390 #endif // V8_HANDLES_H_ |
OLD | NEW |