| 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 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 // Iterate pointers to from semispace of new space found in memory interval | 1047 // Iterate pointers to from semispace of new space found in memory interval |
| 1045 // from start to end. | 1048 // from start to end. |
| 1046 void IterateAndMarkPointersToFromSpace(Address start, | 1049 void IterateAndMarkPointersToFromSpace(Address start, |
| 1047 Address end, | 1050 Address end, |
| 1048 ObjectSlotCallback callback); | 1051 ObjectSlotCallback callback); |
| 1049 | 1052 |
| 1050 // Returns whether the object resides in new space. | 1053 // Returns whether the object resides in new space. |
| 1051 inline bool InNewSpace(Object* object); | 1054 inline bool InNewSpace(Object* object); |
| 1052 inline bool InNewSpace(Address addr); | 1055 inline bool InNewSpace(Address addr); |
| 1053 inline bool InNewSpacePage(Address addr); | 1056 inline bool InNewSpacePage(Address addr); |
| 1057 inline bool InMovingPage(Object* object); |
| 1054 inline bool InFromSpace(Object* object); | 1058 inline bool InFromSpace(Object* object); |
| 1055 inline bool InToSpace(Object* object); | 1059 inline bool InToSpace(Object* object); |
| 1056 | 1060 |
| 1057 // Checks whether an address/object in the heap (including auxiliary | 1061 // Checks whether an address/object in the heap (including auxiliary |
| 1058 // area and unused area). | 1062 // area and unused area). |
| 1059 bool Contains(Address addr); | 1063 bool Contains(Address addr); |
| 1060 bool Contains(HeapObject* value); | 1064 bool Contains(HeapObject* value); |
| 1061 | 1065 |
| 1062 // Checks whether an address/object in a space. | 1066 // Checks whether an address/object in a space. |
| 1063 // Currently used by tests, serialization and heap verification only. | 1067 // Currently used by tests, serialization and heap verification only. |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 scavenging_visitors_table_.GetVisitor(map)(map, slot, obj); | 1416 scavenging_visitors_table_.GetVisitor(map)(map, slot, obj); |
| 1413 } | 1417 } |
| 1414 | 1418 |
| 1415 void QueueMemoryChunkForFree(MemoryChunk* chunk); | 1419 void QueueMemoryChunkForFree(MemoryChunk* chunk); |
| 1416 void FreeQueuedChunks(); | 1420 void FreeQueuedChunks(); |
| 1417 | 1421 |
| 1418 // Completely clear the Instanceof cache (to stop it keeping objects alive | 1422 // Completely clear the Instanceof cache (to stop it keeping objects alive |
| 1419 // around a GC). | 1423 // around a GC). |
| 1420 inline void CompletelyClearInstanceofCache(); | 1424 inline void CompletelyClearInstanceofCache(); |
| 1421 | 1425 |
| 1426 // The roots that have an index less than this are always in old space. |
| 1427 static const int kOldSpaceRoots = 0x20; |
| 1428 |
| 1422 private: | 1429 private: |
| 1423 Heap(); | 1430 Heap(); |
| 1424 | 1431 |
| 1425 // This can be calculated directly from a pointer to the heap; however, it is | 1432 // 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. | 1433 // more expedient to get at the isolate directly from within Heap methods. |
| 1427 Isolate* isolate_; | 1434 Isolate* isolate_; |
| 1428 | 1435 |
| 1429 intptr_t code_range_size_; | 1436 intptr_t code_range_size_; |
| 1430 int reserved_semispace_size_; | 1437 int reserved_semispace_size_; |
| 1431 int max_semispace_size_; | 1438 int max_semispace_size_; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 int PromotedExternalMemorySize(); | 1475 int PromotedExternalMemorySize(); |
| 1469 | 1476 |
| 1470 int ms_count_; // how many mark-sweep collections happened | 1477 int ms_count_; // how many mark-sweep collections happened |
| 1471 unsigned int gc_count_; // how many gc happened | 1478 unsigned int gc_count_; // how many gc happened |
| 1472 | 1479 |
| 1473 // Total length of the strings we failed to flatten since the last GC. | 1480 // Total length of the strings we failed to flatten since the last GC. |
| 1474 int unflattened_strings_length_; | 1481 int unflattened_strings_length_; |
| 1475 | 1482 |
| 1476 #define ROOT_ACCESSOR(type, name, camel_name) \ | 1483 #define ROOT_ACCESSOR(type, name, camel_name) \ |
| 1477 inline void set_##name(type* value) { \ | 1484 inline void set_##name(type* value) { \ |
| 1485 /* The deserializer makes use of the fact that these common roots are */ \ |
| 1486 /* never in new space and never on a page that is being compacted. */ \ |
| 1487 ASSERT(k##camel_name##RootIndex >= kOldSpaceRoots || \ |
| 1488 !HEAP->InMovingPage(value)); \ |
| 1478 roots_[k##camel_name##RootIndex] = value; \ | 1489 roots_[k##camel_name##RootIndex] = value; \ |
| 1479 } | 1490 } |
| 1480 ROOT_LIST(ROOT_ACCESSOR) | 1491 ROOT_LIST(ROOT_ACCESSOR) |
| 1481 #undef ROOT_ACCESSOR | 1492 #undef ROOT_ACCESSOR |
| 1482 | 1493 |
| 1483 #ifdef DEBUG | 1494 #ifdef DEBUG |
| 1484 bool allocation_allowed_; | 1495 bool allocation_allowed_; |
| 1485 | 1496 |
| 1486 // If the --gc-interval flag is set to a positive value, this | 1497 // If the --gc-interval flag is set to a positive value, this |
| 1487 // variable holds the value indicating the number of allocations | 1498 // variable holds the value indicating the number of allocations |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2467 | 2478 |
| 2468 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2479 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2469 }; | 2480 }; |
| 2470 #endif // DEBUG || LIVE_OBJECT_LIST | 2481 #endif // DEBUG || LIVE_OBJECT_LIST |
| 2471 | 2482 |
| 2472 } } // namespace v8::internal | 2483 } } // namespace v8::internal |
| 2473 | 2484 |
| 2474 #undef HEAP | 2485 #undef HEAP |
| 2475 | 2486 |
| 2476 #endif // V8_HEAP_H_ | 2487 #endif // V8_HEAP_H_ |
| OLD | NEW |