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

Side by Side Diff: src/heap.h

Issue 23477061: Make objects embedded in optimized code weak. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase and fix weak object verification. Created 7 years, 2 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
« src/handles.h ('K') | « 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 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 array_buffers_list_ = object; 1301 array_buffers_list_ = object;
1302 } 1302 }
1303 Object* array_buffers_list() { return array_buffers_list_; } 1303 Object* array_buffers_list() { return array_buffers_list_; }
1304 1304
1305 void set_allocation_sites_list(Object* object) { 1305 void set_allocation_sites_list(Object* object) {
1306 allocation_sites_list_ = object; 1306 allocation_sites_list_ = object;
1307 } 1307 }
1308 Object* allocation_sites_list() { return allocation_sites_list_; } 1308 Object* allocation_sites_list() { return allocation_sites_list_; }
1309 Object** allocation_sites_list_address() { return &allocation_sites_list_; } 1309 Object** allocation_sites_list_address() { return &allocation_sites_list_; }
1310 1310
1311 Object* weak_object_to_code_table() { return weak_object_to_code_table_; }
1312
1313
Hannes Payer (out of office) 2013/10/02 12:21:47 remove one newline
ulan 2013/10/02 12:36:49 Done.
1311 // Number of mark-sweeps. 1314 // Number of mark-sweeps.
1312 unsigned int ms_count() { return ms_count_; } 1315 unsigned int ms_count() { return ms_count_; }
1313 1316
1314 // Iterates over all roots in the heap. 1317 // Iterates over all roots in the heap.
1315 void IterateRoots(ObjectVisitor* v, VisitMode mode); 1318 void IterateRoots(ObjectVisitor* v, VisitMode mode);
1316 // Iterates over all strong roots in the heap. 1319 // Iterates over all strong roots in the heap.
1317 void IterateStrongRoots(ObjectVisitor* v, VisitMode mode); 1320 void IterateStrongRoots(ObjectVisitor* v, VisitMode mode);
1318 // Iterates over all the other roots in the heap. 1321 // Iterates over all the other roots in the heap.
1319 void IterateWeakRoots(ObjectVisitor* v, VisitMode mode); 1322 void IterateWeakRoots(ObjectVisitor* v, VisitMode mode);
1320 1323
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 #ifdef DEBUG 1849 #ifdef DEBUG
1847 static bool IsLockedByOptimizerThread(Heap* heap) { 1850 static bool IsLockedByOptimizerThread(Heap* heap) {
1848 return heap->relocation_mutex_locked_by_optimizer_thread_; 1851 return heap->relocation_mutex_locked_by_optimizer_thread_;
1849 } 1852 }
1850 #endif // DEBUG 1853 #endif // DEBUG
1851 1854
1852 private: 1855 private:
1853 Heap* heap_; 1856 Heap* heap_;
1854 }; 1857 };
1855 1858
1859 MaybeObject* AddWeakObjectToCodeDependency(Object* obj, DependentCode* dep);
1860
1861 DependentCode* LookupWeakObjectToCodeDependency(Object* obj);
1862
1863 void InitializeWeakObjectToCodeTable() {
1864 set_weak_object_to_code_table(undefined_value());
1865 }
1866
1867 void EnsureWeakObjectToCodeTable();
1868
1856 private: 1869 private:
1857 Heap(); 1870 Heap();
1858 1871
1859 // This can be calculated directly from a pointer to the heap; however, it is 1872 // This can be calculated directly from a pointer to the heap; however, it is
1860 // more expedient to get at the isolate directly from within Heap methods. 1873 // more expedient to get at the isolate directly from within Heap methods.
1861 Isolate* isolate_; 1874 Isolate* isolate_;
1862 1875
1863 Object* roots_[kRootListLength]; 1876 Object* roots_[kRootListLength];
1864 1877
1865 intptr_t code_range_size_; 1878 intptr_t code_range_size_;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1960 intptr_t amount_of_external_allocated_memory_; 1973 intptr_t amount_of_external_allocated_memory_;
1961 1974
1962 // Caches the amount of external memory registered at the last global gc. 1975 // Caches the amount of external memory registered at the last global gc.
1963 intptr_t amount_of_external_allocated_memory_at_last_global_gc_; 1976 intptr_t amount_of_external_allocated_memory_at_last_global_gc_;
1964 1977
1965 // Indicates that an allocation has failed in the old generation since the 1978 // Indicates that an allocation has failed in the old generation since the
1966 // last GC. 1979 // last GC.
1967 bool old_gen_exhausted_; 1980 bool old_gen_exhausted_;
1968 1981
1969 // Weak list heads, threaded through the objects. 1982 // Weak list heads, threaded through the objects.
1983 // List heads are initilized lazily and contain the undefined_value at start.
1970 Object* native_contexts_list_; 1984 Object* native_contexts_list_;
1971 Object* array_buffers_list_; 1985 Object* array_buffers_list_;
1972 Object* allocation_sites_list_; 1986 Object* allocation_sites_list_;
1973 1987
1988 // WeakHashTable that maps objects embedded in optimized code to dependent
1989 // code list. It is initilized lazily and contains the undefined_value at
1990 // start.
1991 Object* weak_object_to_code_table_;
1992
1974 StoreBufferRebuilder store_buffer_rebuilder_; 1993 StoreBufferRebuilder store_buffer_rebuilder_;
1975 1994
1976 struct StringTypeTable { 1995 struct StringTypeTable {
1977 InstanceType type; 1996 InstanceType type;
1978 int size; 1997 int size;
1979 RootListIndex index; 1998 RootListIndex index;
1980 }; 1999 };
1981 2000
1982 struct ConstantStringTable { 2001 struct ConstantStringTable {
1983 const char* contents; 2002 const char* contents;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2272 return heap_size_mb / kMbPerMs; 2291 return heap_size_mb / kMbPerMs;
2273 } 2292 }
2274 2293
2275 // Returns true if no more GC work is left. 2294 // Returns true if no more GC work is left.
2276 bool IdleGlobalGC(); 2295 bool IdleGlobalGC();
2277 2296
2278 void AdvanceIdleIncrementalMarking(intptr_t step_size); 2297 void AdvanceIdleIncrementalMarking(intptr_t step_size);
2279 2298
2280 void ClearObjectStats(bool clear_last_time_stats = false); 2299 void ClearObjectStats(bool clear_last_time_stats = false);
2281 2300
2301 void set_weak_object_to_code_table(Object* value) {
2302 ASSERT(!InNewSpace(value));
2303 weak_object_to_code_table_ = value;
2304 }
2305
2306 Object** weak_object_to_code_table_address() {
2307 return &weak_object_to_code_table_;
2308 }
2309
2282 static const int kInitialStringTableSize = 2048; 2310 static const int kInitialStringTableSize = 2048;
2283 static const int kInitialEvalCacheSize = 64; 2311 static const int kInitialEvalCacheSize = 64;
2284 static const int kInitialNumberStringCacheSize = 256; 2312 static const int kInitialNumberStringCacheSize = 256;
2285 2313
2286 // Object counts and used memory by InstanceType 2314 // Object counts and used memory by InstanceType
2287 size_t object_counts_[OBJECT_STATS_COUNT]; 2315 size_t object_counts_[OBJECT_STATS_COUNT];
2288 size_t object_counts_last_time_[OBJECT_STATS_COUNT]; 2316 size_t object_counts_last_time_[OBJECT_STATS_COUNT];
2289 size_t object_sizes_[OBJECT_STATS_COUNT]; 2317 size_t object_sizes_[OBJECT_STATS_COUNT];
2290 size_t object_sizes_last_time_[OBJECT_STATS_COUNT]; 2318 size_t object_sizes_last_time_[OBJECT_STATS_COUNT];
2291 2319
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
3033 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 3061 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
3034 3062
3035 private: 3063 private:
3036 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 3064 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
3037 }; 3065 };
3038 #endif // DEBUG 3066 #endif // DEBUG
3039 3067
3040 } } // namespace v8::internal 3068 } } // namespace v8::internal
3041 3069
3042 #endif // V8_HEAP_H_ 3070 #endif // V8_HEAP_H_
OLDNEW
« src/handles.h ('K') | « src/handles.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698