| 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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 // Uncommit unused semi space. | 585 // Uncommit unused semi space. |
| 586 bool UncommitFromSpace() { return new_space_.UncommitFromSpace(); } | 586 bool UncommitFromSpace() { return new_space_.UncommitFromSpace(); } |
| 587 | 587 |
| 588 // Allocates and initializes a new JavaScript object based on a | 588 // Allocates and initializes a new JavaScript object based on a |
| 589 // constructor. | 589 // constructor. |
| 590 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 590 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 591 // failed. | 591 // failed. |
| 592 // Please note this does not perform a garbage collection. | 592 // Please note this does not perform a garbage collection. |
| 593 MUST_USE_RESULT MaybeObject* AllocateJSObject( | 593 MUST_USE_RESULT MaybeObject* AllocateJSObject( |
| 594 JSFunction* constructor, | 594 JSFunction* constructor, |
| 595 PretenureFlag pretenure = NOT_TENURED, | 595 PretenureFlag pretenure = NOT_TENURED); |
| 596 AllocationSiteMode = DONT_TRACK_ALLOCATION_SITE, | 596 |
| 597 Handle<Object>* allocation_site_info_payload = NULL); | 597 MUST_USE_RESULT MaybeObject* AllocateJSObjectWithAllocationSite( |
| 598 JSFunction* constructor, |
| 599 Handle<Object> allocation_site_info_payload); |
| 598 | 600 |
| 599 MUST_USE_RESULT MaybeObject* AllocateJSModule(Context* context, | 601 MUST_USE_RESULT MaybeObject* AllocateJSModule(Context* context, |
| 600 ScopeInfo* scope_info); | 602 ScopeInfo* scope_info); |
| 601 | 603 |
| 602 // Allocate a JSArray with no elements | 604 // Allocate a JSArray with no elements |
| 603 MUST_USE_RESULT MaybeObject* AllocateEmptyJSArray( | 605 MUST_USE_RESULT MaybeObject* AllocateEmptyJSArray( |
| 604 ElementsKind elements_kind, | 606 ElementsKind elements_kind, |
| 605 AllocationSiteMode allocation_site_mode = DONT_TRACK_ALLOCATION_SITE, | |
| 606 Handle<Object> *allocation_site_payload = NULL, | |
| 607 PretenureFlag pretenure = NOT_TENURED) { | 607 PretenureFlag pretenure = NOT_TENURED) { |
| 608 // TODO(mvstanton): Danno's original change does something here, but I | |
| 609 // didn't include it because I don't see why we need it yet. | |
| 610 return AllocateJSArrayAndStorage(elements_kind, 0, 0, | 608 return AllocateJSArrayAndStorage(elements_kind, 0, 0, |
| 611 allocation_site_mode, | |
| 612 allocation_site_payload, | |
| 613 DONT_INITIALIZE_ARRAY_ELEMENTS, | 609 DONT_INITIALIZE_ARRAY_ELEMENTS, |
| 614 pretenure); | 610 pretenure); |
| 615 } | 611 } |
| 616 | 612 |
| 613 inline MUST_USE_RESULT MaybeObject* AllocateEmptyJSArrayWithAllocationSite( |
| 614 ElementsKind elements_kind, |
| 615 Handle<Object> allocation_site_payload); |
| 616 |
| 617 // Allocate a JSArray with a specified length but elements that are left | 617 // Allocate a JSArray with a specified length but elements that are left |
| 618 // uninitialized. | 618 // uninitialized. |
| 619 MUST_USE_RESULT MaybeObject* AllocateJSArrayAndStorage( | 619 MUST_USE_RESULT MaybeObject* AllocateJSArrayAndStorage( |
| 620 ElementsKind elements_kind, | 620 ElementsKind elements_kind, |
| 621 int length, | 621 int length, |
| 622 int capacity, | 622 int capacity, |
| 623 AllocationSiteMode allocation_site_info_mode = | |
| 624 DONT_TRACK_ALLOCATION_SITE, | |
| 625 Handle<Object> *allocation_site_payload = NULL, | |
| 626 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS, | 623 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS, |
| 627 PretenureFlag pretenure = NOT_TENURED); | 624 PretenureFlag pretenure = NOT_TENURED); |
| 628 | 625 |
| 626 MUST_USE_RESULT MaybeObject* AllocateJSArrayAndStorageWithAllocationSite( |
| 627 ElementsKind elements_kind, |
| 628 int length, |
| 629 int capacity, |
| 630 Handle<Object> allocation_site_payload, |
| 631 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS); |
| 632 |
| 633 MUST_USE_RESULT MaybeObject* AllocateJSArrayStorage( |
| 634 JSArray* array, |
| 635 int length, |
| 636 int capacity, |
| 637 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS); |
| 638 |
| 629 // Allocate a JSArray with no elements | 639 // Allocate a JSArray with no elements |
| 630 MUST_USE_RESULT MaybeObject* AllocateJSArrayWithElements( | 640 MUST_USE_RESULT MaybeObject* AllocateJSArrayWithElements( |
| 631 FixedArrayBase* array_base, | 641 FixedArrayBase* array_base, |
| 632 ElementsKind elements_kind, | 642 ElementsKind elements_kind, |
| 633 int length, | 643 int length, |
| 634 PretenureFlag pretenure = NOT_TENURED); | 644 PretenureFlag pretenure = NOT_TENURED); |
| 635 | 645 |
| 636 // Allocates and initializes a new global object based on a constructor. | 646 // Allocates and initializes a new global object based on a constructor. |
| 637 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 647 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 638 // failed. | 648 // failed. |
| 639 // Please note this does not perform a garbage collection. | 649 // Please note this does not perform a garbage collection. |
| 640 MUST_USE_RESULT MaybeObject* AllocateGlobalObject(JSFunction* constructor); | 650 MUST_USE_RESULT MaybeObject* AllocateGlobalObject(JSFunction* constructor); |
| 641 | 651 |
| 642 // Returns a deep copy of the JavaScript object. | 652 // Returns a deep copy of the JavaScript object. |
| 643 // Properties and elements are copied too. | 653 // Properties and elements are copied too. |
| 644 // Returns failure if allocation failed. | 654 // Returns failure if allocation failed. |
| 645 MUST_USE_RESULT MaybeObject* CopyJSObject( | 655 MUST_USE_RESULT MaybeObject* CopyJSObject(JSObject* source); |
| 646 JSObject* source, | 656 |
| 647 AllocationSiteMode mode = DONT_TRACK_ALLOCATION_SITE); | 657 MUST_USE_RESULT MaybeObject* CopyJSObjectWithAllocationSite(JSObject* source); |
| 648 | 658 |
| 649 // Allocates the function prototype. | 659 // Allocates the function prototype. |
| 650 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 660 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 651 // failed. | 661 // failed. |
| 652 // Please note this does not perform a garbage collection. | 662 // Please note this does not perform a garbage collection. |
| 653 MUST_USE_RESULT MaybeObject* AllocateFunctionPrototype(JSFunction* function); | 663 MUST_USE_RESULT MaybeObject* AllocateFunctionPrototype(JSFunction* function); |
| 654 | 664 |
| 655 // Allocates a Harmony proxy or function proxy. | 665 // Allocates a Harmony proxy or function proxy. |
| 656 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 666 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 657 // failed. | 667 // failed. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 678 // constructor. The object is reinitialized and behaves as an | 688 // constructor. The object is reinitialized and behaves as an |
| 679 // object that has been freshly allocated using the constructor. | 689 // object that has been freshly allocated using the constructor. |
| 680 MUST_USE_RESULT MaybeObject* ReinitializeJSGlobalProxy( | 690 MUST_USE_RESULT MaybeObject* ReinitializeJSGlobalProxy( |
| 681 JSFunction* constructor, JSGlobalProxy* global); | 691 JSFunction* constructor, JSGlobalProxy* global); |
| 682 | 692 |
| 683 // Allocates and initializes a new JavaScript object based on a map. | 693 // Allocates and initializes a new JavaScript object based on a map. |
| 684 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 694 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 685 // failed. | 695 // failed. |
| 686 // Please note this does not perform a garbage collection. | 696 // Please note this does not perform a garbage collection. |
| 687 MUST_USE_RESULT MaybeObject* AllocateJSObjectFromMap( | 697 MUST_USE_RESULT MaybeObject* AllocateJSObjectFromMap( |
| 688 Map* map, PretenureFlag pretenure = NOT_TENURED, | 698 Map* map, PretenureFlag pretenure = NOT_TENURED); |
| 689 AllocationSiteMode mode = DONT_TRACK_ALLOCATION_SITE, | 699 |
| 690 Handle<Object>* allocation_site_info_payload = NULL); | 700 MUST_USE_RESULT MaybeObject* AllocateJSObjectFromMapWithAllocationSite( |
| 701 Map* map, Handle<Object> allocation_site_info_payload); |
| 691 | 702 |
| 692 // Allocates a heap object based on the map. | 703 // Allocates a heap object based on the map. |
| 693 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 704 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 694 // failed. | 705 // failed. |
| 695 // Please note this function does not perform a garbage collection. | 706 // Please note this function does not perform a garbage collection. |
| 696 MUST_USE_RESULT MaybeObject* Allocate(Map* map, AllocationSpace space); | 707 MUST_USE_RESULT MaybeObject* Allocate(Map* map, AllocationSpace space); |
| 697 | 708 |
| 698 MUST_USE_RESULT MaybeObject* AllocateWithAllocationSiteInfo(Map* map, | 709 MUST_USE_RESULT MaybeObject* AllocateWithAllocationSite(Map* map, |
| 699 AllocationSpace space, | 710 AllocationSpace space, Handle<Object> allocation_site_info_payload); |
| 700 Handle<Object>* allocation_site_info_payload); | |
| 701 | 711 |
| 702 // Allocates a JS Map in the heap. | 712 // Allocates a JS Map in the heap. |
| 703 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 713 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 704 // failed. | 714 // failed. |
| 705 // Please note this function does not perform a garbage collection. | 715 // Please note this function does not perform a garbage collection. |
| 706 MUST_USE_RESULT MaybeObject* AllocateMap( | 716 MUST_USE_RESULT MaybeObject* AllocateMap( |
| 707 InstanceType instance_type, | 717 InstanceType instance_type, |
| 708 int instance_size, | 718 int instance_size, |
| 709 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); | 719 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); |
| 710 | 720 |
| (...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2026 | 2036 |
| 2027 void CreateFixedStubs(); | 2037 void CreateFixedStubs(); |
| 2028 | 2038 |
| 2029 MUST_USE_RESULT MaybeObject* CreateOddball(const char* to_string, | 2039 MUST_USE_RESULT MaybeObject* CreateOddball(const char* to_string, |
| 2030 Object* to_number, | 2040 Object* to_number, |
| 2031 byte kind); | 2041 byte kind); |
| 2032 | 2042 |
| 2033 // Allocate a JSArray with no elements | 2043 // Allocate a JSArray with no elements |
| 2034 MUST_USE_RESULT MaybeObject* AllocateJSArray( | 2044 MUST_USE_RESULT MaybeObject* AllocateJSArray( |
| 2035 ElementsKind elements_kind, | 2045 ElementsKind elements_kind, |
| 2036 PretenureFlag pretenure = NOT_TENURED, | 2046 PretenureFlag pretenure = NOT_TENURED); |
| 2037 AllocationSiteMode mode = DONT_TRACK_ALLOCATION_SITE, | 2047 |
| 2038 Handle<Object>* allocation_site_info_payload = NULL); | 2048 MUST_USE_RESULT MaybeObject* AllocateJSArrayWithAllocationSite( |
| 2049 ElementsKind elements_kind, |
| 2050 Handle<Object> allocation_site_info_payload); |
| 2039 | 2051 |
| 2040 // Allocate empty fixed array. | 2052 // Allocate empty fixed array. |
| 2041 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedArray(); | 2053 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedArray(); |
| 2042 | 2054 |
| 2043 // Allocate empty fixed double array. | 2055 // Allocate empty fixed double array. |
| 2044 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedDoubleArray(); | 2056 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedDoubleArray(); |
| 2045 | 2057 |
| 2046 // Performs a minor collection in new generation. | 2058 // Performs a minor collection in new generation. |
| 2047 void Scavenge(); | 2059 void Scavenge(); |
| 2048 | 2060 |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2965 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 2977 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
| 2966 | 2978 |
| 2967 private: | 2979 private: |
| 2968 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2980 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2969 }; | 2981 }; |
| 2970 #endif // DEBUG | 2982 #endif // DEBUG |
| 2971 | 2983 |
| 2972 } } // namespace v8::internal | 2984 } } // namespace v8::internal |
| 2973 | 2985 |
| 2974 #endif // V8_HEAP_H_ | 2986 #endif // V8_HEAP_H_ |
| OLD | NEW |