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

Side by Side Diff: src/heap.h

Issue 325553002: --verify-predictable mode added for ensuring that GC behaves deterministically. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing comments Created 6 years, 6 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HEAP_H_ 5 #ifndef V8_HEAP_H_
6 #define V8_HEAP_H_ 6 #define V8_HEAP_H_
7 7
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 return true; 969 return true;
970 #else 970 #else
971 #ifdef VERIFY_HEAP 971 #ifdef VERIFY_HEAP
972 return FLAG_verify_heap; 972 return FLAG_verify_heap;
973 #else 973 #else
974 return false; 974 return false;
975 #endif 975 #endif
976 #endif 976 #endif
977 } 977 }
978 978
979 // Number of "runtime allocations" done so far.
980 uint32_t allocations_count() { return allocations_count_; }
981
982 // Returns deterministic "time" value in ms. Works only with
983 // FLAG_verify_predictable.
984 double synthetic_time() { return allocations_count_ / 100.0; }
985
979 // Print short heap statistics. 986 // Print short heap statistics.
980 void PrintShortHeapStatistics(); 987 void PrintShortHeapStatistics();
981 988
982 // Write barrier support for address[offset] = o. 989 // Write barrier support for address[offset] = o.
983 INLINE(void RecordWrite(Address address, int offset)); 990 INLINE(void RecordWrite(Address address, int offset));
984 991
985 // Write barrier support for address[start : start + len[ = o. 992 // Write barrier support for address[start : start + len[ = o.
986 INLINE(void RecordWrites(Address address, int start, int len)); 993 INLINE(void RecordWrites(Address address, int start, int len));
987 994
988 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT }; 995 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT };
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 1436
1430 void InitializeWeakObjectToCodeTable() { 1437 void InitializeWeakObjectToCodeTable() {
1431 set_weak_object_to_code_table(undefined_value()); 1438 set_weak_object_to_code_table(undefined_value());
1432 } 1439 }
1433 1440
1434 void EnsureWeakObjectToCodeTable(); 1441 void EnsureWeakObjectToCodeTable();
1435 1442
1436 static void FatalProcessOutOfMemory(const char* location, 1443 static void FatalProcessOutOfMemory(const char* location,
1437 bool take_snapshot = false); 1444 bool take_snapshot = false);
1438 1445
1446 // This event is triggered after successful allocation of a new object made
1447 // by runtime. Allocations of target space for object evacuation do not
1448 // trigger the event. In order to track ALL allocations one must turn off
1449 // FLAG_inline_new and FLAG_use_allocation_folding.
1450 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes);
1451
1452 // This event is triggered after object is moved to a new place.
1453 inline void OnMoveEvent(HeapObject* target,
1454 HeapObject* source,
1455 int size_in_bytes);
1456
1439 protected: 1457 protected:
1440 // Methods made available to tests. 1458 // Methods made available to tests.
1441 1459
1442 // Allocates a JS Map in the heap. 1460 // Allocates a JS Map in the heap.
1443 MUST_USE_RESULT AllocationResult AllocateMap( 1461 MUST_USE_RESULT AllocationResult AllocateMap(
1444 InstanceType instance_type, 1462 InstanceType instance_type,
1445 int instance_size, 1463 int instance_size,
1446 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); 1464 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND);
1447 1465
1448 // Allocates and initializes a new JavaScript object based on a 1466 // Allocates and initializes a new JavaScript object based on a
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 CellSpace* cell_space_; 1562 CellSpace* cell_space_;
1545 PropertyCellSpace* property_cell_space_; 1563 PropertyCellSpace* property_cell_space_;
1546 LargeObjectSpace* lo_space_; 1564 LargeObjectSpace* lo_space_;
1547 HeapState gc_state_; 1565 HeapState gc_state_;
1548 int gc_post_processing_depth_; 1566 int gc_post_processing_depth_;
1549 Address new_space_top_after_last_gc_; 1567 Address new_space_top_after_last_gc_;
1550 1568
1551 // Returns the amount of external memory registered since last global gc. 1569 // Returns the amount of external memory registered since last global gc.
1552 int64_t PromotedExternalMemorySize(); 1570 int64_t PromotedExternalMemorySize();
1553 1571
1554 unsigned int ms_count_; // how many mark-sweep collections happened 1572 // How many "runtime allocations" happened.
1555 unsigned int gc_count_; // how many gc happened 1573 uint32_t allocations_count_;
1574
1575 // Running hash over allocations performed.
1576 uint32_t raw_allocations_hash_;
1577
1578 // Countdown counter, dumps allocation hash when 0.
1579 uint32_t dump_allocations_hash_countdown_;
1580
1581 // How many mark-sweep collections happened.
1582 unsigned int ms_count_;
1583
1584 // How many gc happened.
1585 unsigned int gc_count_;
1556 1586
1557 // For post mortem debugging. 1587 // For post mortem debugging.
1558 static const int kRememberedUnmappedPages = 128; 1588 static const int kRememberedUnmappedPages = 128;
1559 int remembered_unmapped_pages_index_; 1589 int remembered_unmapped_pages_index_;
1560 Address remembered_unmapped_pages_[kRememberedUnmappedPages]; 1590 Address remembered_unmapped_pages_[kRememberedUnmappedPages];
1561 1591
1562 // Total length of the strings we failed to flatten since the last GC. 1592 // Total length of the strings we failed to flatten since the last GC.
1563 int unflattened_strings_length_; 1593 int unflattened_strings_length_;
1564 1594
1565 #define ROOT_ACCESSOR(type, name, camel_name) \ 1595 #define ROOT_ACCESSOR(type, name, camel_name) \
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 2109
2080 void set_weak_object_to_code_table(Object* value) { 2110 void set_weak_object_to_code_table(Object* value) {
2081 ASSERT(!InNewSpace(value)); 2111 ASSERT(!InNewSpace(value));
2082 weak_object_to_code_table_ = value; 2112 weak_object_to_code_table_ = value;
2083 } 2113 }
2084 2114
2085 Object** weak_object_to_code_table_address() { 2115 Object** weak_object_to_code_table_address() {
2086 return &weak_object_to_code_table_; 2116 return &weak_object_to_code_table_;
2087 } 2117 }
2088 2118
2119 inline void UpdateAllocationsHash(HeapObject* object);
2120 inline void UpdateAllocationsHash(uint32_t value);
2121 inline void PrintAlloctionsHash();
2122
2089 static const int kInitialStringTableSize = 2048; 2123 static const int kInitialStringTableSize = 2048;
2090 static const int kInitialEvalCacheSize = 64; 2124 static const int kInitialEvalCacheSize = 64;
2091 static const int kInitialNumberStringCacheSize = 256; 2125 static const int kInitialNumberStringCacheSize = 256;
2092 2126
2093 // Object counts and used memory by InstanceType 2127 // Object counts and used memory by InstanceType
2094 size_t object_counts_[OBJECT_STATS_COUNT]; 2128 size_t object_counts_[OBJECT_STATS_COUNT];
2095 size_t object_counts_last_time_[OBJECT_STATS_COUNT]; 2129 size_t object_counts_last_time_[OBJECT_STATS_COUNT];
2096 size_t object_sizes_[OBJECT_STATS_COUNT]; 2130 size_t object_sizes_[OBJECT_STATS_COUNT];
2097 size_t object_sizes_last_time_[OBJECT_STATS_COUNT]; 2131 size_t object_sizes_last_time_[OBJECT_STATS_COUNT];
2098 2132
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
2780 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2814 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2781 2815
2782 private: 2816 private:
2783 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2817 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2784 }; 2818 };
2785 #endif // DEBUG 2819 #endif // DEBUG
2786 2820
2787 } } // namespace v8::internal 2821 } } // namespace v8::internal
2788 2822
2789 #endif // V8_HEAP_H_ 2823 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap.cc » ('j') | src/heap-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698