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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 // separate from old space strings. | 424 // separate from old space strings. |
425 List<Object*> new_space_strings_; | 425 List<Object*> new_space_strings_; |
426 List<Object*> old_space_strings_; | 426 List<Object*> old_space_strings_; |
427 | 427 |
428 Heap* heap_; | 428 Heap* heap_; |
429 | 429 |
430 DISALLOW_COPY_AND_ASSIGN(ExternalStringTable); | 430 DISALLOW_COPY_AND_ASSIGN(ExternalStringTable); |
431 }; | 431 }; |
432 | 432 |
433 | 433 |
| 434 enum ArrayStorageAllocationMode { |
| 435 DONT_INITIALIZE_ARRAY_ELEMENTS, |
| 436 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE |
| 437 }; |
| 438 |
434 class Heap { | 439 class Heap { |
435 public: | 440 public: |
436 // Configure heap size before setup. Return false if the heap has been | 441 // Configure heap size before setup. Return false if the heap has been |
437 // set up already. | 442 // set up already. |
438 bool ConfigureHeap(int max_semispace_size, | 443 bool ConfigureHeap(int max_semispace_size, |
439 intptr_t max_old_gen_size, | 444 intptr_t max_old_gen_size, |
440 intptr_t max_executable_size); | 445 intptr_t max_executable_size); |
441 bool ConfigureHeapDefault(); | 446 bool ConfigureHeapDefault(); |
442 | 447 |
443 // Initializes the global object heap. If create_heap_objects is true, | 448 // Initializes the global object heap. If create_heap_objects is true, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 bool UncommitFromSpace() { return new_space_.UncommitFromSpace(); } | 530 bool UncommitFromSpace() { return new_space_.UncommitFromSpace(); } |
526 | 531 |
527 // Allocates and initializes a new JavaScript object based on a | 532 // Allocates and initializes a new JavaScript object based on a |
528 // constructor. | 533 // constructor. |
529 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 534 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
530 // failed. | 535 // failed. |
531 // Please note this does not perform a garbage collection. | 536 // Please note this does not perform a garbage collection. |
532 MUST_USE_RESULT MaybeObject* AllocateJSObject( | 537 MUST_USE_RESULT MaybeObject* AllocateJSObject( |
533 JSFunction* constructor, PretenureFlag pretenure = NOT_TENURED); | 538 JSFunction* constructor, PretenureFlag pretenure = NOT_TENURED); |
534 | 539 |
| 540 // Allocate a JSArray with no elements |
| 541 MUST_USE_RESULT MaybeObject* AllocateEmptyJSArray( |
| 542 ElementsKind elements_kind, |
| 543 PretenureFlag pretenure = NOT_TENURED) { |
| 544 return AllocateJSArrayAndStorage(elements_kind, 0, 0, |
| 545 DONT_INITIALIZE_ARRAY_ELEMENTS, |
| 546 pretenure); |
| 547 } |
| 548 |
| 549 // Allocate a JSArray with a specified length but elements that are left |
| 550 // uninitialized. |
| 551 MUST_USE_RESULT MaybeObject* AllocateJSArrayAndStorage( |
| 552 ElementsKind elements_kind, |
| 553 int length, |
| 554 int capacity, |
| 555 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS, |
| 556 PretenureFlag pretenure = NOT_TENURED); |
| 557 |
| 558 // Allocate a JSArray with no elements |
| 559 MUST_USE_RESULT MaybeObject* AllocateJSArrayWithElements( |
| 560 FixedArrayBase* array_base, |
| 561 ElementsKind elements_kind, |
| 562 PretenureFlag pretenure = NOT_TENURED); |
| 563 |
535 // Allocates and initializes a new global object based on a constructor. | 564 // Allocates and initializes a new global object based on a constructor. |
536 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 565 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
537 // failed. | 566 // failed. |
538 // Please note this does not perform a garbage collection. | 567 // Please note this does not perform a garbage collection. |
539 MUST_USE_RESULT MaybeObject* AllocateGlobalObject(JSFunction* constructor); | 568 MUST_USE_RESULT MaybeObject* AllocateGlobalObject(JSFunction* constructor); |
540 | 569 |
541 // Returns a deep copy of the JavaScript object. | 570 // Returns a deep copy of the JavaScript object. |
542 // Properties and elements are copied too. | 571 // Properties and elements are copied too. |
543 // Returns failure if allocation failed. | 572 // Returns failure if allocation failed. |
544 MUST_USE_RESULT MaybeObject* CopyJSObject(JSObject* source); | 573 MUST_USE_RESULT MaybeObject* CopyJSObject(JSObject* source); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 int length, | 800 int length, |
772 PretenureFlag pretenure); | 801 PretenureFlag pretenure); |
773 | 802 |
774 // Allocates a fixed double array with uninitialized values. Returns | 803 // Allocates a fixed double array with uninitialized values. Returns |
775 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. | 804 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. |
776 // Please note this does not perform a garbage collection. | 805 // Please note this does not perform a garbage collection. |
777 MUST_USE_RESULT MaybeObject* AllocateUninitializedFixedDoubleArray( | 806 MUST_USE_RESULT MaybeObject* AllocateUninitializedFixedDoubleArray( |
778 int length, | 807 int length, |
779 PretenureFlag pretenure = NOT_TENURED); | 808 PretenureFlag pretenure = NOT_TENURED); |
780 | 809 |
| 810 // Allocates a fixed double array with hole values. Returns |
| 811 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. |
| 812 // Please note this does not perform a garbage collection. |
| 813 MUST_USE_RESULT MaybeObject* AllocateFixedDoubleArrayWithHoles( |
| 814 int length, |
| 815 PretenureFlag pretenure = NOT_TENURED); |
| 816 |
781 // AllocateHashTable is identical to AllocateFixedArray except | 817 // AllocateHashTable is identical to AllocateFixedArray except |
782 // that the resulting object has hash_table_map as map. | 818 // that the resulting object has hash_table_map as map. |
783 MUST_USE_RESULT MaybeObject* AllocateHashTable( | 819 MUST_USE_RESULT MaybeObject* AllocateHashTable( |
784 int length, PretenureFlag pretenure = NOT_TENURED); | 820 int length, PretenureFlag pretenure = NOT_TENURED); |
785 | 821 |
786 // Allocate a global (but otherwise uninitialized) context. | 822 // Allocate a global (but otherwise uninitialized) context. |
787 MUST_USE_RESULT MaybeObject* AllocateGlobalContext(); | 823 MUST_USE_RESULT MaybeObject* AllocateGlobalContext(); |
788 | 824 |
789 // Allocate a function context. | 825 // Allocate a function context. |
790 MUST_USE_RESULT MaybeObject* AllocateFunctionContext(int length, | 826 MUST_USE_RESULT MaybeObject* AllocateFunctionContext(int length, |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1736 // because of a gcc-4.4 bug that assigns wrong vtable entries. | 1772 // because of a gcc-4.4 bug that assigns wrong vtable entries. |
1737 NO_INLINE(void CreateJSEntryStub()); | 1773 NO_INLINE(void CreateJSEntryStub()); |
1738 NO_INLINE(void CreateJSConstructEntryStub()); | 1774 NO_INLINE(void CreateJSConstructEntryStub()); |
1739 | 1775 |
1740 void CreateFixedStubs(); | 1776 void CreateFixedStubs(); |
1741 | 1777 |
1742 MaybeObject* CreateOddball(const char* to_string, | 1778 MaybeObject* CreateOddball(const char* to_string, |
1743 Object* to_number, | 1779 Object* to_number, |
1744 byte kind); | 1780 byte kind); |
1745 | 1781 |
| 1782 // Allocate a JSArray with no elements |
| 1783 MUST_USE_RESULT MaybeObject* AllocateJSArray( |
| 1784 ElementsKind elements_kind, |
| 1785 PretenureFlag pretenure = NOT_TENURED); |
| 1786 |
1746 // Allocate empty fixed array. | 1787 // Allocate empty fixed array. |
1747 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedArray(); | 1788 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedArray(); |
1748 | 1789 |
1749 // Allocate empty fixed double array. | 1790 // Allocate empty fixed double array. |
1750 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedDoubleArray(); | 1791 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedDoubleArray(); |
1751 | 1792 |
1752 // Performs a minor collection in new generation. | 1793 // Performs a minor collection in new generation. |
1753 void Scavenge(); | 1794 void Scavenge(); |
1754 | 1795 |
1755 static String* UpdateNewSpaceReferenceInExternalStringTableEntry( | 1796 static String* UpdateNewSpaceReferenceInExternalStringTableEntry( |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2617 | 2658 |
2618 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2659 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2619 }; | 2660 }; |
2620 #endif // DEBUG || LIVE_OBJECT_LIST | 2661 #endif // DEBUG || LIVE_OBJECT_LIST |
2621 | 2662 |
2622 } } // namespace v8::internal | 2663 } } // namespace v8::internal |
2623 | 2664 |
2624 #undef HEAP | 2665 #undef HEAP |
2625 | 2666 |
2626 #endif // V8_HEAP_H_ | 2667 #endif // V8_HEAP_H_ |
OLD | NEW |