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

Side by Side Diff: src/global-handles.h

Issue 22795004: abstract eternal into class (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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
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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 I18N_TEMPLATE_TWO, 389 I18N_TEMPLATE_TWO,
390 390
391 NUMBER_OF_SINGLETON_HANDLES 391 NUMBER_OF_SINGLETON_HANDLES
392 }; 392 };
393 393
394 EternalHandles(); 394 EternalHandles();
395 ~EternalHandles(); 395 ~EternalHandles();
396 396
397 int NumberOfHandles() { return size_; } 397 int NumberOfHandles() { return size_; }
398 398
399 // Create an EternalHandle, returning the index. 399 // Create an EternalHandle, overwriting the index.
400 int Create(Isolate* isolate, Object* object); 400 void Create(Isolate* isolate, Object* object, int* index);
rossberg 2013/08/12 15:13:13 Same here.
401 401
402 // Grab the handle for an existing EternalHandle. 402 // Grab the handle for an existing EternalHandle.
403 inline Handle<Object> Get(int index) { 403 inline Handle<Object> Get(int index) {
404 return Handle<Object>(GetLocation(index)); 404 return Handle<Object>(GetLocation(index));
405 } 405 }
406 406
407 // Grab the handle for an existing SingletonHandle. 407 // Grab the handle for an existing SingletonHandle.
408 inline Handle<Object> GetSingleton(SingletonHandle singleton) { 408 inline Handle<Object> GetSingleton(SingletonHandle singleton) {
409 ASSERT(Exists(singleton)); 409 ASSERT(Exists(singleton));
410 return Get(singleton_handles_[singleton]); 410 return Get(singleton_handles_[singleton]);
411 } 411 }
412 412
413 // Checks whether a SingletonHandle has been assigned. 413 // Checks whether a SingletonHandle has been assigned.
414 inline bool Exists(SingletonHandle singleton) { 414 inline bool Exists(SingletonHandle singleton) {
415 return singleton_handles_[singleton] != kInvalidIndex; 415 return singleton_handles_[singleton] != kInvalidIndex;
416 } 416 }
417 417
418 // Assign a SingletonHandle to an empty slot and returns the handle. 418 // Assign a SingletonHandle to an empty slot and returns the handle.
419 Handle<Object> CreateSingleton(Isolate* isolate, 419 Handle<Object> CreateSingleton(Isolate* isolate,
420 Object* object, 420 Object* object,
421 SingletonHandle singleton) { 421 SingletonHandle singleton) {
422 ASSERT(singleton_handles_[singleton] == kInvalidIndex); 422 Create(isolate, object, &singleton_handles_[singleton]);
423 singleton_handles_[singleton] = Create(isolate, object);
424 return Get(singleton_handles_[singleton]); 423 return Get(singleton_handles_[singleton]);
425 } 424 }
426 425
427 // Iterates over all handles. 426 // Iterates over all handles.
428 void IterateAllRoots(ObjectVisitor* visitor); 427 void IterateAllRoots(ObjectVisitor* visitor);
429 // Iterates over all handles which might be in new space. 428 // Iterates over all handles which might be in new space.
430 void IterateNewSpaceRoots(ObjectVisitor* visitor); 429 void IterateNewSpaceRoots(ObjectVisitor* visitor);
431 // Rebuilds new space list. 430 // Rebuilds new space list.
432 void PostGarbageCollectionProcessing(Heap* heap); 431 void PostGarbageCollectionProcessing(Heap* heap);
433 432
(...skipping 14 matching lines...) Expand all
448 List<int> new_space_indices_; 447 List<int> new_space_indices_;
449 int singleton_handles_[NUMBER_OF_SINGLETON_HANDLES]; 448 int singleton_handles_[NUMBER_OF_SINGLETON_HANDLES];
450 449
451 DISALLOW_COPY_AND_ASSIGN(EternalHandles); 450 DISALLOW_COPY_AND_ASSIGN(EternalHandles);
452 }; 451 };
453 452
454 453
455 } } // namespace v8::internal 454 } } // namespace v8::internal
456 455
457 #endif // V8_GLOBAL_HANDLES_H_ 456 #endif // V8_GLOBAL_HANDLES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698