| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 Isolate* isolate() { return isolate_; } | 149 Isolate* isolate() { return isolate_; } |
| 150 | 150 |
| 151 private: | 151 private: |
| 152 // Prevent heap allocation or illegal handle scopes. | 152 // Prevent heap allocation or illegal handle scopes. |
| 153 HandleScope(const HandleScope&); | 153 HandleScope(const HandleScope&); |
| 154 void operator=(const HandleScope&); | 154 void operator=(const HandleScope&); |
| 155 void* operator new(size_t size); | 155 void* operator new(size_t size); |
| 156 void operator delete(void* size_t); | 156 void operator delete(void* size_t); |
| 157 | 157 |
| 158 inline void CloseScope(); | |
| 159 | |
| 160 Isolate* isolate_; | 158 Isolate* isolate_; |
| 161 Object** prev_next_; | 159 Object** prev_next_; |
| 162 Object** prev_limit_; | 160 Object** prev_limit_; |
| 163 | 161 |
| 162 // Close the handle scope resetting limits to a previous state. |
| 163 static inline void CloseScope(Isolate* isolate, |
| 164 Object** prev_next, |
| 165 Object** prev_limit); |
| 166 |
| 164 // Extend the handle scope making room for more handles. | 167 // Extend the handle scope making room for more handles. |
| 165 static internal::Object** Extend(Isolate* isolate); | 168 static internal::Object** Extend(Isolate* isolate); |
| 166 | 169 |
| 167 #ifdef ENABLE_EXTRA_CHECKS | 170 #ifdef ENABLE_EXTRA_CHECKS |
| 168 // Zaps the handles in the half-open interval [start, end). | 171 // Zaps the handles in the half-open interval [start, end). |
| 169 static void ZapRange(internal::Object** start, internal::Object** end); | 172 static void ZapRange(Object** start, Object** end); |
| 170 #endif | 173 #endif |
| 171 | 174 |
| 172 friend class v8::HandleScope; | 175 friend class v8::HandleScope; |
| 173 friend class v8::internal::DeferredHandles; | 176 friend class v8::internal::DeferredHandles; |
| 174 friend class v8::internal::HandleScopeImplementer; | 177 friend class v8::internal::HandleScopeImplementer; |
| 175 friend class v8::internal::Isolate; | 178 friend class v8::internal::Isolate; |
| 176 }; | 179 }; |
| 177 | 180 |
| 178 | 181 |
| 179 class DeferredHandles; | 182 class DeferredHandles; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 class NoHandleAllocation BASE_EMBEDDED { | 333 class NoHandleAllocation BASE_EMBEDDED { |
| 331 public: | 334 public: |
| 332 #ifndef DEBUG | 335 #ifndef DEBUG |
| 333 explicit NoHandleAllocation(Isolate* isolate) {} | 336 explicit NoHandleAllocation(Isolate* isolate) {} |
| 334 ~NoHandleAllocation() {} | 337 ~NoHandleAllocation() {} |
| 335 #else | 338 #else |
| 336 explicit inline NoHandleAllocation(Isolate* isolate); | 339 explicit inline NoHandleAllocation(Isolate* isolate); |
| 337 inline ~NoHandleAllocation(); | 340 inline ~NoHandleAllocation(); |
| 338 private: | 341 private: |
| 339 Isolate* isolate_; | 342 Isolate* isolate_; |
| 343 Object** limit_; |
| 340 int level_; | 344 int level_; |
| 341 bool active_; | 345 bool active_; |
| 342 #endif | 346 #endif |
| 343 }; | 347 }; |
| 344 | 348 |
| 345 | 349 |
| 346 class HandleDereferenceGuard BASE_EMBEDDED { | 350 class HandleDereferenceGuard BASE_EMBEDDED { |
| 347 public: | 351 public: |
| 348 enum State { ALLOW, DISALLOW, DISALLOW_DEFERRED }; | 352 enum State { ALLOW, DISALLOW, DISALLOW_DEFERRED }; |
| 349 #ifndef DEBUG | 353 #ifndef DEBUG |
| (...skipping 12 matching lines...) Expand all Loading... |
| 362 #define ALLOW_HANDLE_DEREF(isolate, why_this_is_safe) \ | 366 #define ALLOW_HANDLE_DEREF(isolate, why_this_is_safe) \ |
| 363 HandleDereferenceGuard allow_deref(isolate, \ | 367 HandleDereferenceGuard allow_deref(isolate, \ |
| 364 HandleDereferenceGuard::ALLOW); | 368 HandleDereferenceGuard::ALLOW); |
| 365 #else | 369 #else |
| 366 #define ALLOW_HANDLE_DEREF(isolate, why_this_is_safe) | 370 #define ALLOW_HANDLE_DEREF(isolate, why_this_is_safe) |
| 367 #endif // DEBUG | 371 #endif // DEBUG |
| 368 | 372 |
| 369 } } // namespace v8::internal | 373 } } // namespace v8::internal |
| 370 | 374 |
| 371 #endif // V8_HANDLES_H_ | 375 #endif // V8_HANDLES_H_ |
| OLD | NEW |