OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
475 | 475 |
476 DISALLOW_COPY_AND_ASSIGN(ExternalStringTable); | 476 DISALLOW_COPY_AND_ASSIGN(ExternalStringTable); |
477 }; | 477 }; |
478 | 478 |
479 | 479 |
480 enum ArrayStorageAllocationMode { | 480 enum ArrayStorageAllocationMode { |
481 DONT_INITIALIZE_ARRAY_ELEMENTS, | 481 DONT_INITIALIZE_ARRAY_ELEMENTS, |
482 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE | 482 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE |
483 }; | 483 }; |
484 | 484 |
485 | |
486 enum AllocationMode { NEW_SPACE_ALLOCATION, OLD_SPACE_ALLOCATION }; | |
Michael Starzinger
2013/07/31 16:43:16
Why not use the existing PretenureFlag instead?
Hannes Payer (out of office)
2013/08/01 07:30:57
Done.
| |
487 | |
488 | |
485 class Heap { | 489 class Heap { |
486 public: | 490 public: |
487 // Configure heap size before setup. Return false if the heap has been | 491 // Configure heap size before setup. Return false if the heap has been |
488 // set up already. | 492 // set up already. |
489 bool ConfigureHeap(int max_semispace_size, | 493 bool ConfigureHeap(int max_semispace_size, |
490 intptr_t max_old_gen_size, | 494 intptr_t max_old_gen_size, |
491 intptr_t max_executable_size); | 495 intptr_t max_executable_size); |
492 bool ConfigureHeapDefault(); | 496 bool ConfigureHeapDefault(); |
493 | 497 |
494 // Prepares the heap, setting up memory areas that are needed in the isolate | 498 // Prepares the heap, setting up memory areas that are needed in the isolate |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1391 bool Contains(Address addr); | 1395 bool Contains(Address addr); |
1392 bool Contains(HeapObject* value); | 1396 bool Contains(HeapObject* value); |
1393 | 1397 |
1394 // Checks whether an address/object in a space. | 1398 // Checks whether an address/object in a space. |
1395 // Currently used by tests, serialization and heap verification only. | 1399 // Currently used by tests, serialization and heap verification only. |
1396 bool InSpace(Address addr, AllocationSpace space); | 1400 bool InSpace(Address addr, AllocationSpace space); |
1397 bool InSpace(HeapObject* value, AllocationSpace space); | 1401 bool InSpace(HeapObject* value, AllocationSpace space); |
1398 | 1402 |
1399 // Finds out which space an object should get promoted to based on its type. | 1403 // Finds out which space an object should get promoted to based on its type. |
1400 inline OldSpace* TargetSpace(HeapObject* object); | 1404 inline OldSpace* TargetSpace(HeapObject* object); |
1401 inline AllocationSpace TargetSpaceId(InstanceType type); | 1405 static inline AllocationSpace TargetSpaceId(InstanceType type); |
1402 | 1406 |
1403 // Sets the stub_cache_ (only used when expanding the dictionary). | 1407 // Sets the stub_cache_ (only used when expanding the dictionary). |
1404 void public_set_code_stubs(UnseededNumberDictionary* value) { | 1408 void public_set_code_stubs(UnseededNumberDictionary* value) { |
1405 roots_[kCodeStubsRootIndex] = value; | 1409 roots_[kCodeStubsRootIndex] = value; |
1406 } | 1410 } |
1407 | 1411 |
1408 // Support for computing object sizes for old objects during GCs. Returns | 1412 // Support for computing object sizes for old objects during GCs. Returns |
1409 // a function that is guaranteed to be safe for computing object sizes in | 1413 // a function that is guaranteed to be safe for computing object sizes in |
1410 // the current GC phase. | 1414 // the current GC phase. |
1411 HeapObjectCallback GcSafeSizeOfOldObjectFunction() { | 1415 HeapObjectCallback GcSafeSizeOfOldObjectFunction() { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1538 // Adjusts the amount of registered external memory. | 1542 // Adjusts the amount of registered external memory. |
1539 // Returns the adjusted value. | 1543 // Returns the adjusted value. |
1540 inline intptr_t AdjustAmountOfExternalAllocatedMemory( | 1544 inline intptr_t AdjustAmountOfExternalAllocatedMemory( |
1541 intptr_t change_in_bytes); | 1545 intptr_t change_in_bytes); |
1542 | 1546 |
1543 // Allocate uninitialized fixed array. | 1547 // Allocate uninitialized fixed array. |
1544 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length); | 1548 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length); |
1545 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length, | 1549 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length, |
1546 PretenureFlag pretenure); | 1550 PretenureFlag pretenure); |
1547 | 1551 |
1548 // Predicate that governs global pre-tenuring decisions based on observed | 1552 // Returns the allocation mode (pre-tenuring) based on observed promotion |
1549 // promotion rates of previous collections. | 1553 // rates of previous collections. |
1550 inline bool ShouldGloballyPretenure() { | 1554 inline AllocationMode GetAllocationMode() { |
Michael Starzinger
2013/07/31 16:43:16
suggestion: s/GetAllocationMode/GetGlobalPretenure
Hannes Payer (out of office)
2013/08/01 07:30:57
Done.
| |
1551 return FLAG_pretenuring && new_space_high_promotion_mode_active_; | 1555 return FLAG_pretenuring && new_space_high_promotion_mode_active_ ? |
1556 OLD_SPACE_ALLOCATION : NEW_SPACE_ALLOCATION; | |
1552 } | 1557 } |
1553 | 1558 |
1554 // This is only needed for testing high promotion mode. | 1559 // This is only needed for testing high promotion mode. |
1555 void SetNewSpaceHighPromotionModeActive(bool mode) { | 1560 void SetNewSpaceHighPromotionModeActive(bool mode) { |
1556 new_space_high_promotion_mode_active_ = mode; | 1561 new_space_high_promotion_mode_active_ = mode; |
1557 } | 1562 } |
1558 | 1563 |
1559 inline PretenureFlag GetPretenureMode() { | 1564 inline PretenureFlag GetPretenureMode() { |
1560 return new_space_high_promotion_mode_active_ ? TENURED : NOT_TENURED; | 1565 return new_space_high_promotion_mode_active_ ? TENURED : NOT_TENURED; |
1561 } | 1566 } |
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3050 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 3055 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
3051 | 3056 |
3052 private: | 3057 private: |
3053 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 3058 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
3054 }; | 3059 }; |
3055 #endif // DEBUG | 3060 #endif // DEBUG |
3056 | 3061 |
3057 } } // namespace v8::internal | 3062 } } // namespace v8::internal |
3058 | 3063 |
3059 #endif // V8_HEAP_H_ | 3064 #endif // V8_HEAP_H_ |
OLD | NEW |