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

Side by Side Diff: src/handles.h

Issue 2360983002: Enable component builds for fuzzers (Closed)
Patch Set: Rebase Created 4 years, 2 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
« no previous file with comments | « src/factory.h ('k') | src/lookup.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HANDLES_H_ 5 #ifndef V8_HANDLES_H_
6 #define V8_HANDLES_H_ 6 #define V8_HANDLES_H_
7 7
8 #include "include/v8.h" 8 #include "include/v8.h"
9 #include "src/base/functional.h" 9 #include "src/base/functional.h"
10 #include "src/base/macros.h" 10 #include "src/base/macros.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 // garbage collector will no longer track the object stored in the 259 // garbage collector will no longer track the object stored in the
260 // handle and may deallocate it. The behavior of accessing a handle 260 // handle and may deallocate it. The behavior of accessing a handle
261 // for which the handle scope has been deleted is undefined. 261 // for which the handle scope has been deleted is undefined.
262 class HandleScope { 262 class HandleScope {
263 public: 263 public:
264 explicit inline HandleScope(Isolate* isolate); 264 explicit inline HandleScope(Isolate* isolate);
265 265
266 inline ~HandleScope(); 266 inline ~HandleScope();
267 267
268 // Counts the number of allocated handles. 268 // Counts the number of allocated handles.
269 static int NumberOfHandles(Isolate* isolate); 269 V8_EXPORT_PRIVATE static int NumberOfHandles(Isolate* isolate);
270 270
271 // Create a new handle or lookup a canonical handle. 271 // Create a new handle or lookup a canonical handle.
272 V8_INLINE static Object** GetHandle(Isolate* isolate, Object* value); 272 V8_INLINE static Object** GetHandle(Isolate* isolate, Object* value);
273 273
274 // Creates a new handle with the given value. 274 // Creates a new handle with the given value.
275 V8_INLINE static Object** CreateHandle(Isolate* isolate, Object* value); 275 V8_INLINE static Object** CreateHandle(Isolate* isolate, Object* value);
276 276
277 // Deallocates any extensions used by the current scope. 277 // Deallocates any extensions used by the current scope.
278 static void DeleteExtensions(Isolate* isolate); 278 V8_EXPORT_PRIVATE static void DeleteExtensions(Isolate* isolate);
279 279
280 static Address current_next_address(Isolate* isolate); 280 static Address current_next_address(Isolate* isolate);
281 static Address current_limit_address(Isolate* isolate); 281 static Address current_limit_address(Isolate* isolate);
282 static Address current_level_address(Isolate* isolate); 282 static Address current_level_address(Isolate* isolate);
283 283
284 // Closes the HandleScope (invalidating all handles 284 // Closes the HandleScope (invalidating all handles
285 // created in the scope of the HandleScope) and returns 285 // created in the scope of the HandleScope) and returns
286 // a Handle backed by the parent scope holding the 286 // a Handle backed by the parent scope holding the
287 // value of the argument handle. 287 // value of the argument handle.
288 template <typename T> 288 template <typename T>
(...skipping 14 matching lines...) Expand all
303 Isolate* isolate_; 303 Isolate* isolate_;
304 Object** prev_next_; 304 Object** prev_next_;
305 Object** prev_limit_; 305 Object** prev_limit_;
306 306
307 // Close the handle scope resetting limits to a previous state. 307 // Close the handle scope resetting limits to a previous state.
308 static inline void CloseScope(Isolate* isolate, 308 static inline void CloseScope(Isolate* isolate,
309 Object** prev_next, 309 Object** prev_next,
310 Object** prev_limit); 310 Object** prev_limit);
311 311
312 // Extend the handle scope making room for more handles. 312 // Extend the handle scope making room for more handles.
313 static Object** Extend(Isolate* isolate); 313 V8_EXPORT_PRIVATE static Object** Extend(Isolate* isolate);
314 314
315 #ifdef ENABLE_HANDLE_ZAPPING 315 #ifdef ENABLE_HANDLE_ZAPPING
316 // Zaps the handles in the half-open interval [start, end). 316 // Zaps the handles in the half-open interval [start, end).
317 static void ZapRange(Object** start, Object** end); 317 V8_EXPORT_PRIVATE static void ZapRange(Object** start, Object** end);
318 #endif 318 #endif
319 319
320 friend class v8::HandleScope; 320 friend class v8::HandleScope;
321 friend class DeferredHandles; 321 friend class DeferredHandles;
322 friend class DeferredHandleScope; 322 friend class DeferredHandleScope;
323 friend class HandleScopeImplementer; 323 friend class HandleScopeImplementer;
324 friend class Isolate; 324 friend class Isolate;
325 325
326 DISALLOW_COPY_AND_ASSIGN(HandleScope); 326 DISALLOW_COPY_AND_ASSIGN(HandleScope);
327 }; 327 };
328 328
329 329
330 // Forward declarations for CanonicalHandleScope. 330 // Forward declarations for CanonicalHandleScope.
331 template <typename V> 331 template <typename V>
332 class IdentityMap; 332 class IdentityMap;
333 class RootIndexMap; 333 class RootIndexMap;
334 334
335 335
336 // A CanonicalHandleScope does not open a new HandleScope. It changes the 336 // A CanonicalHandleScope does not open a new HandleScope. It changes the
337 // existing HandleScope so that Handles created within are canonicalized. 337 // existing HandleScope so that Handles created within are canonicalized.
338 // This does not apply to nested inner HandleScopes unless a nested 338 // This does not apply to nested inner HandleScopes unless a nested
339 // CanonicalHandleScope is introduced. Handles are only canonicalized within 339 // CanonicalHandleScope is introduced. Handles are only canonicalized within
340 // the same CanonicalHandleScope, but not across nested ones. 340 // the same CanonicalHandleScope, but not across nested ones.
341 class CanonicalHandleScope final { 341 class CanonicalHandleScope final {
342 public: 342 public:
343 explicit CanonicalHandleScope(Isolate* isolate); 343 explicit CanonicalHandleScope(Isolate* isolate);
344 ~CanonicalHandleScope(); 344 ~CanonicalHandleScope();
345 345
346 private: 346 private:
347 Object** Lookup(Object* object); 347 V8_EXPORT_PRIVATE Object** Lookup(Object* object);
348 348
349 Isolate* isolate_; 349 Isolate* isolate_;
350 Zone zone_; 350 Zone zone_;
351 RootIndexMap* root_index_map_; 351 RootIndexMap* root_index_map_;
352 IdentityMap<Object**>* identity_map_; 352 IdentityMap<Object**>* identity_map_;
353 // Ordinary nested handle scopes within the current one are not canonical. 353 // Ordinary nested handle scopes within the current one are not canonical.
354 int canonical_level_; 354 int canonical_level_;
355 // We may have nested canonical scopes. Handles are canonical within each one. 355 // We may have nested canonical scopes. Handles are canonical within each one.
356 CanonicalHandleScope* prev_canonical_scope_; 356 CanonicalHandleScope* prev_canonical_scope_;
357 357
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 next = limit = NULL; 411 next = limit = NULL;
412 sealed_level = level = 0; 412 sealed_level = level = 0;
413 canonical_scope = NULL; 413 canonical_scope = NULL;
414 } 414 }
415 }; 415 };
416 416
417 } // namespace internal 417 } // namespace internal
418 } // namespace v8 418 } // namespace v8
419 419
420 #endif // V8_HANDLES_H_ 420 #endif // V8_HANDLES_H_
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/lookup.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698