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

Side by Side Diff: src/heap.h

Issue 145773008: A64: Synchronize with r17104. (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/handles-inl.h ('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
1311 // Number of mark-sweeps. 1313 // Number of mark-sweeps.
1312 unsigned int ms_count() { return ms_count_; } 1314 unsigned int ms_count() { return ms_count_; }
1313 1315
1314 // Iterates over all roots in the heap. 1316 // Iterates over all roots in the heap.
1315 void IterateRoots(ObjectVisitor* v, VisitMode mode); 1317 void IterateRoots(ObjectVisitor* v, VisitMode mode);
1316 // Iterates over all strong roots in the heap. 1318 // Iterates over all strong roots in the heap.
1317 void IterateStrongRoots(ObjectVisitor* v, VisitMode mode); 1319 void IterateStrongRoots(ObjectVisitor* v, VisitMode mode);
1318 // Iterates over all the other roots in the heap. 1320 // Iterates over all the other roots in the heap.
1319 void IterateWeakRoots(ObjectVisitor* v, VisitMode mode); 1321 void IterateWeakRoots(ObjectVisitor* v, VisitMode mode);
1320 1322
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 // Get address of native contexts list for serialization support. 1394 // Get address of native contexts list for serialization support.
1393 Object** native_contexts_list_address() { 1395 Object** native_contexts_list_address() {
1394 return &native_contexts_list_; 1396 return &native_contexts_list_;
1395 } 1397 }
1396 1398
1397 #ifdef VERIFY_HEAP 1399 #ifdef VERIFY_HEAP
1398 // Verify the heap is in its normal state before or after a GC. 1400 // Verify the heap is in its normal state before or after a GC.
1399 void Verify(); 1401 void Verify();
1400 1402
1401 1403
1402 bool weak_embedded_maps_verification_enabled() { 1404 bool weak_embedded_objects_verification_enabled() {
1403 return no_weak_embedded_maps_verification_scope_depth_ == 0; 1405 return no_weak_object_verification_scope_depth_ == 0;
1404 } 1406 }
1405 #endif 1407 #endif
1406 1408
1407 #ifdef DEBUG 1409 #ifdef DEBUG
1408 void Print(); 1410 void Print();
1409 void PrintHandles(); 1411 void PrintHandles();
1410 1412
1411 void OldPointerSpaceCheckStoreBuffer(); 1413 void OldPointerSpaceCheckStoreBuffer();
1412 void MapSpaceCheckStoreBuffer(); 1414 void MapSpaceCheckStoreBuffer();
1413 void LargeObjectSpaceCheckStoreBuffer(); 1415 void LargeObjectSpaceCheckStoreBuffer();
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 #ifdef DEBUG 1848 #ifdef DEBUG
1847 static bool IsLockedByOptimizerThread(Heap* heap) { 1849 static bool IsLockedByOptimizerThread(Heap* heap) {
1848 return heap->relocation_mutex_locked_by_optimizer_thread_; 1850 return heap->relocation_mutex_locked_by_optimizer_thread_;
1849 } 1851 }
1850 #endif // DEBUG 1852 #endif // DEBUG
1851 1853
1852 private: 1854 private:
1853 Heap* heap_; 1855 Heap* heap_;
1854 }; 1856 };
1855 1857
1858 MaybeObject* AddWeakObjectToCodeDependency(Object* obj, DependentCode* dep);
1859
1860 DependentCode* LookupWeakObjectToCodeDependency(Object* obj);
1861
1862 void InitializeWeakObjectToCodeTable() {
1863 set_weak_object_to_code_table(undefined_value());
1864 }
1865
1866 void EnsureWeakObjectToCodeTable();
1867
1856 private: 1868 private:
1857 Heap(); 1869 Heap();
1858 1870
1859 // This can be calculated directly from a pointer to the heap; however, it is 1871 // 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. 1872 // more expedient to get at the isolate directly from within Heap methods.
1861 Isolate* isolate_; 1873 Isolate* isolate_;
1862 1874
1863 Object* roots_[kRootListLength]; 1875 Object* roots_[kRootListLength];
1864 1876
1865 intptr_t code_range_size_; 1877 intptr_t code_range_size_;
(...skipping 13 matching lines...) Expand all
1879 int always_allocate_scope_depth_; 1891 int always_allocate_scope_depth_;
1880 int linear_allocation_scope_depth_; 1892 int linear_allocation_scope_depth_;
1881 1893
1882 // For keeping track of context disposals. 1894 // For keeping track of context disposals.
1883 int contexts_disposed_; 1895 int contexts_disposed_;
1884 1896
1885 int global_ic_age_; 1897 int global_ic_age_;
1886 1898
1887 bool flush_monomorphic_ics_; 1899 bool flush_monomorphic_ics_;
1888 1900
1901 // AllocationMementos found in new space.
1902 int allocation_mementos_found_;
1903
1889 int scan_on_scavenge_pages_; 1904 int scan_on_scavenge_pages_;
1890 1905
1891 NewSpace new_space_; 1906 NewSpace new_space_;
1892 OldSpace* old_pointer_space_; 1907 OldSpace* old_pointer_space_;
1893 OldSpace* old_data_space_; 1908 OldSpace* old_data_space_;
1894 OldSpace* code_space_; 1909 OldSpace* code_space_;
1895 MapSpace* map_space_; 1910 MapSpace* map_space_;
1896 CellSpace* cell_space_; 1911 CellSpace* cell_space_;
1897 PropertyCellSpace* property_cell_space_; 1912 PropertyCellSpace* property_cell_space_;
1898 LargeObjectSpace* lo_space_; 1913 LargeObjectSpace* lo_space_;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 intptr_t amount_of_external_allocated_memory_; 1972 intptr_t amount_of_external_allocated_memory_;
1958 1973
1959 // 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.
1960 intptr_t amount_of_external_allocated_memory_at_last_global_gc_; 1975 intptr_t amount_of_external_allocated_memory_at_last_global_gc_;
1961 1976
1962 // 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
1963 // last GC. 1978 // last GC.
1964 bool old_gen_exhausted_; 1979 bool old_gen_exhausted_;
1965 1980
1966 // Weak list heads, threaded through the objects. 1981 // Weak list heads, threaded through the objects.
1982 // List heads are initilized lazily and contain the undefined_value at start.
1967 Object* native_contexts_list_; 1983 Object* native_contexts_list_;
1968 Object* array_buffers_list_; 1984 Object* array_buffers_list_;
1969 Object* allocation_sites_list_; 1985 Object* allocation_sites_list_;
1970 1986
1987 // WeakHashTable that maps objects embedded in optimized code to dependent
1988 // code list. It is initilized lazily and contains the undefined_value at
1989 // start.
1990 Object* weak_object_to_code_table_;
1991
1971 StoreBufferRebuilder store_buffer_rebuilder_; 1992 StoreBufferRebuilder store_buffer_rebuilder_;
1972 1993
1973 struct StringTypeTable { 1994 struct StringTypeTable {
1974 InstanceType type; 1995 InstanceType type;
1975 int size; 1996 int size;
1976 RootListIndex index; 1997 RootListIndex index;
1977 }; 1998 };
1978 1999
1979 struct ConstantStringTable { 2000 struct ConstantStringTable {
1980 const char* contents; 2001 const char* contents;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 return heap_size_mb / kMbPerMs; 2290 return heap_size_mb / kMbPerMs;
2270 } 2291 }
2271 2292
2272 // Returns true if no more GC work is left. 2293 // Returns true if no more GC work is left.
2273 bool IdleGlobalGC(); 2294 bool IdleGlobalGC();
2274 2295
2275 void AdvanceIdleIncrementalMarking(intptr_t step_size); 2296 void AdvanceIdleIncrementalMarking(intptr_t step_size);
2276 2297
2277 void ClearObjectStats(bool clear_last_time_stats = false); 2298 void ClearObjectStats(bool clear_last_time_stats = false);
2278 2299
2300 void set_weak_object_to_code_table(Object* value) {
2301 ASSERT(!InNewSpace(value));
2302 weak_object_to_code_table_ = value;
2303 }
2304
2305 Object** weak_object_to_code_table_address() {
2306 return &weak_object_to_code_table_;
2307 }
2308
2279 static const int kInitialStringTableSize = 2048; 2309 static const int kInitialStringTableSize = 2048;
2280 static const int kInitialEvalCacheSize = 64; 2310 static const int kInitialEvalCacheSize = 64;
2281 static const int kInitialNumberStringCacheSize = 256; 2311 static const int kInitialNumberStringCacheSize = 256;
2282 2312
2283 // Object counts and used memory by InstanceType 2313 // Object counts and used memory by InstanceType
2284 size_t object_counts_[OBJECT_STATS_COUNT]; 2314 size_t object_counts_[OBJECT_STATS_COUNT];
2285 size_t object_counts_last_time_[OBJECT_STATS_COUNT]; 2315 size_t object_counts_last_time_[OBJECT_STATS_COUNT];
2286 size_t object_sizes_[OBJECT_STATS_COUNT]; 2316 size_t object_sizes_[OBJECT_STATS_COUNT];
2287 size_t object_sizes_last_time_[OBJECT_STATS_COUNT]; 2317 size_t object_sizes_last_time_[OBJECT_STATS_COUNT];
2288 2318
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2324 int mark_sweeps_since_idle_round_started_; 2354 int mark_sweeps_since_idle_round_started_;
2325 unsigned int gc_count_at_last_idle_gc_; 2355 unsigned int gc_count_at_last_idle_gc_;
2326 int scavenges_since_last_idle_round_; 2356 int scavenges_since_last_idle_round_;
2327 2357
2328 // If the --deopt_every_n_garbage_collections flag is set to a positive value, 2358 // If the --deopt_every_n_garbage_collections flag is set to a positive value,
2329 // this variable holds the number of garbage collections since the last 2359 // this variable holds the number of garbage collections since the last
2330 // deoptimization triggered by garbage collection. 2360 // deoptimization triggered by garbage collection.
2331 int gcs_since_last_deopt_; 2361 int gcs_since_last_deopt_;
2332 2362
2333 #ifdef VERIFY_HEAP 2363 #ifdef VERIFY_HEAP
2334 int no_weak_embedded_maps_verification_scope_depth_; 2364 int no_weak_object_verification_scope_depth_;
2335 #endif 2365 #endif
2336 2366
2337 static const int kMaxMarkSweepsInIdleRound = 7; 2367 static const int kMaxMarkSweepsInIdleRound = 7;
2338 static const int kIdleScavengeThreshold = 5; 2368 static const int kIdleScavengeThreshold = 5;
2339 2369
2340 // Shared state read by the scavenge collector and set by ScavengeObject. 2370 // Shared state read by the scavenge collector and set by ScavengeObject.
2341 PromotionQueue promotion_queue_; 2371 PromotionQueue promotion_queue_;
2342 2372
2343 // Flag is set when the heap has been configured. The heap can be repeatedly 2373 // Flag is set when the heap has been configured. The heap can be repeatedly
2344 // configured through the API until it is set up. 2374 // configured through the API until it is set up.
(...skipping 13 matching lines...) Expand all
2358 friend class Factory; 2388 friend class Factory;
2359 friend class GCTracer; 2389 friend class GCTracer;
2360 friend class DisallowAllocationFailure; 2390 friend class DisallowAllocationFailure;
2361 friend class AlwaysAllocateScope; 2391 friend class AlwaysAllocateScope;
2362 friend class Page; 2392 friend class Page;
2363 friend class Isolate; 2393 friend class Isolate;
2364 friend class MarkCompactCollector; 2394 friend class MarkCompactCollector;
2365 friend class MarkCompactMarkingVisitor; 2395 friend class MarkCompactMarkingVisitor;
2366 friend class MapCompact; 2396 friend class MapCompact;
2367 #ifdef VERIFY_HEAP 2397 #ifdef VERIFY_HEAP
2368 friend class NoWeakEmbeddedMapsVerificationScope; 2398 friend class NoWeakObjectVerificationScope;
2369 #endif 2399 #endif
2370 2400
2371 DISALLOW_COPY_AND_ASSIGN(Heap); 2401 DISALLOW_COPY_AND_ASSIGN(Heap);
2372 }; 2402 };
2373 2403
2374 2404
2375 class HeapStats { 2405 class HeapStats {
2376 public: 2406 public:
2377 static const int kStartMarker = 0xDECADE00; 2407 static const int kStartMarker = 0xDECADE00;
2378 static const int kEndMarker = 0xDECADE01; 2408 static const int kEndMarker = 0xDECADE01;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2423 public: 2453 public:
2424 inline AlwaysAllocateScope(); 2454 inline AlwaysAllocateScope();
2425 inline ~AlwaysAllocateScope(); 2455 inline ~AlwaysAllocateScope();
2426 2456
2427 private: 2457 private:
2428 // Implicitly disable artificial allocation failures. 2458 // Implicitly disable artificial allocation failures.
2429 DisallowAllocationFailure disallow_allocation_failure_; 2459 DisallowAllocationFailure disallow_allocation_failure_;
2430 }; 2460 };
2431 2461
2432 #ifdef VERIFY_HEAP 2462 #ifdef VERIFY_HEAP
2433 class NoWeakEmbeddedMapsVerificationScope { 2463 class NoWeakObjectVerificationScope {
2434 public: 2464 public:
2435 inline NoWeakEmbeddedMapsVerificationScope(); 2465 inline NoWeakObjectVerificationScope();
2436 inline ~NoWeakEmbeddedMapsVerificationScope(); 2466 inline ~NoWeakObjectVerificationScope();
2437 }; 2467 };
2438 #endif 2468 #endif
2439 2469
2440 2470
2441 // Visitor class to verify interior pointers in spaces that do not contain 2471 // Visitor class to verify interior pointers in spaces that do not contain
2442 // or care about intergenerational references. All heap object pointers have to 2472 // or care about intergenerational references. All heap object pointers have to
2443 // point into the heap to a location that has a map pointer at its first word. 2473 // point into the heap to a location that has a map pointer at its first word.
2444 // Caveat: Heap::Contains is an approximation because it can return true for 2474 // Caveat: Heap::Contains is an approximation because it can return true for
2445 // objects in a heap space but above the allocation pointer. 2475 // objects in a heap space but above the allocation pointer.
2446 class VerifyPointersVisitor: public ObjectVisitor { 2476 class VerifyPointersVisitor: public ObjectVisitor {
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
3030 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 3060 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
3031 3061
3032 private: 3062 private:
3033 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 3063 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
3034 }; 3064 };
3035 #endif // DEBUG 3065 #endif // DEBUG
3036 3066
3037 } } // namespace v8::internal 3067 } } // namespace v8::internal
3038 3068
3039 #endif // V8_HEAP_H_ 3069 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/handles-inl.h ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698