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

Side by Side Diff: src/heap.h

Issue 170703002: Refactoring to clean up duplicate code in Heap::Allocate methods. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comment response. Created 6 years, 9 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
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 return old_data_space_->allocation_top_address(); 676 return old_data_space_->allocation_top_address();
677 } 677 }
678 Address* OldDataSpaceAllocationLimitAddress() { 678 Address* OldDataSpaceAllocationLimitAddress() {
679 return old_data_space_->allocation_limit_address(); 679 return old_data_space_->allocation_limit_address();
680 } 680 }
681 681
682 // Allocates and initializes a new JavaScript object based on a 682 // Allocates and initializes a new JavaScript object based on a
683 // constructor. 683 // constructor.
684 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 684 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
685 // failed. 685 // failed.
686 // If allocation_site is non-null, then a memento is emitted after the object
687 // that points to the site.
686 // Please note this does not perform a garbage collection. 688 // Please note this does not perform a garbage collection.
687 MUST_USE_RESULT MaybeObject* AllocateJSObject( 689 MUST_USE_RESULT MaybeObject* AllocateJSObject(
688 JSFunction* constructor, 690 JSFunction* constructor,
689 PretenureFlag pretenure = NOT_TENURED); 691 PretenureFlag pretenure = NOT_TENURED,
690 692 AllocationSite* allocation_site = NULL);
691 MUST_USE_RESULT MaybeObject* AllocateJSObjectWithAllocationSite(
692 JSFunction* constructor,
693 Handle<AllocationSite> allocation_site);
694 693
695 MUST_USE_RESULT MaybeObject* AllocateJSModule(Context* context, 694 MUST_USE_RESULT MaybeObject* AllocateJSModule(Context* context,
696 ScopeInfo* scope_info); 695 ScopeInfo* scope_info);
697 696
698 // Allocate a JSArray with no elements 697 // Allocate a JSArray with no elements
699 MUST_USE_RESULT MaybeObject* AllocateEmptyJSArray( 698 MUST_USE_RESULT MaybeObject* AllocateEmptyJSArray(
700 ElementsKind elements_kind, 699 ElementsKind elements_kind,
701 PretenureFlag pretenure = NOT_TENURED) { 700 PretenureFlag pretenure = NOT_TENURED) {
702 return AllocateJSArrayAndStorage(elements_kind, 0, 0, 701 return AllocateJSArrayAndStorage(elements_kind, 0, 0,
703 DONT_INITIALIZE_ARRAY_ELEMENTS, 702 DONT_INITIALIZE_ARRAY_ELEMENTS,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 // Reinitialize an JSGlobalProxy based on a constructor. The object 762 // Reinitialize an JSGlobalProxy based on a constructor. The object
764 // must have the same size as objects allocated using the 763 // must have the same size as objects allocated using the
765 // constructor. The object is reinitialized and behaves as an 764 // constructor. The object is reinitialized and behaves as an
766 // object that has been freshly allocated using the constructor. 765 // object that has been freshly allocated using the constructor.
767 MUST_USE_RESULT MaybeObject* ReinitializeJSGlobalProxy( 766 MUST_USE_RESULT MaybeObject* ReinitializeJSGlobalProxy(
768 JSFunction* constructor, JSGlobalProxy* global); 767 JSFunction* constructor, JSGlobalProxy* global);
769 768
770 // Allocates and initializes a new JavaScript object based on a map. 769 // Allocates and initializes a new JavaScript object based on a map.
771 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 770 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
772 // failed. 771 // failed.
772 // Passing an allocation site means that a memento will be created that
773 // points to the site.
773 // Please note this does not perform a garbage collection. 774 // Please note this does not perform a garbage collection.
774 MUST_USE_RESULT MaybeObject* AllocateJSObjectFromMap( 775 MUST_USE_RESULT MaybeObject* AllocateJSObjectFromMap(
775 Map* map, PretenureFlag pretenure = NOT_TENURED, bool alloc_props = true); 776 Map* map,
776 777 PretenureFlag pretenure = NOT_TENURED,
777 MUST_USE_RESULT MaybeObject* AllocateJSObjectFromMapWithAllocationSite( 778 bool alloc_props = true,
778 Map* map, Handle<AllocationSite> allocation_site); 779 AllocationSite* allocation_site = NULL);
779 780
780 // Allocates a heap object based on the map. 781 // Allocates a heap object based on the map.
781 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 782 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
782 // failed. 783 // failed.
783 // Please note this function does not perform a garbage collection. 784 // Please note this function does not perform a garbage collection.
784 MUST_USE_RESULT MaybeObject* Allocate(Map* map, AllocationSpace space); 785 MUST_USE_RESULT MaybeObject* Allocate(Map* map, AllocationSpace space,
785 786 AllocationSite* allocation_site = NULL);
786 MUST_USE_RESULT MaybeObject* AllocateWithAllocationSite(Map* map,
787 AllocationSpace space, Handle<AllocationSite> allocation_site);
788 787
789 // Allocates a JS Map in the heap. 788 // Allocates a JS Map in the heap.
790 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 789 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
791 // failed. 790 // failed.
792 // Please note this function does not perform a garbage collection. 791 // Please note this function does not perform a garbage collection.
793 MUST_USE_RESULT MaybeObject* AllocateMap( 792 MUST_USE_RESULT MaybeObject* AllocateMap(
794 InstanceType instance_type, 793 InstanceType instance_type,
795 int instance_size, 794 int instance_size,
796 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); 795 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND);
797 796
(...skipping 2315 matching lines...) Expand 10 before | Expand all | Expand 10 after
3113 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 3112 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
3114 3113
3115 private: 3114 private:
3116 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 3115 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
3117 }; 3116 };
3118 #endif // DEBUG 3117 #endif // DEBUG
3119 3118
3120 } } // namespace v8::internal 3119 } } // namespace v8::internal
3121 3120
3122 #endif // V8_HEAP_H_ 3121 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698