OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 V(Smi, store_buffer_top, StoreBufferTop) \ | 61 V(Smi, store_buffer_top, StoreBufferTop) \ |
62 V(Oddball, undefined_value, UndefinedValue) \ | 62 V(Oddball, undefined_value, UndefinedValue) \ |
63 V(Oddball, the_hole_value, TheHoleValue) \ | 63 V(Oddball, the_hole_value, TheHoleValue) \ |
64 V(Oddball, null_value, NullValue) \ | 64 V(Oddball, null_value, NullValue) \ |
65 V(Oddball, true_value, TrueValue) \ | 65 V(Oddball, true_value, TrueValue) \ |
66 V(Oddball, false_value, FalseValue) \ | 66 V(Oddball, false_value, FalseValue) \ |
67 V(Map, global_property_cell_map, GlobalPropertyCellMap) \ | 67 V(Map, global_property_cell_map, GlobalPropertyCellMap) \ |
68 V(Map, shared_function_info_map, SharedFunctionInfoMap) \ | 68 V(Map, shared_function_info_map, SharedFunctionInfoMap) \ |
69 V(Map, meta_map, MetaMap) \ | 69 V(Map, meta_map, MetaMap) \ |
70 V(Map, ascii_symbol_map, AsciiSymbolMap) \ | 70 V(Map, ascii_symbol_map, AsciiSymbolMap) \ |
71 V(Map, ascii_string_map, AsciiStringMap) \ | |
71 V(Map, heap_number_map, HeapNumberMap) \ | 72 V(Map, heap_number_map, HeapNumberMap) \ |
72 V(Map, global_context_map, GlobalContextMap) \ | 73 V(Map, global_context_map, GlobalContextMap) \ |
73 V(Map, fixed_array_map, FixedArrayMap) \ | 74 V(Map, fixed_array_map, FixedArrayMap) \ |
74 V(Map, code_map, CodeMap) \ | 75 V(Map, code_map, CodeMap) \ |
75 V(Map, serialized_scope_info_map, SerializedScopeInfoMap) \ | 76 V(Map, serialized_scope_info_map, SerializedScopeInfoMap) \ |
76 V(Map, fixed_cow_array_map, FixedCOWArrayMap) \ | 77 V(Map, fixed_cow_array_map, FixedCOWArrayMap) \ |
77 V(Map, fixed_double_array_map, FixedDoubleArrayMap) \ | 78 V(Map, fixed_double_array_map, FixedDoubleArrayMap) \ |
78 V(Object, no_interceptor_result_sentinel, NoInterceptorResultSentinel) \ | 79 V(Object, no_interceptor_result_sentinel, NoInterceptorResultSentinel) \ |
79 V(Map, hash_table_map, HashTableMap) \ | 80 V(Map, hash_table_map, HashTableMap) \ |
80 V(FixedArray, empty_fixed_array, EmptyFixedArray) \ | 81 V(FixedArray, empty_fixed_array, EmptyFixedArray) \ |
81 V(ByteArray, empty_byte_array, EmptyByteArray) \ | 82 V(ByteArray, empty_byte_array, EmptyByteArray) \ |
82 V(FixedDoubleArray, empty_fixed_double_array, EmptyFixedDoubleArray) \ | 83 V(FixedDoubleArray, empty_fixed_double_array, EmptyFixedDoubleArray) \ |
83 V(String, empty_string, EmptyString) \ | 84 V(String, empty_string, EmptyString) \ |
84 V(DescriptorArray, empty_descriptor_array, EmptyDescriptorArray) \ | 85 V(DescriptorArray, empty_descriptor_array, EmptyDescriptorArray) \ |
85 V(Smi, stack_limit, StackLimit) \ | 86 V(Smi, stack_limit, StackLimit) \ |
86 V(Oddball, frame_alignment_marker, FrameAlignmentMarker) \ | 87 V(Oddball, frame_alignment_marker, FrameAlignmentMarker) \ |
87 V(Oddball, arguments_marker, ArgumentsMarker) \ | 88 V(Oddball, arguments_marker, ArgumentsMarker) \ |
89 /* The first 32 roots above this line should be boring from a GC point of */ \ | |
90 /* view. This means they are never in new space and never on a page that */ \ | |
91 /* is being compacted. */ \ | |
88 V(FixedArray, number_string_cache, NumberStringCache) \ | 92 V(FixedArray, number_string_cache, NumberStringCache) \ |
89 V(Object, instanceof_cache_function, InstanceofCacheFunction) \ | 93 V(Object, instanceof_cache_function, InstanceofCacheFunction) \ |
90 V(Object, instanceof_cache_map, InstanceofCacheMap) \ | 94 V(Object, instanceof_cache_map, InstanceofCacheMap) \ |
91 V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \ | 95 V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \ |
92 V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \ | 96 V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \ |
93 V(FixedArray, string_split_cache, StringSplitCache) \ | 97 V(FixedArray, string_split_cache, StringSplitCache) \ |
94 V(Object, termination_exception, TerminationException) \ | 98 V(Object, termination_exception, TerminationException) \ |
95 V(Map, string_map, StringMap) \ | 99 V(Map, string_map, StringMap) \ |
96 V(Map, ascii_string_map, AsciiStringMap) \ | |
97 V(Map, symbol_map, SymbolMap) \ | 100 V(Map, symbol_map, SymbolMap) \ |
98 V(Map, cons_string_map, ConsStringMap) \ | 101 V(Map, cons_string_map, ConsStringMap) \ |
99 V(Map, cons_ascii_string_map, ConsAsciiStringMap) \ | 102 V(Map, cons_ascii_string_map, ConsAsciiStringMap) \ |
100 V(Map, sliced_string_map, SlicedStringMap) \ | 103 V(Map, sliced_string_map, SlicedStringMap) \ |
101 V(Map, sliced_ascii_string_map, SlicedAsciiStringMap) \ | 104 V(Map, sliced_ascii_string_map, SlicedAsciiStringMap) \ |
102 V(Map, cons_symbol_map, ConsSymbolMap) \ | 105 V(Map, cons_symbol_map, ConsSymbolMap) \ |
103 V(Map, cons_ascii_symbol_map, ConsAsciiSymbolMap) \ | 106 V(Map, cons_ascii_symbol_map, ConsAsciiSymbolMap) \ |
104 V(Map, external_symbol_map, ExternalSymbolMap) \ | 107 V(Map, external_symbol_map, ExternalSymbolMap) \ |
105 V(Map, external_symbol_with_ascii_data_map, ExternalSymbolWithAsciiDataMap) \ | 108 V(Map, external_symbol_with_ascii_data_map, ExternalSymbolWithAsciiDataMap) \ |
106 V(Map, external_ascii_symbol_map, ExternalAsciiSymbolMap) \ | 109 V(Map, external_ascii_symbol_map, ExternalAsciiSymbolMap) \ |
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1412 scavenging_visitors_table_.GetVisitor(map)(map, slot, obj); | 1415 scavenging_visitors_table_.GetVisitor(map)(map, slot, obj); |
1413 } | 1416 } |
1414 | 1417 |
1415 void QueueMemoryChunkForFree(MemoryChunk* chunk); | 1418 void QueueMemoryChunkForFree(MemoryChunk* chunk); |
1416 void FreeQueuedChunks(); | 1419 void FreeQueuedChunks(); |
1417 | 1420 |
1418 // Completely clear the Instanceof cache (to stop it keeping objects alive | 1421 // Completely clear the Instanceof cache (to stop it keeping objects alive |
1419 // around a GC). | 1422 // around a GC). |
1420 inline void CompletelyClearInstanceofCache(); | 1423 inline void CompletelyClearInstanceofCache(); |
1421 | 1424 |
1425 // The roots that have an index less than this are always in old space. | |
1426 static const int kOldSpaceRoots = 0x20; | |
1427 | |
1422 private: | 1428 private: |
1423 Heap(); | 1429 Heap(); |
1424 | 1430 |
1425 // This can be calculated directly from a pointer to the heap; however, it is | 1431 // This can be calculated directly from a pointer to the heap; however, it is |
1426 // more expedient to get at the isolate directly from within Heap methods. | 1432 // more expedient to get at the isolate directly from within Heap methods. |
1427 Isolate* isolate_; | 1433 Isolate* isolate_; |
1428 | 1434 |
1429 intptr_t code_range_size_; | 1435 intptr_t code_range_size_; |
1430 int reserved_semispace_size_; | 1436 int reserved_semispace_size_; |
1431 int max_semispace_size_; | 1437 int max_semispace_size_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1468 int PromotedExternalMemorySize(); | 1474 int PromotedExternalMemorySize(); |
1469 | 1475 |
1470 int ms_count_; // how many mark-sweep collections happened | 1476 int ms_count_; // how many mark-sweep collections happened |
1471 unsigned int gc_count_; // how many gc happened | 1477 unsigned int gc_count_; // how many gc happened |
1472 | 1478 |
1473 // Total length of the strings we failed to flatten since the last GC. | 1479 // Total length of the strings we failed to flatten since the last GC. |
1474 int unflattened_strings_length_; | 1480 int unflattened_strings_length_; |
1475 | 1481 |
1476 #define ROOT_ACCESSOR(type, name, camel_name) \ | 1482 #define ROOT_ACCESSOR(type, name, camel_name) \ |
1477 inline void set_##name(type* value) { \ | 1483 inline void set_##name(type* value) { \ |
1484 /* The deserializer makes use of the fact that these common roots are */ \ | |
1485 /* never in new space and never on a page that is being compacted. */ \ | |
1486 ASSERT(k##camel_name##RootIndex >= kOldSpaceRoots || \ | |
1487 !HEAP->InNewSpace(value)); \ | |
Vyacheslav Egorov (Chromium)
2011/10/21 13:39:42
accessing heap from the heap with a HEAP accessor.
| |
1478 roots_[k##camel_name##RootIndex] = value; \ | 1488 roots_[k##camel_name##RootIndex] = value; \ |
1479 } | 1489 } |
1480 ROOT_LIST(ROOT_ACCESSOR) | 1490 ROOT_LIST(ROOT_ACCESSOR) |
1481 #undef ROOT_ACCESSOR | 1491 #undef ROOT_ACCESSOR |
1482 | 1492 |
1483 #ifdef DEBUG | 1493 #ifdef DEBUG |
1484 bool allocation_allowed_; | 1494 bool allocation_allowed_; |
1485 | 1495 |
1486 // If the --gc-interval flag is set to a positive value, this | 1496 // If the --gc-interval flag is set to a positive value, this |
1487 // variable holds the value indicating the number of allocations | 1497 // variable holds the value indicating the number of allocations |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2467 | 2477 |
2468 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2478 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2469 }; | 2479 }; |
2470 #endif // DEBUG || LIVE_OBJECT_LIST | 2480 #endif // DEBUG || LIVE_OBJECT_LIST |
2471 | 2481 |
2472 } } // namespace v8::internal | 2482 } } // namespace v8::internal |
2473 | 2483 |
2474 #undef HEAP | 2484 #undef HEAP |
2475 | 2485 |
2476 #endif // V8_HEAP_H_ | 2486 #endif // V8_HEAP_H_ |
OLD | NEW |