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

Side by Side Diff: src/heap.h

Issue 227623002: Handlify ten allocator functions from the Heap. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | « src/factory.cc ('k') | 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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 706 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
707 // failed. 707 // failed.
708 // If allocation_site is non-null, then a memento is emitted after the object 708 // If allocation_site is non-null, then a memento is emitted after the object
709 // that points to the site. 709 // that points to the site.
710 // Please note this does not perform a garbage collection. 710 // Please note this does not perform a garbage collection.
711 MUST_USE_RESULT MaybeObject* AllocateJSObject( 711 MUST_USE_RESULT MaybeObject* AllocateJSObject(
712 JSFunction* constructor, 712 JSFunction* constructor,
713 PretenureFlag pretenure = NOT_TENURED, 713 PretenureFlag pretenure = NOT_TENURED,
714 AllocationSite* allocation_site = NULL); 714 AllocationSite* allocation_site = NULL);
715 715
716 MUST_USE_RESULT MaybeObject* AllocateJSModule(Context* context,
717 ScopeInfo* scope_info);
718
719 // Allocate a JSArray with no elements
720 MUST_USE_RESULT MaybeObject* AllocateEmptyJSArray(
721 ElementsKind elements_kind,
722 PretenureFlag pretenure = NOT_TENURED) {
723 return AllocateJSArrayAndStorage(elements_kind, 0, 0,
724 DONT_INITIALIZE_ARRAY_ELEMENTS,
725 pretenure);
726 }
727
728 // Allocate a JSArray with a specified length but elements that are left
729 // uninitialized.
730 MUST_USE_RESULT MaybeObject* AllocateJSArrayAndStorage(
731 ElementsKind elements_kind,
732 int length,
733 int capacity,
734 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS,
735 PretenureFlag pretenure = NOT_TENURED);
736
737 MUST_USE_RESULT MaybeObject* AllocateJSArrayStorage( 716 MUST_USE_RESULT MaybeObject* AllocateJSArrayStorage(
738 JSArray* array, 717 JSArray* array,
739 int length, 718 int length,
740 int capacity, 719 int capacity,
741 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS); 720 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS);
742 721
743 // Returns a deep copy of the JavaScript object. 722 // Returns a deep copy of the JavaScript object.
744 // Properties and elements are copied too. 723 // Properties and elements are copied too.
745 // Returns failure if allocation failed. 724 // Returns failure if allocation failed.
746 // Optionally takes an AllocationSite to be appended in an AllocationMemento. 725 // Optionally takes an AllocationSite to be appended in an AllocationMemento.
747 MUST_USE_RESULT MaybeObject* CopyJSObject(JSObject* source, 726 MUST_USE_RESULT MaybeObject* CopyJSObject(JSObject* source,
748 AllocationSite* site = NULL); 727 AllocationSite* site = NULL);
749 728
750 // Allocates a JS ArrayBuffer object.
751 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
752 // failed.
753 // Please note this does not perform a garbage collection.
754 MUST_USE_RESULT MaybeObject* AllocateJSArrayBuffer();
755
756 // Allocates a Harmony proxy or function proxy. 729 // Allocates a Harmony proxy or function proxy.
757 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 730 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
758 // failed. 731 // failed.
759 // Please note this does not perform a garbage collection. 732 // Please note this does not perform a garbage collection.
760 MUST_USE_RESULT MaybeObject* AllocateJSProxy(Object* handler, 733 MUST_USE_RESULT MaybeObject* AllocateJSProxy(Object* handler,
761 Object* prototype); 734 Object* prototype);
762 735
763 MUST_USE_RESULT MaybeObject* AllocateJSFunctionProxy(Object* handler, 736 MUST_USE_RESULT MaybeObject* AllocateJSFunctionProxy(Object* handler,
764 Object* call_trap, 737 Object* call_trap,
765 Object* construct_trap, 738 Object* construct_trap,
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
2197 NO_INLINE(void CreateJSEntryStub()); 2170 NO_INLINE(void CreateJSEntryStub());
2198 NO_INLINE(void CreateJSConstructEntryStub()); 2171 NO_INLINE(void CreateJSConstructEntryStub());
2199 2172
2200 void CreateFixedStubs(); 2173 void CreateFixedStubs();
2201 2174
2202 MUST_USE_RESULT MaybeObject* CreateOddball(Map* map, 2175 MUST_USE_RESULT MaybeObject* CreateOddball(Map* map,
2203 const char* to_string, 2176 const char* to_string,
2204 Object* to_number, 2177 Object* to_number,
2205 byte kind); 2178 byte kind);
2206 2179
2207 // Allocate a JSArray with no elements
2208 MUST_USE_RESULT MaybeObject* AllocateJSArray(
2209 ElementsKind elements_kind,
2210 PretenureFlag pretenure = NOT_TENURED);
2211
2212 // Allocate empty fixed array. 2180 // Allocate empty fixed array.
2213 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedArray(); 2181 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedArray();
2214 2182
2215 // Allocate empty external array of given type. 2183 // Allocate empty external array of given type.
2216 MUST_USE_RESULT MaybeObject* AllocateEmptyExternalArray( 2184 MUST_USE_RESULT MaybeObject* AllocateEmptyExternalArray(
2217 ExternalArrayType array_type); 2185 ExternalArrayType array_type);
2218 2186
2219 // Allocate empty fixed typed array of given type. 2187 // Allocate empty fixed typed array of given type.
2220 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedTypedArray( 2188 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedTypedArray(
2221 ExternalArrayType array_type); 2189 ExternalArrayType array_type);
2222 2190
2223 // Allocate empty fixed double array. 2191 // Allocate empty fixed double array.
2224 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedDoubleArray(); 2192 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedDoubleArray();
2225 2193
2226 // Allocate empty constant pool array. 2194 // Allocate empty constant pool array.
2227 MUST_USE_RESULT MaybeObject* AllocateEmptyConstantPoolArray(); 2195 MUST_USE_RESULT MaybeObject* AllocateEmptyConstantPoolArray();
2228 2196
2229 // Allocate a tenured simple cell. 2197 // Allocate a tenured simple cell.
2230 MUST_USE_RESULT MaybeObject* AllocateCell(Object* value); 2198 MUST_USE_RESULT MaybeObject* AllocateCell(Object* value);
2231 2199
2232 // Allocate a tenured JS global property cell initialized with the hole. 2200 // Allocate a tenured JS global property cell initialized with the hole.
2233 MUST_USE_RESULT MaybeObject* AllocatePropertyCell(); 2201 MUST_USE_RESULT MaybeObject* AllocatePropertyCell();
2234 2202
2235 // Allocate Box.
2236 MUST_USE_RESULT MaybeObject* AllocateBox(Object* value,
2237 PretenureFlag pretenure);
2238
2239 // Performs a minor collection in new generation. 2203 // Performs a minor collection in new generation.
2240 void Scavenge(); 2204 void Scavenge();
2241 2205
2242 // Commits from space if it is uncommitted. 2206 // Commits from space if it is uncommitted.
2243 void EnsureFromSpaceIsCommitted(); 2207 void EnsureFromSpaceIsCommitted();
2244 2208
2245 // Uncommit unused semi space. 2209 // Uncommit unused semi space.
2246 bool UncommitFromSpace() { return new_space_.UncommitFromSpace(); } 2210 bool UncommitFromSpace() { return new_space_.UncommitFromSpace(); }
2247 2211
2248 // Fill in bogus values in from space 2212 // Fill in bogus values in from space
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
3125 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 3089 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
3126 3090
3127 private: 3091 private:
3128 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 3092 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
3129 }; 3093 };
3130 #endif // DEBUG 3094 #endif // DEBUG
3131 3095
3132 } } // namespace v8::internal 3096 } } // namespace v8::internal
3133 3097
3134 #endif // V8_HEAP_H_ 3098 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698