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

Side by Side Diff: src/heap.h

Issue 149133004: A64: Synchronize with r17807. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
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 | « src/frames.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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 return old_pointer_space_->allocation_limit_address(); 610 return old_pointer_space_->allocation_limit_address();
611 } 611 }
612 612
613 Address* OldDataSpaceAllocationTopAddress() { 613 Address* OldDataSpaceAllocationTopAddress() {
614 return old_data_space_->allocation_top_address(); 614 return old_data_space_->allocation_top_address();
615 } 615 }
616 Address* OldDataSpaceAllocationLimitAddress() { 616 Address* OldDataSpaceAllocationLimitAddress() {
617 return old_data_space_->allocation_limit_address(); 617 return old_data_space_->allocation_limit_address();
618 } 618 }
619 619
620 // Uncommit unused semi space.
621 bool UncommitFromSpace() { return new_space_.UncommitFromSpace(); }
622
623 // Allocates and initializes a new JavaScript object based on a 620 // Allocates and initializes a new JavaScript object based on a
624 // constructor. 621 // constructor.
625 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 622 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
626 // failed. 623 // failed.
627 // Please note this does not perform a garbage collection. 624 // Please note this does not perform a garbage collection.
628 MUST_USE_RESULT MaybeObject* AllocateJSObject( 625 MUST_USE_RESULT MaybeObject* AllocateJSObject(
629 JSFunction* constructor, 626 JSFunction* constructor,
630 PretenureFlag pretenure = NOT_TENURED); 627 PretenureFlag pretenure = NOT_TENURED);
631 628
632 MUST_USE_RESULT MaybeObject* AllocateJSObjectWithAllocationSite( 629 MUST_USE_RESULT MaybeObject* AllocateJSObjectWithAllocationSite(
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 int length, 871 int length,
875 ExternalArrayType array_type, 872 ExternalArrayType array_type,
876 void* external_pointer, 873 void* external_pointer,
877 PretenureFlag pretenure); 874 PretenureFlag pretenure);
878 875
879 // Allocate a symbol in old space. 876 // Allocate a symbol in old space.
880 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 877 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
881 // failed. 878 // failed.
882 // Please note this does not perform a garbage collection. 879 // Please note this does not perform a garbage collection.
883 MUST_USE_RESULT MaybeObject* AllocateSymbol(); 880 MUST_USE_RESULT MaybeObject* AllocateSymbol();
881 MUST_USE_RESULT MaybeObject* AllocatePrivateSymbol();
884 882
885 // Allocate a tenured AllocationSite. It's payload is null 883 // Allocate a tenured AllocationSite. It's payload is null
886 MUST_USE_RESULT MaybeObject* AllocateAllocationSite(); 884 MUST_USE_RESULT MaybeObject* AllocateAllocationSite();
887 885
888 // Allocates a fixed array initialized with undefined values 886 // Allocates a fixed array initialized with undefined values
889 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 887 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
890 // failed. 888 // failed.
891 // Please note this does not perform a garbage collection. 889 // Please note this does not perform a garbage collection.
892 MUST_USE_RESULT MaybeObject* AllocateFixedArray( 890 MUST_USE_RESULT MaybeObject* AllocateFixedArray(
893 int length, 891 int length,
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 // Returns a failure in case it was decided that flattening was 1165 // Returns a failure in case it was decided that flattening was
1168 // necessary and failed. Note, if flattening is not necessary the 1166 // necessary and failed. Note, if flattening is not necessary the
1169 // string might stay non-flat even when not a failure is returned. 1167 // string might stay non-flat even when not a failure is returned.
1170 // 1168 //
1171 // Please note this function does not perform a garbage collection. 1169 // Please note this function does not perform a garbage collection.
1172 MUST_USE_RESULT inline MaybeObject* PrepareForCompare(String* str); 1170 MUST_USE_RESULT inline MaybeObject* PrepareForCompare(String* str);
1173 1171
1174 // Converts the given boolean condition to JavaScript boolean value. 1172 // Converts the given boolean condition to JavaScript boolean value.
1175 inline Object* ToBoolean(bool condition); 1173 inline Object* ToBoolean(bool condition);
1176 1174
1177 // Code that should be run before and after each GC. Includes some
1178 // reporting/verification activities when compiled with DEBUG set.
1179 void GarbageCollectionPrologue();
1180 void GarbageCollectionEpilogue();
1181
1182 // Performs garbage collection operation. 1175 // Performs garbage collection operation.
1183 // Returns whether there is a chance that another major GC could 1176 // Returns whether there is a chance that another major GC could
1184 // collect more garbage. 1177 // collect more garbage.
1185 bool CollectGarbage(AllocationSpace space,
1186 GarbageCollector collector,
1187 const char* gc_reason,
1188 const char* collector_reason);
1189
1190 // Performs garbage collection operation.
1191 // Returns whether there is a chance that another major GC could
1192 // collect more garbage.
1193 inline bool CollectGarbage(AllocationSpace space, 1178 inline bool CollectGarbage(AllocationSpace space,
1194 const char* gc_reason = NULL); 1179 const char* gc_reason = NULL);
1195 1180
1196 static const int kNoGCFlags = 0; 1181 static const int kNoGCFlags = 0;
1197 static const int kSweepPreciselyMask = 1; 1182 static const int kSweepPreciselyMask = 1;
1198 static const int kReduceMemoryFootprintMask = 2; 1183 static const int kReduceMemoryFootprintMask = 2;
1199 static const int kAbortIncrementalMarkingMask = 4; 1184 static const int kAbortIncrementalMarkingMask = 4;
1200 1185
1201 // Making the heap iterable requires us to sweep precisely and abort any 1186 // Making the heap iterable requires us to sweep precisely and abort any
1202 // incremental marking as well. 1187 // incremental marking as well.
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 return true; 1406 return true;
1422 #else 1407 #else
1423 #ifdef VERIFY_HEAP 1408 #ifdef VERIFY_HEAP
1424 return FLAG_verify_heap; 1409 return FLAG_verify_heap;
1425 #else 1410 #else
1426 return false; 1411 return false;
1427 #endif 1412 #endif
1428 #endif 1413 #endif
1429 } 1414 }
1430 1415
1431 // Fill in bogus values in from space
1432 void ZapFromSpace();
1433
1434 // Print short heap statistics. 1416 // Print short heap statistics.
1435 void PrintShortHeapStatistics(); 1417 void PrintShortHeapStatistics();
1436 1418
1437 // Makes a new internalized string object 1419 // Makes a new internalized string object
1438 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 1420 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
1439 // failed. 1421 // failed.
1440 // Please note this function does not perform a garbage collection. 1422 // Please note this function does not perform a garbage collection.
1441 MUST_USE_RESULT MaybeObject* CreateInternalizedString( 1423 MUST_USE_RESULT MaybeObject* CreateInternalizedString(
1442 const char* str, int length, int hash); 1424 const char* str, int length, int hash);
1443 MUST_USE_RESULT MaybeObject* CreateInternalizedString(String* str); 1425 MUST_USE_RESULT MaybeObject* CreateInternalizedString(String* str);
(...skipping 23 matching lines...) Expand all
1467 void TracePathToGlobal(); 1449 void TracePathToGlobal();
1468 #endif 1450 #endif
1469 1451
1470 // Callback function passed to Heap::Iterate etc. Copies an object if 1452 // Callback function passed to Heap::Iterate etc. Copies an object if
1471 // necessary, the object might be promoted to an old space. The caller must 1453 // necessary, the object might be promoted to an old space. The caller must
1472 // ensure the precondition that the object is (a) a heap object and (b) in 1454 // ensure the precondition that the object is (a) a heap object and (b) in
1473 // the heap's from space. 1455 // the heap's from space.
1474 static inline void ScavengePointer(HeapObject** p); 1456 static inline void ScavengePointer(HeapObject** p);
1475 static inline void ScavengeObject(HeapObject** p, HeapObject* object); 1457 static inline void ScavengeObject(HeapObject** p, HeapObject* object);
1476 1458
1477 // Commits from space if it is uncommitted.
1478 void EnsureFromSpaceIsCommitted();
1479
1480 // Support for partial snapshots. After calling this we have a linear 1459 // Support for partial snapshots. After calling this we have a linear
1481 // space to write objects in each space. 1460 // space to write objects in each space.
1482 void ReserveSpace(int *sizes, Address* addresses); 1461 void ReserveSpace(int *sizes, Address* addresses);
1483 1462
1484 // 1463 //
1485 // Support for the API. 1464 // Support for the API.
1486 // 1465 //
1487 1466
1488 bool CreateApiObjects(); 1467 bool CreateApiObjects();
1489 1468
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 limit += new_space_.Capacity(); 1518 limit += new_space_.Capacity();
1540 // TODO(hpayer): Can be removed when when pretenuring is supported for all 1519 // TODO(hpayer): Can be removed when when pretenuring is supported for all
1541 // allocation sites. 1520 // allocation sites.
1542 if (IsHighSurvivalRate() && IsStableOrIncreasingSurvivalTrend()) { 1521 if (IsHighSurvivalRate() && IsStableOrIncreasingSurvivalTrend()) {
1543 limit *= 2; 1522 limit *= 2;
1544 } 1523 }
1545 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; 1524 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2;
1546 return Min(limit, halfway_to_the_max); 1525 return Min(limit, halfway_to_the_max);
1547 } 1526 }
1548 1527
1528 // Indicates whether inline bump-pointer allocation has been disabled.
1529 bool inline_allocation_disabled() { return inline_allocation_disabled_; }
1530
1531 // Switch whether inline bump-pointer allocation should be used.
1532 void EnableInlineAllocation();
1533 void DisableInlineAllocation();
1534
1549 // Implements the corresponding V8 API function. 1535 // Implements the corresponding V8 API function.
1550 bool IdleNotification(int hint); 1536 bool IdleNotification(int hint);
1551 1537
1552 // Declare all the root indices. 1538 // Declare all the root indices.
1553 enum RootListIndex { 1539 enum RootListIndex {
1554 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, 1540 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex,
1555 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) 1541 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION)
1556 #undef ROOT_INDEX_DECLARATION 1542 #undef ROOT_INDEX_DECLARATION
1557 1543
1558 #define STRING_INDEX_DECLARATION(name, str) k##name##RootIndex, 1544 #define STRING_INDEX_DECLARATION(name, str) k##name##RootIndex,
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 // by global handles 1971 // by global handles
1986 intptr_t amount_of_external_allocated_memory_; 1972 intptr_t amount_of_external_allocated_memory_;
1987 1973
1988 // Caches the amount of external memory registered at the last global gc. 1974 // Caches the amount of external memory registered at the last global gc.
1989 intptr_t amount_of_external_allocated_memory_at_last_global_gc_; 1975 intptr_t amount_of_external_allocated_memory_at_last_global_gc_;
1990 1976
1991 // Indicates that an allocation has failed in the old generation since the 1977 // Indicates that an allocation has failed in the old generation since the
1992 // last GC. 1978 // last GC.
1993 bool old_gen_exhausted_; 1979 bool old_gen_exhausted_;
1994 1980
1981 // Indicates that inline bump-pointer allocation has been globally disabled
1982 // for all spaces. This is used to disable allocations in generated code.
1983 bool inline_allocation_disabled_;
1984
1995 // Weak list heads, threaded through the objects. 1985 // Weak list heads, threaded through the objects.
1996 // List heads are initilized lazily and contain the undefined_value at start. 1986 // List heads are initilized lazily and contain the undefined_value at start.
1997 Object* native_contexts_list_; 1987 Object* native_contexts_list_;
1998 Object* array_buffers_list_; 1988 Object* array_buffers_list_;
1999 Object* allocation_sites_list_; 1989 Object* allocation_sites_list_;
2000 1990
2001 // WeakHashTable that maps objects embedded in optimized code to dependent 1991 // WeakHashTable that maps objects embedded in optimized code to dependent
2002 // code list. It is initilized lazily and contains the undefined_value at 1992 // code list. It is initilized lazily and contains the undefined_value at
2003 // start. 1993 // start.
2004 Object* weak_object_to_code_table_; 1994 Object* weak_object_to_code_table_;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2067 // Support for computing object sizes during GC. 2057 // Support for computing object sizes during GC.
2068 HeapObjectCallback gc_safe_size_of_old_object_; 2058 HeapObjectCallback gc_safe_size_of_old_object_;
2069 static int GcSafeSizeOfOldObject(HeapObject* object); 2059 static int GcSafeSizeOfOldObject(HeapObject* object);
2070 2060
2071 // Update the GC state. Called from the mark-compact collector. 2061 // Update the GC state. Called from the mark-compact collector.
2072 void MarkMapPointersAsEncoded(bool encoded) { 2062 void MarkMapPointersAsEncoded(bool encoded) {
2073 ASSERT(!encoded); 2063 ASSERT(!encoded);
2074 gc_safe_size_of_old_object_ = &GcSafeSizeOfOldObject; 2064 gc_safe_size_of_old_object_ = &GcSafeSizeOfOldObject;
2075 } 2065 }
2076 2066
2067 // Code that should be run before and after each GC. Includes some
2068 // reporting/verification activities when compiled with DEBUG set.
2069 void GarbageCollectionPrologue();
2070 void GarbageCollectionEpilogue();
2071
2077 // Checks whether a global GC is necessary 2072 // Checks whether a global GC is necessary
2078 GarbageCollector SelectGarbageCollector(AllocationSpace space, 2073 GarbageCollector SelectGarbageCollector(AllocationSpace space,
2079 const char** reason); 2074 const char** reason);
2080 2075
2076 // Performs garbage collection operation.
2077 // Returns whether there is a chance that another major GC could
2078 // collect more garbage.
2079 bool CollectGarbage(AllocationSpace space,
2080 GarbageCollector collector,
2081 const char* gc_reason,
2082 const char* collector_reason);
2083
2081 // Performs garbage collection 2084 // Performs garbage collection
2082 // Returns whether there is a chance another major GC could 2085 // Returns whether there is a chance another major GC could
2083 // collect more garbage. 2086 // collect more garbage.
2084 bool PerformGarbageCollection(GarbageCollector collector, 2087 bool PerformGarbageCollection(GarbageCollector collector,
2085 GCTracer* tracer); 2088 GCTracer* tracer);
2086 2089
2087 inline void UpdateOldSpaceLimits(); 2090 inline void UpdateOldSpaceLimits();
2088 2091
2089 // Selects the proper allocation space depending on the given object 2092 // Selects the proper allocation space depending on the given object
2090 // size, pretenuring decision, and preferred old-space. 2093 // size, pretenuring decision, and preferred old-space.
(...skipping 25 matching lines...) Expand all
2116 2119
2117 bool CreateInitialMaps(); 2120 bool CreateInitialMaps();
2118 bool CreateInitialObjects(); 2121 bool CreateInitialObjects();
2119 2122
2120 // These five Create*EntryStub functions are here and forced to not be inlined 2123 // These five Create*EntryStub functions are here and forced to not be inlined
2121 // because of a gcc-4.4 bug that assigns wrong vtable entries. 2124 // because of a gcc-4.4 bug that assigns wrong vtable entries.
2122 NO_INLINE(void CreateJSEntryStub()); 2125 NO_INLINE(void CreateJSEntryStub());
2123 NO_INLINE(void CreateJSConstructEntryStub()); 2126 NO_INLINE(void CreateJSConstructEntryStub());
2124 2127
2125 void CreateFixedStubs(); 2128 void CreateFixedStubs();
2129 void CreateStubsRequiringBuiltins();
2126 2130
2127 MUST_USE_RESULT MaybeObject* CreateOddball(const char* to_string, 2131 MUST_USE_RESULT MaybeObject* CreateOddball(const char* to_string,
2128 Object* to_number, 2132 Object* to_number,
2129 byte kind); 2133 byte kind);
2130 2134
2131 // Allocate a JSArray with no elements 2135 // Allocate a JSArray with no elements
2132 MUST_USE_RESULT MaybeObject* AllocateJSArray( 2136 MUST_USE_RESULT MaybeObject* AllocateJSArray(
2133 ElementsKind elements_kind, 2137 ElementsKind elements_kind,
2134 PretenureFlag pretenure = NOT_TENURED); 2138 PretenureFlag pretenure = NOT_TENURED);
2135 2139
(...skipping 13 matching lines...) Expand all
2149 // Allocate a tenured JS global property cell initialized with the hole. 2153 // Allocate a tenured JS global property cell initialized with the hole.
2150 MUST_USE_RESULT MaybeObject* AllocatePropertyCell(); 2154 MUST_USE_RESULT MaybeObject* AllocatePropertyCell();
2151 2155
2152 // Allocate Box. 2156 // Allocate Box.
2153 MUST_USE_RESULT MaybeObject* AllocateBox(Object* value, 2157 MUST_USE_RESULT MaybeObject* AllocateBox(Object* value,
2154 PretenureFlag pretenure); 2158 PretenureFlag pretenure);
2155 2159
2156 // Performs a minor collection in new generation. 2160 // Performs a minor collection in new generation.
2157 void Scavenge(); 2161 void Scavenge();
2158 2162
2163 // Commits from space if it is uncommitted.
2164 void EnsureFromSpaceIsCommitted();
2165
2166 // Uncommit unused semi space.
2167 bool UncommitFromSpace() { return new_space_.UncommitFromSpace(); }
2168
2169 // Fill in bogus values in from space
2170 void ZapFromSpace();
2171
2159 static String* UpdateNewSpaceReferenceInExternalStringTableEntry( 2172 static String* UpdateNewSpaceReferenceInExternalStringTableEntry(
2160 Heap* heap, 2173 Heap* heap,
2161 Object** pointer); 2174 Object** pointer);
2162 2175
2163 Address DoScavenge(ObjectVisitor* scavenge_visitor, Address new_space_front); 2176 Address DoScavenge(ObjectVisitor* scavenge_visitor, Address new_space_front);
2164 static void ScavengeStoreBufferCallback(Heap* heap, 2177 static void ScavengeStoreBufferCallback(Heap* heap,
2165 MemoryChunk* page, 2178 MemoryChunk* page,
2166 StoreBufferEvent event); 2179 StoreBufferEvent event);
2167 2180
2168 // Performs a major collection in the whole heap. 2181 // Performs a major collection in the whole heap.
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
3077 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 3090 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
3078 3091
3079 private: 3092 private:
3080 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 3093 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
3081 }; 3094 };
3082 #endif // DEBUG 3095 #endif // DEBUG
3083 3096
3084 } } // namespace v8::internal 3097 } } // namespace v8::internal
3085 3098
3086 #endif // V8_HEAP_H_ 3099 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/frames.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698