OLD | NEW |
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_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 bool CreateHeapObjects(); | 536 bool CreateHeapObjects(); |
537 | 537 |
538 // Destroys all memory allocated by the heap. | 538 // Destroys all memory allocated by the heap. |
539 void TearDown(); | 539 void TearDown(); |
540 | 540 |
541 // Set the stack limit in the roots_ array. Some architectures generate | 541 // Set the stack limit in the roots_ array. Some architectures generate |
542 // code that looks here, because it is faster than loading from the static | 542 // code that looks here, because it is faster than loading from the static |
543 // jslimit_/real_jslimit_ variable in the StackGuard. | 543 // jslimit_/real_jslimit_ variable in the StackGuard. |
544 void SetStackLimits(); | 544 void SetStackLimits(); |
545 | 545 |
| 546 // Notifies the heap that is ok to start marking or other activities that |
| 547 // should not happen during deserialization. |
| 548 void NotifyDeserializationComplete(); |
| 549 |
546 // Returns whether SetUp has been called. | 550 // Returns whether SetUp has been called. |
547 bool HasBeenSetUp(); | 551 bool HasBeenSetUp(); |
548 | 552 |
549 // Returns the maximum amount of memory reserved for the heap. For | 553 // Returns the maximum amount of memory reserved for the heap. For |
550 // the young generation, we reserve 4 times the amount needed for a | 554 // the young generation, we reserve 4 times the amount needed for a |
551 // semi space. The young generation consists of two semi spaces and | 555 // semi space. The young generation consists of two semi spaces and |
552 // we reserve twice the amount needed for those in order to ensure | 556 // we reserve twice the amount needed for those in order to ensure |
553 // that new space can be aligned to its size. | 557 // that new space can be aligned to its size. |
554 intptr_t MaxReserved() { | 558 intptr_t MaxReserved() { |
555 return 4 * reserved_semispace_size_ + max_old_generation_size_; | 559 return 4 * reserved_semispace_size_ + max_old_generation_size_; |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1371 // This event is triggered after successful allocation of a new object made | 1375 // This event is triggered after successful allocation of a new object made |
1372 // by runtime. Allocations of target space for object evacuation do not | 1376 // by runtime. Allocations of target space for object evacuation do not |
1373 // trigger the event. In order to track ALL allocations one must turn off | 1377 // trigger the event. In order to track ALL allocations one must turn off |
1374 // FLAG_inline_new and FLAG_use_allocation_folding. | 1378 // FLAG_inline_new and FLAG_use_allocation_folding. |
1375 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); | 1379 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); |
1376 | 1380 |
1377 // This event is triggered after object is moved to a new place. | 1381 // This event is triggered after object is moved to a new place. |
1378 inline void OnMoveEvent(HeapObject* target, HeapObject* source, | 1382 inline void OnMoveEvent(HeapObject* target, HeapObject* source, |
1379 int size_in_bytes); | 1383 int size_in_bytes); |
1380 | 1384 |
| 1385 bool deserialization_complete() const { return deserialization_complete_; } |
| 1386 |
1381 protected: | 1387 protected: |
1382 // Methods made available to tests. | 1388 // Methods made available to tests. |
1383 | 1389 |
1384 // Allocates a JS Map in the heap. | 1390 // Allocates a JS Map in the heap. |
1385 MUST_USE_RESULT AllocationResult | 1391 MUST_USE_RESULT AllocationResult |
1386 AllocateMap(InstanceType instance_type, int instance_size, | 1392 AllocateMap(InstanceType instance_type, int instance_size, |
1387 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); | 1393 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); |
1388 | 1394 |
1389 // Allocates and initializes a new JavaScript object based on a | 1395 // Allocates and initializes a new JavaScript object based on a |
1390 // constructor. | 1396 // constructor. |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2027 ExternalStringTable external_string_table_; | 2033 ExternalStringTable external_string_table_; |
2028 | 2034 |
2029 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; | 2035 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
2030 | 2036 |
2031 MemoryChunk* chunks_queued_for_free_; | 2037 MemoryChunk* chunks_queued_for_free_; |
2032 | 2038 |
2033 base::Mutex relocation_mutex_; | 2039 base::Mutex relocation_mutex_; |
2034 | 2040 |
2035 int gc_callbacks_depth_; | 2041 int gc_callbacks_depth_; |
2036 | 2042 |
| 2043 bool deserialization_complete_; |
| 2044 |
2037 friend class AlwaysAllocateScope; | 2045 friend class AlwaysAllocateScope; |
2038 friend class Deserializer; | 2046 friend class Deserializer; |
2039 friend class Factory; | 2047 friend class Factory; |
2040 friend class GCCallbacksScope; | 2048 friend class GCCallbacksScope; |
2041 friend class GCTracer; | 2049 friend class GCTracer; |
2042 friend class HeapIterator; | 2050 friend class HeapIterator; |
2043 friend class Isolate; | 2051 friend class Isolate; |
2044 friend class MarkCompactCollector; | 2052 friend class MarkCompactCollector; |
2045 friend class MarkCompactMarkingVisitor; | 2053 friend class MarkCompactMarkingVisitor; |
2046 friend class MapCompact; | 2054 friend class MapCompact; |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2507 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2515 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2508 | 2516 |
2509 private: | 2517 private: |
2510 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2518 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2511 }; | 2519 }; |
2512 #endif // DEBUG | 2520 #endif // DEBUG |
2513 } | 2521 } |
2514 } // namespace v8::internal | 2522 } // namespace v8::internal |
2515 | 2523 |
2516 #endif // V8_HEAP_HEAP_H_ | 2524 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |