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

Side by Side Diff: src/heap.h

Issue 237093006: Function allocators handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing review comments 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/handles.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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 // failed. 728 // failed.
729 // Please note this does not perform a garbage collection. 729 // Please note this does not perform a garbage collection.
730 MUST_USE_RESULT MaybeObject* AllocateJSProxy(Object* handler, 730 MUST_USE_RESULT MaybeObject* AllocateJSProxy(Object* handler,
731 Object* prototype); 731 Object* prototype);
732 732
733 MUST_USE_RESULT MaybeObject* AllocateJSFunctionProxy(Object* handler, 733 MUST_USE_RESULT MaybeObject* AllocateJSFunctionProxy(Object* handler,
734 Object* call_trap, 734 Object* call_trap,
735 Object* construct_trap, 735 Object* construct_trap,
736 Object* prototype); 736 Object* prototype);
737 737
738 // Reinitialize a JSReceiver into an (empty) JS object of respective type and
739 // size, but keeping the original prototype. The receiver must have at least
740 // the size of the new object. The object is reinitialized and behaves as an
741 // object that has been freshly allocated.
742 // Returns failure if an error occured, otherwise object.
743 MUST_USE_RESULT MaybeObject* ReinitializeJSReceiver(JSReceiver* object,
744 InstanceType type,
745 int size);
746
747 // Reinitialize an JSGlobalProxy based on a constructor. The object
748 // must have the same size as objects allocated using the
749 // constructor. The object is reinitialized and behaves as an
750 // object that has been freshly allocated using the constructor.
751 MUST_USE_RESULT MaybeObject* ReinitializeJSGlobalProxy(
752 JSFunction* constructor, JSGlobalProxy* global);
753
754 // Allocates and initializes a new JavaScript object based on a map. 738 // Allocates and initializes a new JavaScript object based on a map.
755 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 739 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
756 // failed. 740 // failed.
757 // Passing an allocation site means that a memento will be created that 741 // Passing an allocation site means that a memento will be created that
758 // points to the site. 742 // points to the site.
759 // Please note this does not perform a garbage collection. 743 // Please note this does not perform a garbage collection.
760 MUST_USE_RESULT MaybeObject* AllocateJSObjectFromMap( 744 MUST_USE_RESULT MaybeObject* AllocateJSObjectFromMap(
761 Map* map, 745 Map* map,
762 PretenureFlag pretenure = NOT_TENURED, 746 PretenureFlag pretenure = NOT_TENURED,
763 bool alloc_props = true, 747 bool alloc_props = true,
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 PretenureFlag pretenure = NOT_TENURED); 975 PretenureFlag pretenure = NOT_TENURED);
992 976
993 // AllocateHashTable is identical to AllocateFixedArray except 977 // AllocateHashTable is identical to AllocateFixedArray except
994 // that the resulting object has hash_table_map as map. 978 // that the resulting object has hash_table_map as map.
995 MUST_USE_RESULT MaybeObject* AllocateHashTable( 979 MUST_USE_RESULT MaybeObject* AllocateHashTable(
996 int length, PretenureFlag pretenure = NOT_TENURED); 980 int length, PretenureFlag pretenure = NOT_TENURED);
997 981
998 // Allocates a new utility object in the old generation. 982 // Allocates a new utility object in the old generation.
999 MUST_USE_RESULT MaybeObject* AllocateStruct(InstanceType type); 983 MUST_USE_RESULT MaybeObject* AllocateStruct(InstanceType type);
1000 984
1001 // Allocates a function initialized with a shared part.
1002 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
1003 // failed.
1004 // Please note this does not perform a garbage collection.
1005 MUST_USE_RESULT MaybeObject* AllocateFunction(
1006 Map* function_map,
1007 SharedFunctionInfo* shared,
1008 Object* prototype,
1009 PretenureFlag pretenure = TENURED);
1010
1011 // Sloppy mode arguments object size. 985 // Sloppy mode arguments object size.
1012 static const int kSloppyArgumentsObjectSize = 986 static const int kSloppyArgumentsObjectSize =
1013 JSObject::kHeaderSize + 2 * kPointerSize; 987 JSObject::kHeaderSize + 2 * kPointerSize;
1014 // Strict mode arguments has no callee so it is smaller. 988 // Strict mode arguments has no callee so it is smaller.
1015 static const int kStrictArgumentsObjectSize = 989 static const int kStrictArgumentsObjectSize =
1016 JSObject::kHeaderSize + 1 * kPointerSize; 990 JSObject::kHeaderSize + 1 * kPointerSize;
1017 // Indicies for direct access into argument objects. 991 // Indicies for direct access into argument objects.
1018 static const int kArgumentsLengthIndex = 0; 992 static const int kArgumentsLengthIndex = 0;
1019 // callee is only valid in sloppy mode. 993 // callee is only valid in sloppy mode.
1020 static const int kArgumentsCalleeIndex = 1; 994 static const int kArgumentsCalleeIndex = 1;
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 // Called on heap tear-down. 2165 // Called on heap tear-down.
2192 void TearDownArrayBuffers(); 2166 void TearDownArrayBuffers();
2193 2167
2194 // Record statistics before and after garbage collection. 2168 // Record statistics before and after garbage collection.
2195 void ReportStatisticsBeforeGC(); 2169 void ReportStatisticsBeforeGC();
2196 void ReportStatisticsAfterGC(); 2170 void ReportStatisticsAfterGC();
2197 2171
2198 // Slow part of scavenge object. 2172 // Slow part of scavenge object.
2199 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object); 2173 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object);
2200 2174
2201 // Initializes a function with a shared part and prototype.
2202 // Note: this code was factored out of AllocateFunction such that
2203 // other parts of the VM could use it. Specifically, a function that creates
2204 // instances of type JS_FUNCTION_TYPE benefit from the use of this function.
2205 // Please note this does not perform a garbage collection.
2206 inline void InitializeFunction(
2207 JSFunction* function,
2208 SharedFunctionInfo* shared,
2209 Object* prototype);
2210
2211 // Total RegExp code ever generated 2175 // Total RegExp code ever generated
2212 double total_regexp_code_generated_; 2176 double total_regexp_code_generated_;
2213 2177
2214 GCTracer* tracer_; 2178 GCTracer* tracer_;
2215 2179
2216 // Allocates a small number to string cache. 2180 // Allocates a small number to string cache.
2217 MUST_USE_RESULT MaybeObject* AllocateInitialNumberStringCache(); 2181 MUST_USE_RESULT MaybeObject* AllocateInitialNumberStringCache();
2218 // Creates and installs the full-sized number string cache. 2182 // Creates and installs the full-sized number string cache.
2219 void AllocateFullSizeNumberStringCache(); 2183 void AllocateFullSizeNumberStringCache();
2220 // Get the length of the number to string cache based on the max semispace 2184 // Get the length of the number to string cache based on the max semispace
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
3037 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 3001 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
3038 3002
3039 private: 3003 private:
3040 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 3004 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
3041 }; 3005 };
3042 #endif // DEBUG 3006 #endif // DEBUG
3043 3007
3044 } } // namespace v8::internal 3008 } } // namespace v8::internal
3045 3009
3046 #endif // V8_HEAP_H_ 3010 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698