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