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

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: Created 6 years, 10 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') | src/runtime.cc » ('J')
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. allocation_site does not influence the
688 // pretenure state.
Hannes Payer (out of office) 2014/02/19 21:29:07 What do you mean by "does not influence the preten
mvstanton 2014/02/26 09:47:41 I mean that the AllocationSite is not mined for in
Hannes Payer (out of office) 2014/03/03 17:03:46 Just drop the "allocation_site does not influence
mvstanton 2014/03/04 09:52:02 Done.
686 // Please note this does not perform a garbage collection. 689 // Please note this does not perform a garbage collection.
687 MUST_USE_RESULT MaybeObject* AllocateJSObject( 690 MUST_USE_RESULT MaybeObject* AllocateJSObject(
688 JSFunction* constructor, 691 JSFunction* constructor,
689 PretenureFlag pretenure = NOT_TENURED); 692 PretenureFlag pretenure = NOT_TENURED,
690 693 AllocationSite* allocation_site = NULL);
Hannes Payer (out of office) 2014/02/19 21:29:07 What about implementing an AllocationMode, similar
Hannes Payer (out of office) 2014/02/19 21:29:07 Why did you get rid of the Handle?
mvstanton 2014/02/26 09:47:41 Because it's not a handlefied method and the other
mvstanton 2014/02/26 09:47:41 I am thinking small with this CL, focused on elimi
Hannes Payer (out of office) 2014/03/03 17:03:46 OK, I guess we should implement an AllocationMode
mvstanton 2014/03/04 09:52:02 yep, thanks, will be done.
691 MUST_USE_RESULT MaybeObject* AllocateJSObjectWithAllocationSite(
692 JSFunction* constructor,
693 Handle<AllocationSite> allocation_site);
694 694
695 MUST_USE_RESULT MaybeObject* AllocateJSModule(Context* context, 695 MUST_USE_RESULT MaybeObject* AllocateJSModule(Context* context,
696 ScopeInfo* scope_info); 696 ScopeInfo* scope_info);
697 697
698 // Allocate a JSArray with no elements 698 // Allocate a JSArray with no elements
699 MUST_USE_RESULT MaybeObject* AllocateEmptyJSArray( 699 MUST_USE_RESULT MaybeObject* AllocateEmptyJSArray(
700 ElementsKind elements_kind, 700 ElementsKind elements_kind,
701 PretenureFlag pretenure = NOT_TENURED) { 701 PretenureFlag pretenure = NOT_TENURED) {
702 return AllocateJSArrayAndStorage(elements_kind, 0, 0, 702 return AllocateJSArrayAndStorage(elements_kind, 0, 0,
703 DONT_INITIALIZE_ARRAY_ELEMENTS, 703 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 763 // Reinitialize an JSGlobalProxy based on a constructor. The object
764 // must have the same size as objects allocated using the 764 // must have the same size as objects allocated using the
765 // constructor. The object is reinitialized and behaves as an 765 // constructor. The object is reinitialized and behaves as an
766 // object that has been freshly allocated using the constructor. 766 // object that has been freshly allocated using the constructor.
767 MUST_USE_RESULT MaybeObject* ReinitializeJSGlobalProxy( 767 MUST_USE_RESULT MaybeObject* ReinitializeJSGlobalProxy(
768 JSFunction* constructor, JSGlobalProxy* global); 768 JSFunction* constructor, JSGlobalProxy* global);
769 769
770 // Allocates and initializes a new JavaScript object based on a map. 770 // Allocates and initializes a new JavaScript object based on a map.
771 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 771 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
772 // failed. 772 // failed.
773 // Passing an allocation site means that a memento will be created that
774 // points to the site. It doesn't influence pretenure state.
Hannes Payer (out of office) 2014/02/19 21:29:07 same comments as above
mvstanton 2014/02/26 09:47:41 Indeed. And probably the fact that I have to expla
Hannes Payer (out of office) 2014/03/03 17:03:46 Just drop the "It doesn't influence pretenure stat
mvstanton 2014/03/04 09:52:02 Done.
773 // Please note this does not perform a garbage collection. 775 // Please note this does not perform a garbage collection.
774 MUST_USE_RESULT MaybeObject* AllocateJSObjectFromMap( 776 MUST_USE_RESULT MaybeObject* AllocateJSObjectFromMap(
775 Map* map, PretenureFlag pretenure = NOT_TENURED, bool alloc_props = true); 777 Map* map,
776 778 PretenureFlag pretenure = NOT_TENURED,
777 MUST_USE_RESULT MaybeObject* AllocateJSObjectFromMapWithAllocationSite( 779 bool alloc_props = true,
778 Map* map, Handle<AllocationSite> allocation_site); 780 AllocationSite* allocation_site = NULL);
779 781
780 // Allocates a heap object based on the map. 782 // Allocates a heap object based on the map.
781 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 783 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
782 // failed. 784 // failed.
783 // Please note this function does not perform a garbage collection. 785 // Please note this function does not perform a garbage collection.
784 MUST_USE_RESULT MaybeObject* Allocate(Map* map, AllocationSpace space); 786 MUST_USE_RESULT MaybeObject* Allocate(Map* map, AllocationSpace space,
785 787 AllocationSite* allocation_site = NULL);
786 MUST_USE_RESULT MaybeObject* AllocateWithAllocationSite(Map* map,
787 AllocationSpace space, Handle<AllocationSite> allocation_site);
788 788
789 // Allocates a JS Map in the heap. 789 // Allocates a JS Map in the heap.
790 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 790 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
791 // failed. 791 // failed.
792 // Please note this function does not perform a garbage collection. 792 // Please note this function does not perform a garbage collection.
793 MUST_USE_RESULT MaybeObject* AllocateMap( 793 MUST_USE_RESULT MaybeObject* AllocateMap(
794 InstanceType instance_type, 794 InstanceType instance_type,
795 int instance_size, 795 int instance_size,
796 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); 796 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND);
797 797
(...skipping 2315 matching lines...) Expand 10 before | Expand all | Expand 10 after
3113 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 3113 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
3114 3114
3115 private: 3115 private:
3116 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 3116 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
3117 }; 3117 };
3118 #endif // DEBUG 3118 #endif // DEBUG
3119 3119
3120 } } // namespace v8::internal 3120 } } // namespace v8::internal
3121 3121
3122 #endif // V8_HEAP_H_ 3122 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap.cc » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698