| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // handle scope and a new one is created, all allocations will take | 112 // handle scope and a new one is created, all allocations will take |
| 113 // place in the new handle scope until it is deleted. After that, | 113 // place in the new handle scope until it is deleted. After that, |
| 114 // new handles will again be allocated in the original handle scope. | 114 // new handles will again be allocated in the original handle scope. |
| 115 // | 115 // |
| 116 // After the handle scope of a local handle has been deleted the | 116 // After the handle scope of a local handle has been deleted the |
| 117 // garbage collector will no longer track the object stored in the | 117 // garbage collector will no longer track the object stored in the |
| 118 // handle and may deallocate it. The behavior of accessing a handle | 118 // handle and may deallocate it. The behavior of accessing a handle |
| 119 // for which the handle scope has been deleted is undefined. | 119 // for which the handle scope has been deleted is undefined. |
| 120 class HandleScope { | 120 class HandleScope { |
| 121 public: | 121 public: |
| 122 inline HandleScope(); | |
| 123 explicit inline HandleScope(Isolate* isolate); | 122 explicit inline HandleScope(Isolate* isolate); |
| 124 | 123 |
| 125 inline ~HandleScope(); | 124 inline ~HandleScope(); |
| 126 | 125 |
| 127 // Counts the number of allocated handles. | 126 // Counts the number of allocated handles. |
| 128 static int NumberOfHandles(); | 127 static int NumberOfHandles(); |
| 129 | 128 |
| 130 // Creates a new handle with the given value. | 129 // Creates a new handle with the given value. |
| 131 template <typename T> | 130 template <typename T> |
| 132 static inline T** CreateHandle(T* value, Isolate* isolate); | 131 static inline T** CreateHandle(T* value, Isolate* isolate); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 inline AllowHandleDereference(); | 361 inline AllowHandleDereference(); |
| 363 inline ~AllowHandleDereference(); | 362 inline ~AllowHandleDereference(); |
| 364 private: | 363 private: |
| 365 bool old_state_; | 364 bool old_state_; |
| 366 #endif | 365 #endif |
| 367 }; | 366 }; |
| 368 | 367 |
| 369 } } // namespace v8::internal | 368 } } // namespace v8::internal |
| 370 | 369 |
| 371 #endif // V8_HANDLES_H_ | 370 #endif // V8_HANDLES_H_ |
| OLD | NEW |