Revision f230a1cf deps/v8/src/heap.h
deps/v8/src/heap.h | ||
---|---|---|
71 | 71 |
V(Map, scope_info_map, ScopeInfoMap) \ |
72 | 72 |
V(Map, fixed_cow_array_map, FixedCOWArrayMap) \ |
73 | 73 |
V(Map, fixed_double_array_map, FixedDoubleArrayMap) \ |
74 |
V(Map, constant_pool_array_map, ConstantPoolArrayMap) \ |
|
74 | 75 |
V(Object, no_interceptor_result_sentinel, NoInterceptorResultSentinel) \ |
75 | 76 |
V(Map, hash_table_map, HashTableMap) \ |
76 | 77 |
V(FixedArray, empty_fixed_array, EmptyFixedArray) \ |
... | ... | |
292 | 293 |
V(throw_string, "throw") \ |
293 | 294 |
V(done_string, "done") \ |
294 | 295 |
V(value_string, "value") \ |
295 |
V(next_string, "next") |
|
296 |
V(next_string, "next") \ |
|
297 |
V(byte_length_string, "byteLength") \ |
|
298 |
V(byte_offset_string, "byteOffset") \ |
|
299 |
V(buffer_string, "buffer") |
|
296 | 300 |
|
297 | 301 |
// Forward declarations. |
298 | 302 |
class GCTracer; |
... | ... | |
635 | 639 |
pretenure); |
636 | 640 |
} |
637 | 641 |
|
638 |
inline MUST_USE_RESULT MaybeObject* AllocateEmptyJSArrayWithAllocationSite( |
|
639 |
ElementsKind elements_kind, |
|
640 |
Handle<AllocationSite> allocation_site); |
|
641 |
|
|
642 | 642 |
// Allocate a JSArray with a specified length but elements that are left |
643 | 643 |
// uninitialized. |
644 | 644 |
MUST_USE_RESULT MaybeObject* AllocateJSArrayAndStorage( |
... | ... | |
648 | 648 |
ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS, |
649 | 649 |
PretenureFlag pretenure = NOT_TENURED); |
650 | 650 |
|
651 |
MUST_USE_RESULT MaybeObject* AllocateJSArrayAndStorageWithAllocationSite( |
|
652 |
ElementsKind elements_kind, |
|
653 |
int length, |
|
654 |
int capacity, |
|
655 |
Handle<AllocationSite> allocation_site, |
|
656 |
ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS); |
|
657 |
|
|
658 | 651 |
MUST_USE_RESULT MaybeObject* AllocateJSArrayStorage( |
659 | 652 |
JSArray* array, |
660 | 653 |
int length, |
... | ... | |
668 | 661 |
int length, |
669 | 662 |
PretenureFlag pretenure = NOT_TENURED); |
670 | 663 |
|
671 |
// Allocates and initializes a new global object based on a constructor. |
|
672 |
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
|
673 |
// failed. |
|
674 |
// Please note this does not perform a garbage collection. |
|
675 |
MUST_USE_RESULT MaybeObject* AllocateGlobalObject(JSFunction* constructor); |
|
676 |
|
|
677 | 664 |
// Returns a deep copy of the JavaScript object. |
678 | 665 |
// Properties and elements are copied too. |
679 | 666 |
// Returns failure if allocation failed. |
680 |
MUST_USE_RESULT MaybeObject* CopyJSObject(JSObject* source); |
|
681 |
|
|
682 |
MUST_USE_RESULT MaybeObject* CopyJSObjectWithAllocationSite( |
|
683 |
JSObject* source, AllocationSite* site); |
|
667 |
// Optionally takes an AllocationSite to be appended in an AllocationMemento. |
|
668 |
MUST_USE_RESULT MaybeObject* CopyJSObject(JSObject* source, |
|
669 |
AllocationSite* site = NULL); |
|
684 | 670 |
|
685 | 671 |
// Allocates the function prototype. |
686 | 672 |
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
... | ... | |
876 | 862 |
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
877 | 863 |
// failed. |
878 | 864 |
// Please note this does not perform a garbage collection. |
879 |
MUST_USE_RESULT MaybeObject* AllocateByteArray(int length, |
|
880 |
PretenureFlag pretenure); |
|
881 |
|
|
882 |
// Allocate a non-tenured byte array of the specified length |
|
883 |
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
|
884 |
// failed. |
|
885 |
// Please note this does not perform a garbage collection. |
|
886 |
MUST_USE_RESULT MaybeObject* AllocateByteArray(int length); |
|
865 |
MUST_USE_RESULT MaybeObject* AllocateByteArray( |
|
866 |
int length, |
|
867 |
PretenureFlag pretenure = NOT_TENURED); |
|
887 | 868 |
|
888 | 869 |
// Allocates an external array of the specified length and type. |
889 | 870 |
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
... | ... | |
901 | 882 |
// Please note this does not perform a garbage collection. |
902 | 883 |
MUST_USE_RESULT MaybeObject* AllocateSymbol(); |
903 | 884 |
|
904 |
// Allocate a tenured simple cell. |
|
905 |
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
|
906 |
// failed. |
|
907 |
// Please note this does not perform a garbage collection. |
|
908 |
MUST_USE_RESULT MaybeObject* AllocateCell(Object* value); |
|
909 |
|
|
910 |
// Allocate a tenured JS global property cell. |
|
911 |
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
|
912 |
// failed. |
|
913 |
// Please note this does not perform a garbage collection. |
|
914 |
MUST_USE_RESULT MaybeObject* AllocatePropertyCell(Object* value); |
|
915 |
|
|
916 |
// Allocate Box. |
|
917 |
MUST_USE_RESULT MaybeObject* AllocateBox(Object* value, |
|
918 |
PretenureFlag pretenure); |
|
919 |
|
|
920 | 885 |
// Allocate a tenured AllocationSite. It's payload is null |
921 | 886 |
MUST_USE_RESULT MaybeObject* AllocateAllocationSite(); |
922 | 887 |
|
... | ... | |
924 | 889 |
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
925 | 890 |
// failed. |
926 | 891 |
// Please note this does not perform a garbage collection. |
927 |
MUST_USE_RESULT MaybeObject* AllocateFixedArray(int length, |
|
928 |
PretenureFlag pretenure); |
|
929 |
// Allocates a fixed array initialized with undefined values |
|
930 |
MUST_USE_RESULT MaybeObject* AllocateFixedArray(int length); |
|
892 |
MUST_USE_RESULT MaybeObject* AllocateFixedArray( |
|
893 |
int length, |
|
894 |
PretenureFlag pretenure = NOT_TENURED); |
|
931 | 895 |
|
932 | 896 |
// Allocates an uninitialized fixed array. It must be filled by the caller. |
933 | 897 |
// |
... | ... | |
958 | 922 |
MUST_USE_RESULT MaybeObject* CopyFixedDoubleArrayWithMap( |
959 | 923 |
FixedDoubleArray* src, Map* map); |
960 | 924 |
|
925 |
// Make a copy of src and return it. Returns |
|
926 |
// Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. |
|
927 |
MUST_USE_RESULT inline MaybeObject* CopyConstantPoolArray( |
|
928 |
ConstantPoolArray* src); |
|
929 |
|
|
930 |
// Make a copy of src, set the map, and return the copy. Returns |
|
931 |
// Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. |
|
932 |
MUST_USE_RESULT MaybeObject* CopyConstantPoolArrayWithMap( |
|
933 |
ConstantPoolArray* src, Map* map); |
|
934 |
|
|
961 | 935 |
// Allocates a fixed array initialized with the hole values. |
962 | 936 |
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
963 | 937 |
// failed. |
... | ... | |
966 | 940 |
int length, |
967 | 941 |
PretenureFlag pretenure = NOT_TENURED); |
968 | 942 |
|
969 |
MUST_USE_RESULT MaybeObject* AllocateRawFixedDoubleArray( |
|
970 |
int length, |
|
971 |
PretenureFlag pretenure); |
|
943 |
MUST_USE_RESULT MaybeObject* AllocateConstantPoolArray( |
|
944 |
int first_int64_index, |
|
945 |
int first_ptr_index, |
|
946 |
int first_int32_index); |
|
972 | 947 |
|
973 | 948 |
// Allocates a fixed double array with uninitialized values. Returns |
974 | 949 |
// Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. |
... | ... | |
1056 | 1031 |
|
1057 | 1032 |
// Allocated a HeapNumber from value. |
1058 | 1033 |
MUST_USE_RESULT MaybeObject* AllocateHeapNumber( |
1059 |
double value, |
|
1060 |
PretenureFlag pretenure); |
|
1061 |
// pretenure = NOT_TENURED |
|
1062 |
MUST_USE_RESULT MaybeObject* AllocateHeapNumber(double value); |
|
1034 |
double value, PretenureFlag pretenure = NOT_TENURED); |
|
1063 | 1035 |
|
1064 | 1036 |
// Converts an int into either a Smi or a HeapNumber object. |
1065 | 1037 |
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
... | ... | |
1153 | 1125 |
// self_reference. This allows generated code to reference its own Code |
1154 | 1126 |
// object by containing this pointer. |
1155 | 1127 |
// Please note this function does not perform a garbage collection. |
1156 |
MUST_USE_RESULT MaybeObject* CreateCode(const CodeDesc& desc, |
|
1157 |
Code::Flags flags, |
|
1158 |
Handle<Object> self_reference, |
|
1159 |
bool immovable = false, |
|
1160 |
bool crankshafted = false); |
|
1128 |
MUST_USE_RESULT MaybeObject* CreateCode( |
|
1129 |
const CodeDesc& desc, |
|
1130 |
Code::Flags flags, |
|
1131 |
Handle<Object> self_reference, |
|
1132 |
bool immovable = false, |
|
1133 |
bool crankshafted = false, |
|
1134 |
int prologue_offset = Code::kPrologueOffsetNotSet); |
|
1161 | 1135 |
|
1162 | 1136 |
MUST_USE_RESULT MaybeObject* CopyCode(Code* code); |
1163 | 1137 |
|
... | ... | |
1272 | 1246 |
void GarbageCollectionGreedyCheck(); |
1273 | 1247 |
#endif |
1274 | 1248 |
|
1275 |
void AddGCPrologueCallback( |
|
1276 |
GCPrologueCallback callback, GCType gc_type_filter); |
|
1277 |
void RemoveGCPrologueCallback(GCPrologueCallback callback); |
|
1278 |
|
|
1279 |
void AddGCEpilogueCallback( |
|
1280 |
GCEpilogueCallback callback, GCType gc_type_filter); |
|
1281 |
void RemoveGCEpilogueCallback(GCEpilogueCallback callback); |
|
1249 |
void AddGCPrologueCallback(v8::Isolate::GCPrologueCallback callback, |
|
1250 |
GCType gc_type_filter, |
|
1251 |
bool pass_isolate = true); |
|
1252 |
void RemoveGCPrologueCallback(v8::Isolate::GCPrologueCallback callback); |
|
1282 | 1253 |
|
1283 |
void SetGlobalGCPrologueCallback(GCCallback callback) { |
|
1284 |
ASSERT((callback == NULL) ^ (global_gc_prologue_callback_ == NULL)); |
|
1285 |
global_gc_prologue_callback_ = callback; |
|
1286 |
} |
|
1287 |
void SetGlobalGCEpilogueCallback(GCCallback callback) { |
|
1288 |
ASSERT((callback == NULL) ^ (global_gc_epilogue_callback_ == NULL)); |
|
1289 |
global_gc_epilogue_callback_ = callback; |
|
1290 |
} |
|
1254 |
void AddGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback, |
|
1255 |
GCType gc_type_filter, |
|
1256 |
bool pass_isolate = true); |
|
1257 |
void RemoveGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback); |
|
1291 | 1258 |
|
1292 | 1259 |
// Heap root getters. We have versions with and without type::cast() here. |
1293 | 1260 |
// You can't use type::cast during GC because the assert fails. |
... | ... | |
1337 | 1304 |
Object* allocation_sites_list() { return allocation_sites_list_; } |
1338 | 1305 |
Object** allocation_sites_list_address() { return &allocation_sites_list_; } |
1339 | 1306 |
|
1307 |
Object* weak_object_to_code_table() { return weak_object_to_code_table_; } |
|
1308 |
|
|
1340 | 1309 |
// Number of mark-sweeps. |
1341 | 1310 |
unsigned int ms_count() { return ms_count_; } |
1342 | 1311 |
|
... | ... | |
1428 | 1397 |
void Verify(); |
1429 | 1398 |
|
1430 | 1399 |
|
1431 |
bool weak_embedded_maps_verification_enabled() {
|
|
1432 |
return no_weak_embedded_maps_verification_scope_depth_ == 0;
|
|
1400 |
bool weak_embedded_objects_verification_enabled() {
|
|
1401 |
return no_weak_object_verification_scope_depth_ == 0;
|
|
1433 | 1402 |
} |
1434 | 1403 |
#endif |
1435 | 1404 |
|
... | ... | |
1530 | 1499 |
inline intptr_t AdjustAmountOfExternalAllocatedMemory( |
1531 | 1500 |
intptr_t change_in_bytes); |
1532 | 1501 |
|
1533 |
// Allocate uninitialized fixed array. |
|
1534 |
MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length); |
|
1535 |
MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length, |
|
1536 |
PretenureFlag pretenure); |
|
1537 |
|
|
1538 | 1502 |
// This is only needed for testing high promotion mode. |
1539 | 1503 |
void SetNewSpaceHighPromotionModeActive(bool mode) { |
1540 | 1504 |
new_space_high_promotion_mode_active_ = mode; |
... | ... | |
1692 | 1656 |
total_regexp_code_generated_ += size; |
1693 | 1657 |
} |
1694 | 1658 |
|
1659 |
void IncrementCodeGeneratedBytes(bool is_crankshafted, int size) { |
|
1660 |
if (is_crankshafted) { |
|
1661 |
crankshaft_codegen_bytes_generated_ += size; |
|
1662 |
} else { |
|
1663 |
full_codegen_bytes_generated_ += size; |
|
1664 |
} |
|
1665 |
} |
|
1666 |
|
|
1695 | 1667 |
// Returns maximum GC pause. |
1696 | 1668 |
double get_max_gc_pause() { return max_gc_pause_; } |
1697 | 1669 |
|
... | ... | |
1838 | 1810 |
FIRST_CODE_KIND_SUB_TYPE = LAST_TYPE + 1, |
1839 | 1811 |
FIRST_FIXED_ARRAY_SUB_TYPE = |
1840 | 1812 |
FIRST_CODE_KIND_SUB_TYPE + Code::NUMBER_OF_KINDS, |
1841 |
OBJECT_STATS_COUNT = |
|
1842 |
FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1 |
|
1813 |
FIRST_CODE_AGE_SUB_TYPE = |
|
1814 |
FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1, |
|
1815 |
OBJECT_STATS_COUNT = FIRST_CODE_AGE_SUB_TYPE + Code::kLastCodeAge + 1 |
|
1843 | 1816 |
}; |
1844 | 1817 |
|
1845 |
void RecordObjectStats(InstanceType type, int sub_type, size_t size) {
|
|
1818 |
void RecordObjectStats(InstanceType type, size_t size) { |
|
1846 | 1819 |
ASSERT(type <= LAST_TYPE); |
1847 |
if (sub_type < 0) { |
|
1848 |
object_counts_[type]++; |
|
1849 |
object_sizes_[type] += size; |
|
1850 |
} else { |
|
1851 |
if (type == CODE_TYPE) { |
|
1852 |
ASSERT(sub_type < Code::NUMBER_OF_KINDS); |
|
1853 |
object_counts_[FIRST_CODE_KIND_SUB_TYPE + sub_type]++; |
|
1854 |
object_sizes_[FIRST_CODE_KIND_SUB_TYPE + sub_type] += size; |
|
1855 |
} else if (type == FIXED_ARRAY_TYPE) { |
|
1856 |
ASSERT(sub_type <= LAST_FIXED_ARRAY_SUB_TYPE); |
|
1857 |
object_counts_[FIRST_FIXED_ARRAY_SUB_TYPE + sub_type]++; |
|
1858 |
object_sizes_[FIRST_FIXED_ARRAY_SUB_TYPE + sub_type] += size; |
|
1859 |
} |
|
1860 |
} |
|
1820 |
object_counts_[type]++; |
|
1821 |
object_sizes_[type] += size; |
|
1822 |
} |
|
1823 |
|
|
1824 |
void RecordCodeSubTypeStats(int code_sub_type, int code_age, size_t size) { |
|
1825 |
ASSERT(code_sub_type < Code::NUMBER_OF_KINDS); |
|
1826 |
ASSERT(code_age < Code::kLastCodeAge); |
|
1827 |
object_counts_[FIRST_CODE_KIND_SUB_TYPE + code_sub_type]++; |
|
1828 |
object_sizes_[FIRST_CODE_KIND_SUB_TYPE + code_sub_type] += size; |
|
1829 |
object_counts_[FIRST_CODE_AGE_SUB_TYPE + code_age]++; |
|
1830 |
object_sizes_[FIRST_CODE_AGE_SUB_TYPE + code_age] += size; |
|
1831 |
} |
|
1832 |
|
|
1833 |
void RecordFixedArraySubTypeStats(int array_sub_type, size_t size) { |
|
1834 |
ASSERT(array_sub_type <= LAST_FIXED_ARRAY_SUB_TYPE); |
|
1835 |
object_counts_[FIRST_FIXED_ARRAY_SUB_TYPE + array_sub_type]++; |
|
1836 |
object_sizes_[FIRST_FIXED_ARRAY_SUB_TYPE + array_sub_type] += size; |
|
1861 | 1837 |
} |
1862 | 1838 |
|
1863 | 1839 |
void CheckpointObjectStats(); |
... | ... | |
1887 | 1863 |
Heap* heap_; |
1888 | 1864 |
}; |
1889 | 1865 |
|
1866 |
MaybeObject* AddWeakObjectToCodeDependency(Object* obj, DependentCode* dep); |
|
1867 |
|
|
1868 |
DependentCode* LookupWeakObjectToCodeDependency(Object* obj); |
|
1869 |
|
|
1870 |
void InitializeWeakObjectToCodeTable() { |
|
1871 |
set_weak_object_to_code_table(undefined_value()); |
|
1872 |
} |
|
1873 |
|
|
1874 |
void EnsureWeakObjectToCodeTable(); |
|
1875 |
|
|
1890 | 1876 |
private: |
1891 | 1877 |
Heap(); |
1892 | 1878 |
|
... | ... | |
1920 | 1906 |
|
1921 | 1907 |
bool flush_monomorphic_ics_; |
1922 | 1908 |
|
1909 |
// AllocationMementos found in new space. |
|
1910 |
int allocation_mementos_found_; |
|
1911 |
|
|
1923 | 1912 |
int scan_on_scavenge_pages_; |
1924 | 1913 |
|
1925 | 1914 |
NewSpace new_space_; |
... | ... | |
1998 | 1987 |
bool old_gen_exhausted_; |
1999 | 1988 |
|
2000 | 1989 |
// Weak list heads, threaded through the objects. |
1990 |
// List heads are initilized lazily and contain the undefined_value at start. |
|
2001 | 1991 |
Object* native_contexts_list_; |
2002 | 1992 |
Object* array_buffers_list_; |
2003 | 1993 |
Object* allocation_sites_list_; |
2004 | 1994 |
|
1995 |
// WeakHashTable that maps objects embedded in optimized code to dependent |
|
1996 |
// code list. It is initilized lazily and contains the undefined_value at |
|
1997 |
// start. |
|
1998 |
Object* weak_object_to_code_table_; |
|
1999 |
|
|
2005 | 2000 |
StoreBufferRebuilder store_buffer_rebuilder_; |
2006 | 2001 |
|
2007 | 2002 |
struct StringTypeTable { |
... | ... | |
2032 | 2027 |
// GC callback function, called before and after mark-compact GC. |
2033 | 2028 |
// Allocations in the callback function are disallowed. |
2034 | 2029 |
struct GCPrologueCallbackPair { |
2035 |
GCPrologueCallbackPair(GCPrologueCallback callback, GCType gc_type) |
|
2036 |
: callback(callback), gc_type(gc_type) { |
|
2030 |
GCPrologueCallbackPair(v8::Isolate::GCPrologueCallback callback, |
|
2031 |
GCType gc_type, |
|
2032 |
bool pass_isolate) |
|
2033 |
: callback(callback), gc_type(gc_type), pass_isolate_(pass_isolate) { |
|
2037 | 2034 |
} |
2038 | 2035 |
bool operator==(const GCPrologueCallbackPair& pair) const { |
2039 | 2036 |
return pair.callback == callback; |
2040 | 2037 |
} |
2041 |
GCPrologueCallback callback; |
|
2038 |
v8::Isolate::GCPrologueCallback callback;
|
|
2042 | 2039 |
GCType gc_type; |
2040 |
// TODO(dcarney): remove variable |
|
2041 |
bool pass_isolate_; |
|
2043 | 2042 |
}; |
2044 | 2043 |
List<GCPrologueCallbackPair> gc_prologue_callbacks_; |
2045 | 2044 |
|
2046 | 2045 |
struct GCEpilogueCallbackPair { |
2047 |
GCEpilogueCallbackPair(GCEpilogueCallback callback, GCType gc_type) |
|
2048 |
: callback(callback), gc_type(gc_type) { |
|
2046 |
GCEpilogueCallbackPair(v8::Isolate::GCPrologueCallback callback, |
|
2047 |
GCType gc_type, |
|
2048 |
bool pass_isolate) |
|
2049 |
: callback(callback), gc_type(gc_type), pass_isolate_(pass_isolate) { |
|
2049 | 2050 |
} |
2050 | 2051 |
bool operator==(const GCEpilogueCallbackPair& pair) const { |
2051 | 2052 |
return pair.callback == callback; |
2052 | 2053 |
} |
2053 |
GCEpilogueCallback callback;
|
|
2054 |
v8::Isolate::GCPrologueCallback callback;
|
|
2054 | 2055 |
GCType gc_type; |
2056 |
// TODO(dcarney): remove variable |
|
2057 |
bool pass_isolate_; |
|
2055 | 2058 |
}; |
2056 | 2059 |
List<GCEpilogueCallbackPair> gc_epilogue_callbacks_; |
2057 | 2060 |
|
2058 |
GCCallback global_gc_prologue_callback_; |
|
2059 |
GCCallback global_gc_epilogue_callback_; |
|
2060 |
|
|
2061 | 2061 |
// Support for computing object sizes during GC. |
2062 | 2062 |
HeapObjectCallback gc_safe_size_of_old_object_; |
2063 | 2063 |
static int GcSafeSizeOfOldObject(HeapObject* object); |
... | ... | |
2080 | 2080 |
|
2081 | 2081 |
inline void UpdateOldSpaceLimits(); |
2082 | 2082 |
|
2083 |
// Allocate an uninitialized object in map space. The behavior is identical |
|
2084 |
// to Heap::AllocateRaw(size_in_bytes, MAP_SPACE), except that (a) it doesn't |
|
2085 |
// have to test the allocation space argument and (b) can reduce code size |
|
2086 |
// (since both AllocateRaw and AllocateRawMap are inlined). |
|
2087 |
MUST_USE_RESULT inline MaybeObject* AllocateRawMap(); |
|
2083 |
// Selects the proper allocation space depending on the given object |
|
2084 |
// size, pretenuring decision, and preferred old-space. |
|
2085 |
static AllocationSpace SelectSpace(int object_size, |
|
2086 |
AllocationSpace preferred_old_space, |
|
2087 |
PretenureFlag pretenure) { |
|
2088 |
ASSERT(preferred_old_space == OLD_POINTER_SPACE || |
|
2089 |
preferred_old_space == OLD_DATA_SPACE); |
|
2090 |
if (object_size > Page::kMaxNonCodeHeapObjectSize) return LO_SPACE; |
|
2091 |
return (pretenure == TENURED) ? preferred_old_space : NEW_SPACE; |
|
2092 |
} |
|
2093 |
|
|
2094 |
// Allocate an uninitialized fixed array. |
|
2095 |
MUST_USE_RESULT MaybeObject* AllocateRawFixedArray( |
|
2096 |
int length, PretenureFlag pretenure); |
|
2088 | 2097 |
|
2089 |
// Allocate an uninitialized object in the simple cell space. |
|
2090 |
MUST_USE_RESULT inline MaybeObject* AllocateRawCell(); |
|
2098 |
// Allocate an uninitialized fixed double array. |
|
2099 |
MUST_USE_RESULT MaybeObject* AllocateRawFixedDoubleArray( |
|
2100 |
int length, PretenureFlag pretenure); |
|
2091 | 2101 |
|
2092 |
// Allocate an uninitialized object in the global property cell space. |
|
2093 |
MUST_USE_RESULT inline MaybeObject* AllocateRawPropertyCell(); |
|
2102 |
// Allocate an initialized fixed array with the given filler value. |
|
2103 |
MUST_USE_RESULT MaybeObject* AllocateFixedArrayWithFiller( |
|
2104 |
int length, PretenureFlag pretenure, Object* filler); |
|
2094 | 2105 |
|
2095 | 2106 |
// Initializes a JSObject based on its map. |
2096 | 2107 |
void InitializeJSObjectFromMap(JSObject* obj, |
... | ... | |
2116 | 2127 |
ElementsKind elements_kind, |
2117 | 2128 |
PretenureFlag pretenure = NOT_TENURED); |
2118 | 2129 |
|
2119 |
MUST_USE_RESULT MaybeObject* AllocateJSArrayWithAllocationSite( |
|
2120 |
ElementsKind elements_kind, |
|
2121 |
Handle<AllocationSite> allocation_site); |
|
2122 |
|
|
2123 | 2130 |
// Allocate empty fixed array. |
2124 | 2131 |
MUST_USE_RESULT MaybeObject* AllocateEmptyFixedArray(); |
2125 | 2132 |
|
... | ... | |
2130 | 2137 |
// Allocate empty fixed double array. |
2131 | 2138 |
MUST_USE_RESULT MaybeObject* AllocateEmptyFixedDoubleArray(); |
2132 | 2139 |
|
2140 |
// Allocate a tenured simple cell. |
|
2141 |
MUST_USE_RESULT MaybeObject* AllocateCell(Object* value); |
|
2142 |
|
|
2143 |
// Allocate a tenured JS global property cell initialized with the hole. |
|
2144 |
MUST_USE_RESULT MaybeObject* AllocatePropertyCell(); |
|
2145 |
|
|
2146 |
// Allocate Box. |
|
2147 |
MUST_USE_RESULT MaybeObject* AllocateBox(Object* value, |
|
2148 |
PretenureFlag pretenure); |
|
2149 |
|
|
2133 | 2150 |
// Performs a minor collection in new generation. |
2134 | 2151 |
void Scavenge(); |
2135 | 2152 |
|
... | ... | |
2286 | 2303 |
|
2287 | 2304 |
void ClearObjectStats(bool clear_last_time_stats = false); |
2288 | 2305 |
|
2306 |
void set_weak_object_to_code_table(Object* value) { |
|
2307 |
ASSERT(!InNewSpace(value)); |
|
2308 |
weak_object_to_code_table_ = value; |
|
2309 |
} |
|
2310 |
|
|
2311 |
Object** weak_object_to_code_table_address() { |
|
2312 |
return &weak_object_to_code_table_; |
|
2313 |
} |
|
2314 |
|
|
2289 | 2315 |
static const int kInitialStringTableSize = 2048; |
2290 | 2316 |
static const int kInitialEvalCacheSize = 64; |
2291 | 2317 |
static const int kInitialNumberStringCacheSize = 256; |
... | ... | |
2335 | 2361 |
unsigned int gc_count_at_last_idle_gc_; |
2336 | 2362 |
int scavenges_since_last_idle_round_; |
2337 | 2363 |
|
2364 |
// These two counters are monotomically increasing and never reset. |
|
2365 |
size_t full_codegen_bytes_generated_; |
|
2366 |
size_t crankshaft_codegen_bytes_generated_; |
|
2367 |
|
|
2338 | 2368 |
// If the --deopt_every_n_garbage_collections flag is set to a positive value, |
2339 | 2369 |
// this variable holds the number of garbage collections since the last |
2340 | 2370 |
// deoptimization triggered by garbage collection. |
2341 | 2371 |
int gcs_since_last_deopt_; |
2342 | 2372 |
|
2343 | 2373 |
#ifdef VERIFY_HEAP |
2344 |
int no_weak_embedded_maps_verification_scope_depth_;
|
|
2374 |
int no_weak_object_verification_scope_depth_;
|
|
2345 | 2375 |
#endif |
2346 | 2376 |
|
2347 | 2377 |
static const int kMaxMarkSweepsInIdleRound = 7; |
... | ... | |
2375 | 2405 |
friend class MarkCompactMarkingVisitor; |
2376 | 2406 |
friend class MapCompact; |
2377 | 2407 |
#ifdef VERIFY_HEAP |
2378 |
friend class NoWeakEmbeddedMapsVerificationScope;
|
|
2408 |
friend class NoWeakObjectVerificationScope;
|
|
2379 | 2409 |
#endif |
2380 | 2410 |
|
2381 | 2411 |
DISALLOW_COPY_AND_ASSIGN(Heap); |
... | ... | |
2440 | 2470 |
}; |
2441 | 2471 |
|
2442 | 2472 |
#ifdef VERIFY_HEAP |
2443 |
class NoWeakEmbeddedMapsVerificationScope {
|
|
2473 |
class NoWeakObjectVerificationScope {
|
|
2444 | 2474 |
public: |
2445 |
inline NoWeakEmbeddedMapsVerificationScope();
|
|
2446 |
inline ~NoWeakEmbeddedMapsVerificationScope();
|
|
2475 |
inline NoWeakObjectVerificationScope();
|
|
2476 |
inline ~NoWeakObjectVerificationScope();
|
|
2447 | 2477 |
}; |
2448 | 2478 |
#endif |
2449 | 2479 |
|
Also available in: Unified diff