| OLD | NEW |
| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 V(Map, scope_info_map, ScopeInfoMap) \ | 71 V(Map, scope_info_map, ScopeInfoMap) \ |
| 72 V(Map, fixed_cow_array_map, FixedCOWArrayMap) \ | 72 V(Map, fixed_cow_array_map, FixedCOWArrayMap) \ |
| 73 V(Map, fixed_double_array_map, FixedDoubleArrayMap) \ | 73 V(Map, fixed_double_array_map, FixedDoubleArrayMap) \ |
| 74 V(Map, constant_pool_array_map, ConstantPoolArrayMap) \ | 74 V(Map, constant_pool_array_map, ConstantPoolArrayMap) \ |
| 75 V(Object, no_interceptor_result_sentinel, NoInterceptorResultSentinel) \ | 75 V(Object, no_interceptor_result_sentinel, NoInterceptorResultSentinel) \ |
| 76 V(Map, hash_table_map, HashTableMap) \ | 76 V(Map, hash_table_map, HashTableMap) \ |
| 77 V(FixedArray, empty_fixed_array, EmptyFixedArray) \ | 77 V(FixedArray, empty_fixed_array, EmptyFixedArray) \ |
| 78 V(ByteArray, empty_byte_array, EmptyByteArray) \ | 78 V(ByteArray, empty_byte_array, EmptyByteArray) \ |
| 79 V(DescriptorArray, empty_descriptor_array, EmptyDescriptorArray) \ | 79 V(DescriptorArray, empty_descriptor_array, EmptyDescriptorArray) \ |
| 80 V(ConstantPoolArray, empty_constant_pool_array, EmptyConstantPoolArray) \ | 80 V(ConstantPoolArray, empty_constant_pool_array, EmptyConstantPoolArray) \ |
| 81 V(Smi, stack_limit, StackLimit) \ | |
| 82 V(Oddball, arguments_marker, ArgumentsMarker) \ | 81 V(Oddball, arguments_marker, ArgumentsMarker) \ |
| 83 /* The roots above this line should be boring from a GC point of view. */ \ | 82 /* The roots above this line should be boring from a GC point of view. */ \ |
| 84 /* This means they are never in new space and never on a page that is */ \ | 83 /* This means they are never in new space and never on a page that is */ \ |
| 85 /* being compacted. */ \ | 84 /* being compacted. */ \ |
| 86 V(FixedArray, number_string_cache, NumberStringCache) \ | 85 V(FixedArray, number_string_cache, NumberStringCache) \ |
| 87 V(Object, instanceof_cache_function, InstanceofCacheFunction) \ | 86 V(Object, instanceof_cache_function, InstanceofCacheFunction) \ |
| 88 V(Object, instanceof_cache_map, InstanceofCacheMap) \ | 87 V(Object, instanceof_cache_map, InstanceofCacheMap) \ |
| 89 V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \ | 88 V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \ |
| 90 V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \ | 89 V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \ |
| 91 V(FixedArray, string_split_cache, StringSplitCache) \ | 90 V(FixedArray, string_split_cache, StringSplitCache) \ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 ShortExternalInternalizedStringMap) \ | 125 ShortExternalInternalizedStringMap) \ |
| 127 V(Map, \ | 126 V(Map, \ |
| 128 short_external_internalized_string_with_one_byte_data_map, \ | 127 short_external_internalized_string_with_one_byte_data_map, \ |
| 129 ShortExternalInternalizedStringWithOneByteDataMap) \ | 128 ShortExternalInternalizedStringWithOneByteDataMap) \ |
| 130 V(Map, \ | 129 V(Map, \ |
| 131 short_external_ascii_internalized_string_map, \ | 130 short_external_ascii_internalized_string_map, \ |
| 132 ShortExternalAsciiInternalizedStringMap) \ | 131 ShortExternalAsciiInternalizedStringMap) \ |
| 133 V(Map, short_external_ascii_string_map, ShortExternalAsciiStringMap) \ | 132 V(Map, short_external_ascii_string_map, ShortExternalAsciiStringMap) \ |
| 134 V(Map, undetectable_string_map, UndetectableStringMap) \ | 133 V(Map, undetectable_string_map, UndetectableStringMap) \ |
| 135 V(Map, undetectable_ascii_string_map, UndetectableAsciiStringMap) \ | 134 V(Map, undetectable_ascii_string_map, UndetectableAsciiStringMap) \ |
| 136 V(Map, external_byte_array_map, ExternalByteArrayMap) \ | 135 V(Map, external_int8_array_map, ExternalInt8ArrayMap) \ |
| 137 V(Map, external_unsigned_byte_array_map, ExternalUnsignedByteArrayMap) \ | 136 V(Map, external_uint8_array_map, ExternalUint8ArrayMap) \ |
| 138 V(Map, external_short_array_map, ExternalShortArrayMap) \ | 137 V(Map, external_int16_array_map, ExternalInt16ArrayMap) \ |
| 139 V(Map, external_unsigned_short_array_map, ExternalUnsignedShortArrayMap) \ | 138 V(Map, external_uint16_array_map, ExternalUint16ArrayMap) \ |
| 140 V(Map, external_int_array_map, ExternalIntArrayMap) \ | 139 V(Map, external_int32_array_map, ExternalInt32ArrayMap) \ |
| 141 V(Map, external_unsigned_int_array_map, ExternalUnsignedIntArrayMap) \ | 140 V(Map, external_uint32_array_map, ExternalUint32ArrayMap) \ |
| 142 V(Map, external_float_array_map, ExternalFloatArrayMap) \ | 141 V(Map, external_float32_array_map, ExternalFloat32ArrayMap) \ |
| 143 V(Map, external_double_array_map, ExternalDoubleArrayMap) \ | 142 V(Map, external_float64_array_map, ExternalFloat64ArrayMap) \ |
| 144 V(Map, external_pixel_array_map, ExternalPixelArrayMap) \ | 143 V(Map, external_uint8_clamped_array_map, ExternalUint8ClampedArrayMap) \ |
| 145 V(ExternalArray, empty_external_byte_array, \ | 144 V(ExternalArray, empty_external_int8_array, \ |
| 146 EmptyExternalByteArray) \ | 145 EmptyExternalInt8Array) \ |
| 147 V(ExternalArray, empty_external_unsigned_byte_array, \ | 146 V(ExternalArray, empty_external_uint8_array, \ |
| 148 EmptyExternalUnsignedByteArray) \ | 147 EmptyExternalUint8Array) \ |
| 149 V(ExternalArray, empty_external_short_array, EmptyExternalShortArray) \ | 148 V(ExternalArray, empty_external_int16_array, EmptyExternalInt16Array) \ |
| 150 V(ExternalArray, empty_external_unsigned_short_array, \ | 149 V(ExternalArray, empty_external_uint16_array, \ |
| 151 EmptyExternalUnsignedShortArray) \ | 150 EmptyExternalUint16Array) \ |
| 152 V(ExternalArray, empty_external_int_array, EmptyExternalIntArray) \ | 151 V(ExternalArray, empty_external_int32_array, EmptyExternalInt32Array) \ |
| 153 V(ExternalArray, empty_external_unsigned_int_array, \ | 152 V(ExternalArray, empty_external_uint32_array, \ |
| 154 EmptyExternalUnsignedIntArray) \ | 153 EmptyExternalUint32Array) \ |
| 155 V(ExternalArray, empty_external_float_array, EmptyExternalFloatArray) \ | 154 V(ExternalArray, empty_external_float32_array, EmptyExternalFloat32Array) \ |
| 156 V(ExternalArray, empty_external_double_array, EmptyExternalDoubleArray) \ | 155 V(ExternalArray, empty_external_float64_array, EmptyExternalFloat64Array) \ |
| 157 V(ExternalArray, empty_external_pixel_array, \ | 156 V(ExternalArray, empty_external_uint8_clamped_array, \ |
| 158 EmptyExternalPixelArray) \ | 157 EmptyExternalUint8ClampedArray) \ |
| 159 V(Map, fixed_uint8_array_map, FixedUint8ArrayMap) \ | 158 V(Map, fixed_uint8_array_map, FixedUint8ArrayMap) \ |
| 160 V(Map, fixed_int8_array_map, FixedInt8ArrayMap) \ | 159 V(Map, fixed_int8_array_map, FixedInt8ArrayMap) \ |
| 161 V(Map, fixed_uint16_array_map, FixedUint16ArrayMap) \ | 160 V(Map, fixed_uint16_array_map, FixedUint16ArrayMap) \ |
| 162 V(Map, fixed_int16_array_map, FixedInt16ArrayMap) \ | 161 V(Map, fixed_int16_array_map, FixedInt16ArrayMap) \ |
| 163 V(Map, fixed_uint32_array_map, FixedUint32ArrayMap) \ | 162 V(Map, fixed_uint32_array_map, FixedUint32ArrayMap) \ |
| 164 V(Map, fixed_int32_array_map, FixedInt32ArrayMap) \ | 163 V(Map, fixed_int32_array_map, FixedInt32ArrayMap) \ |
| 165 V(Map, fixed_float32_array_map, FixedFloat32ArrayMap) \ | 164 V(Map, fixed_float32_array_map, FixedFloat32ArrayMap) \ |
| 166 V(Map, fixed_float64_array_map, FixedFloat64ArrayMap) \ | 165 V(Map, fixed_float64_array_map, FixedFloat64ArrayMap) \ |
| 167 V(Map, fixed_uint8_clamped_array_map, FixedUint8ClampedArrayMap) \ | 166 V(Map, fixed_uint8_clamped_array_map, FixedUint8ClampedArrayMap) \ |
| 168 V(Map, non_strict_arguments_elements_map, NonStrictArgumentsElementsMap) \ | 167 V(Map, non_strict_arguments_elements_map, NonStrictArgumentsElementsMap) \ |
| (...skipping 10 matching lines...) Expand all Loading... |
| 179 V(HeapNumber, infinity_value, InfinityValue) \ | 178 V(HeapNumber, infinity_value, InfinityValue) \ |
| 180 V(HeapNumber, minus_zero_value, MinusZeroValue) \ | 179 V(HeapNumber, minus_zero_value, MinusZeroValue) \ |
| 181 V(Map, neander_map, NeanderMap) \ | 180 V(Map, neander_map, NeanderMap) \ |
| 182 V(JSObject, message_listeners, MessageListeners) \ | 181 V(JSObject, message_listeners, MessageListeners) \ |
| 183 V(UnseededNumberDictionary, code_stubs, CodeStubs) \ | 182 V(UnseededNumberDictionary, code_stubs, CodeStubs) \ |
| 184 V(UnseededNumberDictionary, non_monomorphic_cache, NonMonomorphicCache) \ | 183 V(UnseededNumberDictionary, non_monomorphic_cache, NonMonomorphicCache) \ |
| 185 V(PolymorphicCodeCache, polymorphic_code_cache, PolymorphicCodeCache) \ | 184 V(PolymorphicCodeCache, polymorphic_code_cache, PolymorphicCodeCache) \ |
| 186 V(Code, js_entry_code, JsEntryCode) \ | 185 V(Code, js_entry_code, JsEntryCode) \ |
| 187 V(Code, js_construct_entry_code, JsConstructEntryCode) \ | 186 V(Code, js_construct_entry_code, JsConstructEntryCode) \ |
| 188 V(FixedArray, natives_source_cache, NativesSourceCache) \ | 187 V(FixedArray, natives_source_cache, NativesSourceCache) \ |
| 189 V(Smi, last_script_id, LastScriptId) \ | |
| 190 V(Script, empty_script, EmptyScript) \ | 188 V(Script, empty_script, EmptyScript) \ |
| 191 V(Smi, real_stack_limit, RealStackLimit) \ | |
| 192 V(NameDictionary, intrinsic_function_names, IntrinsicFunctionNames) \ | 189 V(NameDictionary, intrinsic_function_names, IntrinsicFunctionNames) \ |
| 193 V(Smi, arguments_adaptor_deopt_pc_offset, ArgumentsAdaptorDeoptPCOffset) \ | |
| 194 V(Smi, construct_stub_deopt_pc_offset, ConstructStubDeoptPCOffset) \ | |
| 195 V(Smi, getter_stub_deopt_pc_offset, GetterStubDeoptPCOffset) \ | |
| 196 V(Smi, setter_stub_deopt_pc_offset, SetterStubDeoptPCOffset) \ | |
| 197 V(Cell, undefined_cell, UndefineCell) \ | 190 V(Cell, undefined_cell, UndefineCell) \ |
| 198 V(JSObject, observation_state, ObservationState) \ | 191 V(JSObject, observation_state, ObservationState) \ |
| 199 V(Map, external_map, ExternalMap) \ | 192 V(Map, external_map, ExternalMap) \ |
| 200 V(Symbol, frozen_symbol, FrozenSymbol) \ | 193 V(Symbol, frozen_symbol, FrozenSymbol) \ |
| 201 V(Symbol, elements_transition_symbol, ElementsTransitionSymbol) \ | 194 V(Symbol, elements_transition_symbol, ElementsTransitionSymbol) \ |
| 202 V(SeededNumberDictionary, empty_slow_element_dictionary, \ | 195 V(SeededNumberDictionary, empty_slow_element_dictionary, \ |
| 203 EmptySlowElementDictionary) \ | 196 EmptySlowElementDictionary) \ |
| 204 V(Symbol, observed_symbol, ObservedSymbol) | 197 V(Symbol, observed_symbol, ObservedSymbol) \ |
| 198 V(FixedArray, materialized_objects, MaterializedObjects) \ |
| 199 V(FixedArray, allocation_sites_scratchpad, AllocationSitesScratchpad) \ |
| 200 V(JSObject, microtask_state, MicrotaskState) |
| 201 |
| 202 // Entries in this list are limited to Smis and are not visited during GC. |
| 203 #define SMI_ROOT_LIST(V) \ |
| 204 V(Smi, stack_limit, StackLimit) \ |
| 205 V(Smi, real_stack_limit, RealStackLimit) \ |
| 206 V(Smi, last_script_id, LastScriptId) \ |
| 207 V(Smi, arguments_adaptor_deopt_pc_offset, ArgumentsAdaptorDeoptPCOffset) \ |
| 208 V(Smi, construct_stub_deopt_pc_offset, ConstructStubDeoptPCOffset) \ |
| 209 V(Smi, getter_stub_deopt_pc_offset, GetterStubDeoptPCOffset) \ |
| 210 V(Smi, setter_stub_deopt_pc_offset, SetterStubDeoptPCOffset) |
| 205 | 211 |
| 206 #define ROOT_LIST(V) \ | 212 #define ROOT_LIST(V) \ |
| 207 STRONG_ROOT_LIST(V) \ | 213 STRONG_ROOT_LIST(V) \ |
| 214 SMI_ROOT_LIST(V) \ |
| 208 V(StringTable, string_table, StringTable) | 215 V(StringTable, string_table, StringTable) |
| 209 | 216 |
| 217 // Heap roots that are known to be immortal immovable, for which we can safely |
| 218 // skip write barriers. |
| 219 #define IMMORTAL_IMMOVABLE_ROOT_LIST(V) \ |
| 220 V(byte_array_map) \ |
| 221 V(free_space_map) \ |
| 222 V(one_pointer_filler_map) \ |
| 223 V(two_pointer_filler_map) \ |
| 224 V(undefined_value) \ |
| 225 V(the_hole_value) \ |
| 226 V(null_value) \ |
| 227 V(true_value) \ |
| 228 V(false_value) \ |
| 229 V(uninitialized_value) \ |
| 230 V(cell_map) \ |
| 231 V(global_property_cell_map) \ |
| 232 V(shared_function_info_map) \ |
| 233 V(meta_map) \ |
| 234 V(heap_number_map) \ |
| 235 V(native_context_map) \ |
| 236 V(fixed_array_map) \ |
| 237 V(code_map) \ |
| 238 V(scope_info_map) \ |
| 239 V(fixed_cow_array_map) \ |
| 240 V(fixed_double_array_map) \ |
| 241 V(constant_pool_array_map) \ |
| 242 V(no_interceptor_result_sentinel) \ |
| 243 V(hash_table_map) \ |
| 244 V(empty_fixed_array) \ |
| 245 V(empty_byte_array) \ |
| 246 V(empty_descriptor_array) \ |
| 247 V(empty_constant_pool_array) \ |
| 248 V(arguments_marker) \ |
| 249 V(symbol_map) \ |
| 250 V(non_strict_arguments_elements_map) \ |
| 251 V(function_context_map) \ |
| 252 V(catch_context_map) \ |
| 253 V(with_context_map) \ |
| 254 V(block_context_map) \ |
| 255 V(module_context_map) \ |
| 256 V(global_context_map) \ |
| 257 V(oddball_map) \ |
| 258 V(message_object_map) \ |
| 259 V(foreign_map) \ |
| 260 V(neander_map) |
| 261 |
| 210 #define INTERNALIZED_STRING_LIST(V) \ | 262 #define INTERNALIZED_STRING_LIST(V) \ |
| 211 V(Array_string, "Array") \ | 263 V(Array_string, "Array") \ |
| 212 V(Object_string, "Object") \ | 264 V(Object_string, "Object") \ |
| 213 V(proto_string, "__proto__") \ | 265 V(proto_string, "__proto__") \ |
| 214 V(arguments_string, "arguments") \ | 266 V(arguments_string, "arguments") \ |
| 215 V(Arguments_string, "Arguments") \ | 267 V(Arguments_string, "Arguments") \ |
| 216 V(call_string, "call") \ | 268 V(call_string, "call") \ |
| 217 V(apply_string, "apply") \ | 269 V(apply_string, "apply") \ |
| 218 V(caller_string, "caller") \ | 270 V(caller_string, "caller") \ |
| 219 V(boolean_string, "boolean") \ | 271 V(boolean_string, "boolean") \ |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 inline void Iterate(ObjectVisitor* v); | 507 inline void Iterate(ObjectVisitor* v); |
| 456 | 508 |
| 457 // Restores internal invariant and gets rid of collected strings. | 509 // Restores internal invariant and gets rid of collected strings. |
| 458 // Must be called after each Iterate() that modified the strings. | 510 // Must be called after each Iterate() that modified the strings. |
| 459 void CleanUp(); | 511 void CleanUp(); |
| 460 | 512 |
| 461 // Destroys all allocated memory. | 513 // Destroys all allocated memory. |
| 462 void TearDown(); | 514 void TearDown(); |
| 463 | 515 |
| 464 private: | 516 private: |
| 465 ExternalStringTable() { } | 517 explicit ExternalStringTable(Heap* heap) : heap_(heap) { } |
| 466 | 518 |
| 467 friend class Heap; | 519 friend class Heap; |
| 468 | 520 |
| 469 inline void Verify(); | 521 inline void Verify(); |
| 470 | 522 |
| 471 inline void AddOldString(String* string); | 523 inline void AddOldString(String* string); |
| 472 | 524 |
| 473 // Notifies the table that only a prefix of the new list is valid. | 525 // Notifies the table that only a prefix of the new list is valid. |
| 474 inline void ShrinkNewStrings(int position); | 526 inline void ShrinkNewStrings(int position); |
| 475 | 527 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 // we reserve twice the amount needed for those in order to ensure | 576 // we reserve twice the amount needed for those in order to ensure |
| 525 // that new space can be aligned to its size. | 577 // that new space can be aligned to its size. |
| 526 intptr_t MaxReserved() { | 578 intptr_t MaxReserved() { |
| 527 return 4 * reserved_semispace_size_ + max_old_generation_size_; | 579 return 4 * reserved_semispace_size_ + max_old_generation_size_; |
| 528 } | 580 } |
| 529 int MaxSemiSpaceSize() { return max_semispace_size_; } | 581 int MaxSemiSpaceSize() { return max_semispace_size_; } |
| 530 int ReservedSemiSpaceSize() { return reserved_semispace_size_; } | 582 int ReservedSemiSpaceSize() { return reserved_semispace_size_; } |
| 531 int InitialSemiSpaceSize() { return initial_semispace_size_; } | 583 int InitialSemiSpaceSize() { return initial_semispace_size_; } |
| 532 intptr_t MaxOldGenerationSize() { return max_old_generation_size_; } | 584 intptr_t MaxOldGenerationSize() { return max_old_generation_size_; } |
| 533 intptr_t MaxExecutableSize() { return max_executable_size_; } | 585 intptr_t MaxExecutableSize() { return max_executable_size_; } |
| 534 int MaxRegularSpaceAllocationSize() { return InitialSemiSpaceSize() * 4/5; } | |
| 535 | 586 |
| 536 // Returns the capacity of the heap in bytes w/o growing. Heap grows when | 587 // Returns the capacity of the heap in bytes w/o growing. Heap grows when |
| 537 // more spaces are needed until it reaches the limit. | 588 // more spaces are needed until it reaches the limit. |
| 538 intptr_t Capacity(); | 589 intptr_t Capacity(); |
| 539 | 590 |
| 540 // Returns the amount of memory currently committed for the heap. | 591 // Returns the amount of memory currently committed for the heap. |
| 541 intptr_t CommittedMemory(); | 592 intptr_t CommittedMemory(); |
| 542 | 593 |
| 543 // Returns the amount of executable memory currently committed for the heap. | 594 // Returns the amount of executable memory currently committed for the heap. |
| 544 intptr_t CommittedMemoryExecutable(); | 595 intptr_t CommittedMemoryExecutable(); |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 // Allocates a new JSMessageObject object. | 1132 // Allocates a new JSMessageObject object. |
| 1082 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 1133 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 1083 // failed. | 1134 // failed. |
| 1084 // Please note that this does not perform a garbage collection. | 1135 // Please note that this does not perform a garbage collection. |
| 1085 MUST_USE_RESULT MaybeObject* AllocateJSMessageObject( | 1136 MUST_USE_RESULT MaybeObject* AllocateJSMessageObject( |
| 1086 String* type, | 1137 String* type, |
| 1087 JSArray* arguments, | 1138 JSArray* arguments, |
| 1088 int start_position, | 1139 int start_position, |
| 1089 int end_position, | 1140 int end_position, |
| 1090 Object* script, | 1141 Object* script, |
| 1091 Object* stack_trace, | |
| 1092 Object* stack_frames); | 1142 Object* stack_frames); |
| 1093 | 1143 |
| 1094 // Allocate a new external string object, which is backed by a string | 1144 // Allocate a new external string object, which is backed by a string |
| 1095 // resource that resides outside the V8 heap. | 1145 // resource that resides outside the V8 heap. |
| 1096 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 1146 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 1097 // failed. | 1147 // failed. |
| 1098 // Please note this does not perform a garbage collection. | 1148 // Please note this does not perform a garbage collection. |
| 1099 MUST_USE_RESULT MaybeObject* AllocateExternalStringFromAscii( | 1149 MUST_USE_RESULT MaybeObject* AllocateExternalStringFromAscii( |
| 1100 const ExternalAsciiString::Resource* resource); | 1150 const ExternalAsciiString::Resource* resource); |
| 1101 MUST_USE_RESULT MaybeObject* AllocateExternalStringFromTwoByte( | 1151 MUST_USE_RESULT MaybeObject* AllocateExternalStringFromTwoByte( |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 // Check whether the heap is currently iterable. | 1252 // Check whether the heap is currently iterable. |
| 1203 bool IsHeapIterable(); | 1253 bool IsHeapIterable(); |
| 1204 | 1254 |
| 1205 // Ensure that we have swept all spaces in such a way that we can iterate | 1255 // Ensure that we have swept all spaces in such a way that we can iterate |
| 1206 // over all objects. May cause a GC. | 1256 // over all objects. May cause a GC. |
| 1207 void EnsureHeapIsIterable(); | 1257 void EnsureHeapIsIterable(); |
| 1208 | 1258 |
| 1209 // Notify the heap that a context has been disposed. | 1259 // Notify the heap that a context has been disposed. |
| 1210 int NotifyContextDisposed(); | 1260 int NotifyContextDisposed(); |
| 1211 | 1261 |
| 1212 // Utility to invoke the scavenger. This is needed in test code to | |
| 1213 // ensure correct callback for weak global handles. | |
| 1214 void PerformScavenge(); | |
| 1215 | |
| 1216 inline void increment_scan_on_scavenge_pages() { | 1262 inline void increment_scan_on_scavenge_pages() { |
| 1217 scan_on_scavenge_pages_++; | 1263 scan_on_scavenge_pages_++; |
| 1218 if (FLAG_gc_verbose) { | 1264 if (FLAG_gc_verbose) { |
| 1219 PrintF("Scan-on-scavenge pages: %d\n", scan_on_scavenge_pages_); | 1265 PrintF("Scan-on-scavenge pages: %d\n", scan_on_scavenge_pages_); |
| 1220 } | 1266 } |
| 1221 } | 1267 } |
| 1222 | 1268 |
| 1223 inline void decrement_scan_on_scavenge_pages() { | 1269 inline void decrement_scan_on_scavenge_pages() { |
| 1224 scan_on_scavenge_pages_--; | 1270 scan_on_scavenge_pages_--; |
| 1225 if (FLAG_gc_verbose) { | 1271 if (FLAG_gc_verbose) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 | 1340 |
| 1295 Object* weak_object_to_code_table() { return weak_object_to_code_table_; } | 1341 Object* weak_object_to_code_table() { return weak_object_to_code_table_; } |
| 1296 | 1342 |
| 1297 // Number of mark-sweeps. | 1343 // Number of mark-sweeps. |
| 1298 unsigned int ms_count() { return ms_count_; } | 1344 unsigned int ms_count() { return ms_count_; } |
| 1299 | 1345 |
| 1300 // Iterates over all roots in the heap. | 1346 // Iterates over all roots in the heap. |
| 1301 void IterateRoots(ObjectVisitor* v, VisitMode mode); | 1347 void IterateRoots(ObjectVisitor* v, VisitMode mode); |
| 1302 // Iterates over all strong roots in the heap. | 1348 // Iterates over all strong roots in the heap. |
| 1303 void IterateStrongRoots(ObjectVisitor* v, VisitMode mode); | 1349 void IterateStrongRoots(ObjectVisitor* v, VisitMode mode); |
| 1350 // Iterates over entries in the smi roots list. Only interesting to the |
| 1351 // serializer/deserializer, since GC does not care about smis. |
| 1352 void IterateSmiRoots(ObjectVisitor* v); |
| 1304 // Iterates over all the other roots in the heap. | 1353 // Iterates over all the other roots in the heap. |
| 1305 void IterateWeakRoots(ObjectVisitor* v, VisitMode mode); | 1354 void IterateWeakRoots(ObjectVisitor* v, VisitMode mode); |
| 1306 | 1355 |
| 1307 // Iterate pointers to from semispace of new space found in memory interval | 1356 // Iterate pointers to from semispace of new space found in memory interval |
| 1308 // from start to end. | 1357 // from start to end. |
| 1309 void IterateAndMarkPointersToFromSpace(Address start, | 1358 void IterateAndMarkPointersToFromSpace(Address start, |
| 1310 Address end, | 1359 Address end, |
| 1311 ObjectSlotCallback callback); | 1360 ObjectSlotCallback callback); |
| 1312 | 1361 |
| 1313 // Returns whether the object resides in new space. | 1362 // Returns whether the object resides in new space. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 } | 1410 } |
| 1362 | 1411 |
| 1363 void public_set_empty_script(Script* script) { | 1412 void public_set_empty_script(Script* script) { |
| 1364 roots_[kEmptyScriptRootIndex] = script; | 1413 roots_[kEmptyScriptRootIndex] = script; |
| 1365 } | 1414 } |
| 1366 | 1415 |
| 1367 void public_set_store_buffer_top(Address* top) { | 1416 void public_set_store_buffer_top(Address* top) { |
| 1368 roots_[kStoreBufferTopRootIndex] = reinterpret_cast<Smi*>(top); | 1417 roots_[kStoreBufferTopRootIndex] = reinterpret_cast<Smi*>(top); |
| 1369 } | 1418 } |
| 1370 | 1419 |
| 1420 void public_set_materialized_objects(FixedArray* objects) { |
| 1421 roots_[kMaterializedObjectsRootIndex] = objects; |
| 1422 } |
| 1423 |
| 1371 // Generated code can embed this address to get access to the roots. | 1424 // Generated code can embed this address to get access to the roots. |
| 1372 Object** roots_array_start() { return roots_; } | 1425 Object** roots_array_start() { return roots_; } |
| 1373 | 1426 |
| 1374 Address* store_buffer_top_address() { | 1427 Address* store_buffer_top_address() { |
| 1375 return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]); | 1428 return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]); |
| 1376 } | 1429 } |
| 1377 | 1430 |
| 1378 // Get address of native contexts list for serialization support. | 1431 // Get address of native contexts list for serialization support. |
| 1379 Object** native_contexts_list_address() { | 1432 Object** native_contexts_list_address() { |
| 1380 return &native_contexts_list_; | 1433 return &native_contexts_list_; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 } | 1559 } |
| 1507 | 1560 |
| 1508 inline intptr_t OldGenerationCapacityAvailable() { | 1561 inline intptr_t OldGenerationCapacityAvailable() { |
| 1509 return max_old_generation_size_ - PromotedTotalSize(); | 1562 return max_old_generation_size_ - PromotedTotalSize(); |
| 1510 } | 1563 } |
| 1511 | 1564 |
| 1512 static const intptr_t kMinimumOldGenerationAllocationLimit = | 1565 static const intptr_t kMinimumOldGenerationAllocationLimit = |
| 1513 8 * (Page::kPageSize > MB ? Page::kPageSize : MB); | 1566 8 * (Page::kPageSize > MB ? Page::kPageSize : MB); |
| 1514 | 1567 |
| 1515 intptr_t OldGenerationAllocationLimit(intptr_t old_gen_size) { | 1568 intptr_t OldGenerationAllocationLimit(intptr_t old_gen_size) { |
| 1516 const int divisor = FLAG_stress_compaction ? 10 : | 1569 const int divisor = FLAG_stress_compaction ? 10 : 1; |
| 1517 new_space_high_promotion_mode_active_ ? 1 : 3; | |
| 1518 intptr_t limit = | 1570 intptr_t limit = |
| 1519 Max(old_gen_size + old_gen_size / divisor, | 1571 Max(old_gen_size + old_gen_size / divisor, |
| 1520 kMinimumOldGenerationAllocationLimit); | 1572 kMinimumOldGenerationAllocationLimit); |
| 1521 limit += new_space_.Capacity(); | 1573 limit += new_space_.Capacity(); |
| 1522 // TODO(hpayer): Can be removed when when pretenuring is supported for all | |
| 1523 // allocation sites. | |
| 1524 if (IsHighSurvivalRate() && IsStableOrIncreasingSurvivalTrend()) { | |
| 1525 limit *= 2; | |
| 1526 } | |
| 1527 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; | 1574 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; |
| 1528 return Min(limit, halfway_to_the_max); | 1575 return Min(limit, halfway_to_the_max); |
| 1529 } | 1576 } |
| 1530 | 1577 |
| 1531 // Indicates whether inline bump-pointer allocation has been disabled. | 1578 // Indicates whether inline bump-pointer allocation has been disabled. |
| 1532 bool inline_allocation_disabled() { return inline_allocation_disabled_; } | 1579 bool inline_allocation_disabled() { return inline_allocation_disabled_; } |
| 1533 | 1580 |
| 1534 // Switch whether inline bump-pointer allocation should be used. | 1581 // Switch whether inline bump-pointer allocation should be used. |
| 1535 void EnableInlineAllocation(); | 1582 void EnableInlineAllocation(); |
| 1536 void DisableInlineAllocation(); | 1583 void DisableInlineAllocation(); |
| 1537 | 1584 |
| 1538 // Implements the corresponding V8 API function. | 1585 // Implements the corresponding V8 API function. |
| 1539 bool IdleNotification(int hint); | 1586 bool IdleNotification(int hint); |
| 1540 | 1587 |
| 1541 // Declare all the root indices. | 1588 // Declare all the root indices. This defines the root list order. |
| 1542 enum RootListIndex { | 1589 enum RootListIndex { |
| 1543 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, | 1590 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, |
| 1544 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) | 1591 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) |
| 1545 #undef ROOT_INDEX_DECLARATION | 1592 #undef ROOT_INDEX_DECLARATION |
| 1546 | 1593 |
| 1547 #define STRING_INDEX_DECLARATION(name, str) k##name##RootIndex, | 1594 #define STRING_INDEX_DECLARATION(name, str) k##name##RootIndex, |
| 1548 INTERNALIZED_STRING_LIST(STRING_INDEX_DECLARATION) | 1595 INTERNALIZED_STRING_LIST(STRING_INDEX_DECLARATION) |
| 1549 #undef STRING_DECLARATION | 1596 #undef STRING_DECLARATION |
| 1550 | 1597 |
| 1551 // Utility type maps | 1598 // Utility type maps |
| 1552 #define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex, | 1599 #define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex, |
| 1553 STRUCT_LIST(DECLARE_STRUCT_MAP) | 1600 STRUCT_LIST(DECLARE_STRUCT_MAP) |
| 1554 #undef DECLARE_STRUCT_MAP | 1601 #undef DECLARE_STRUCT_MAP |
| 1555 | 1602 |
| 1556 kStringTableRootIndex, | 1603 kStringTableRootIndex, |
| 1604 |
| 1605 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, |
| 1606 SMI_ROOT_LIST(ROOT_INDEX_DECLARATION) |
| 1607 #undef ROOT_INDEX_DECLARATION |
| 1608 |
| 1609 kRootListLength, |
| 1557 kStrongRootListLength = kStringTableRootIndex, | 1610 kStrongRootListLength = kStringTableRootIndex, |
| 1558 kRootListLength | 1611 kSmiRootsStart = kStringTableRootIndex + 1 |
| 1559 }; | 1612 }; |
| 1560 | 1613 |
| 1561 STATIC_CHECK(kUndefinedValueRootIndex == Internals::kUndefinedValueRootIndex); | 1614 STATIC_CHECK(kUndefinedValueRootIndex == Internals::kUndefinedValueRootIndex); |
| 1562 STATIC_CHECK(kNullValueRootIndex == Internals::kNullValueRootIndex); | 1615 STATIC_CHECK(kNullValueRootIndex == Internals::kNullValueRootIndex); |
| 1563 STATIC_CHECK(kTrueValueRootIndex == Internals::kTrueValueRootIndex); | 1616 STATIC_CHECK(kTrueValueRootIndex == Internals::kTrueValueRootIndex); |
| 1564 STATIC_CHECK(kFalseValueRootIndex == Internals::kFalseValueRootIndex); | 1617 STATIC_CHECK(kFalseValueRootIndex == Internals::kFalseValueRootIndex); |
| 1565 STATIC_CHECK(kempty_stringRootIndex == Internals::kEmptyStringRootIndex); | 1618 STATIC_CHECK(kempty_stringRootIndex == Internals::kEmptyStringRootIndex); |
| 1566 | 1619 |
| 1567 // Generated code can embed direct references to non-writable roots if | 1620 // Generated code can embed direct references to non-writable roots if |
| 1568 // they are in new space. | 1621 // they are in new space. |
| 1569 static bool RootCanBeWrittenAfterInitialization(RootListIndex root_index); | 1622 static bool RootCanBeWrittenAfterInitialization(RootListIndex root_index); |
| 1570 // Generated code can treat direct references to this root as constant. | 1623 // Generated code can treat direct references to this root as constant. |
| 1571 bool RootCanBeTreatedAsConstant(RootListIndex root_index); | 1624 bool RootCanBeTreatedAsConstant(RootListIndex root_index); |
| 1572 | 1625 |
| 1573 MUST_USE_RESULT MaybeObject* NumberToString( | 1626 MUST_USE_RESULT MaybeObject* NumberToString( |
| 1574 Object* number, bool check_number_string_cache = true, | 1627 Object* number, bool check_number_string_cache = true); |
| 1575 PretenureFlag pretenure = NOT_TENURED); | |
| 1576 MUST_USE_RESULT MaybeObject* Uint32ToString( | 1628 MUST_USE_RESULT MaybeObject* Uint32ToString( |
| 1577 uint32_t value, bool check_number_string_cache = true); | 1629 uint32_t value, bool check_number_string_cache = true); |
| 1578 | 1630 |
| 1579 Map* MapForFixedTypedArray(ExternalArrayType array_type); | 1631 Map* MapForFixedTypedArray(ExternalArrayType array_type); |
| 1580 RootListIndex RootIndexForFixedTypedArray( | 1632 RootListIndex RootIndexForFixedTypedArray( |
| 1581 ExternalArrayType array_type); | 1633 ExternalArrayType array_type); |
| 1582 | 1634 |
| 1583 Map* MapForExternalArrayType(ExternalArrayType array_type); | 1635 Map* MapForExternalArrayType(ExternalArrayType array_type); |
| 1584 RootListIndex RootIndexForExternalArrayType( | 1636 RootListIndex RootIndexForExternalArrayType( |
| 1585 ExternalArrayType array_type); | 1637 ExternalArrayType array_type); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1784 void AgeInlineCaches() { | 1836 void AgeInlineCaches() { |
| 1785 global_ic_age_ = (global_ic_age_ + 1) & SharedFunctionInfo::ICAgeBits::kMax; | 1837 global_ic_age_ = (global_ic_age_ + 1) & SharedFunctionInfo::ICAgeBits::kMax; |
| 1786 } | 1838 } |
| 1787 | 1839 |
| 1788 bool flush_monomorphic_ics() { return flush_monomorphic_ics_; } | 1840 bool flush_monomorphic_ics() { return flush_monomorphic_ics_; } |
| 1789 | 1841 |
| 1790 int64_t amount_of_external_allocated_memory() { | 1842 int64_t amount_of_external_allocated_memory() { |
| 1791 return amount_of_external_allocated_memory_; | 1843 return amount_of_external_allocated_memory_; |
| 1792 } | 1844 } |
| 1793 | 1845 |
| 1846 void DeoptMarkedAllocationSites(); |
| 1847 |
| 1794 // ObjectStats are kept in two arrays, counts and sizes. Related stats are | 1848 // ObjectStats are kept in two arrays, counts and sizes. Related stats are |
| 1795 // stored in a contiguous linear buffer. Stats groups are stored one after | 1849 // stored in a contiguous linear buffer. Stats groups are stored one after |
| 1796 // another. | 1850 // another. |
| 1797 enum { | 1851 enum { |
| 1798 FIRST_CODE_KIND_SUB_TYPE = LAST_TYPE + 1, | 1852 FIRST_CODE_KIND_SUB_TYPE = LAST_TYPE + 1, |
| 1799 FIRST_FIXED_ARRAY_SUB_TYPE = | 1853 FIRST_FIXED_ARRAY_SUB_TYPE = |
| 1800 FIRST_CODE_KIND_SUB_TYPE + Code::NUMBER_OF_KINDS, | 1854 FIRST_CODE_KIND_SUB_TYPE + Code::NUMBER_OF_KINDS, |
| 1801 FIRST_CODE_AGE_SUB_TYPE = | 1855 FIRST_CODE_AGE_SUB_TYPE = |
| 1802 FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1, | 1856 FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1, |
| 1803 OBJECT_STATS_COUNT = FIRST_CODE_AGE_SUB_TYPE + Code::kCodeAgeCount + 1 | 1857 OBJECT_STATS_COUNT = FIRST_CODE_AGE_SUB_TYPE + Code::kCodeAgeCount + 1 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2070 // Pretenuring decisions are made based on feedback collected during new | 2124 // Pretenuring decisions are made based on feedback collected during new |
| 2071 // space evacuation. Note that between feedback collection and calling this | 2125 // space evacuation. Note that between feedback collection and calling this |
| 2072 // method object in old space must not move. | 2126 // method object in old space must not move. |
| 2073 // Right now we only process pretenuring feedback in high promotion mode. | 2127 // Right now we only process pretenuring feedback in high promotion mode. |
| 2074 void ProcessPretenuringFeedback(); | 2128 void ProcessPretenuringFeedback(); |
| 2075 | 2129 |
| 2076 // Checks whether a global GC is necessary | 2130 // Checks whether a global GC is necessary |
| 2077 GarbageCollector SelectGarbageCollector(AllocationSpace space, | 2131 GarbageCollector SelectGarbageCollector(AllocationSpace space, |
| 2078 const char** reason); | 2132 const char** reason); |
| 2079 | 2133 |
| 2134 // Make sure there is a filler value behind the top of the new space |
| 2135 // so that the GC does not confuse some unintialized/stale memory |
| 2136 // with the allocation memento of the object at the top |
| 2137 void EnsureFillerObjectAtTop(); |
| 2138 |
| 2080 // Performs garbage collection operation. | 2139 // Performs garbage collection operation. |
| 2081 // Returns whether there is a chance that another major GC could | 2140 // Returns whether there is a chance that another major GC could |
| 2082 // collect more garbage. | 2141 // collect more garbage. |
| 2083 bool CollectGarbage( | 2142 bool CollectGarbage( |
| 2084 AllocationSpace space, | |
| 2085 GarbageCollector collector, | 2143 GarbageCollector collector, |
| 2086 const char* gc_reason, | 2144 const char* gc_reason, |
| 2087 const char* collector_reason, | 2145 const char* collector_reason, |
| 2088 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); | 2146 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); |
| 2089 | 2147 |
| 2090 // Performs garbage collection | 2148 // Performs garbage collection |
| 2091 // Returns whether there is a chance another major GC could | 2149 // Returns whether there is a chance another major GC could |
| 2092 // collect more garbage. | 2150 // collect more garbage. |
| 2093 bool PerformGarbageCollection( | 2151 bool PerformGarbageCollection( |
| 2094 GarbageCollector collector, | 2152 GarbageCollector collector, |
| 2095 GCTracer* tracer, | 2153 GCTracer* tracer, |
| 2096 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); | 2154 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); |
| 2097 | 2155 |
| 2098 inline void UpdateOldSpaceLimits(); | 2156 inline void UpdateOldSpaceLimits(); |
| 2099 | 2157 |
| 2100 // Selects the proper allocation space depending on the given object | 2158 // Selects the proper allocation space depending on the given object |
| 2101 // size, pretenuring decision, and preferred old-space. | 2159 // size, pretenuring decision, and preferred old-space. |
| 2102 static AllocationSpace SelectSpace(int object_size, | 2160 static AllocationSpace SelectSpace(int object_size, |
| 2103 AllocationSpace preferred_old_space, | 2161 AllocationSpace preferred_old_space, |
| 2104 PretenureFlag pretenure) { | 2162 PretenureFlag pretenure) { |
| 2105 ASSERT(preferred_old_space == OLD_POINTER_SPACE || | 2163 ASSERT(preferred_old_space == OLD_POINTER_SPACE || |
| 2106 preferred_old_space == OLD_DATA_SPACE); | 2164 preferred_old_space == OLD_DATA_SPACE); |
| 2107 if (object_size > Page::kMaxNonCodeHeapObjectSize) return LO_SPACE; | 2165 if (object_size > Page::kMaxRegularHeapObjectSize) return LO_SPACE; |
| 2108 return (pretenure == TENURED) ? preferred_old_space : NEW_SPACE; | 2166 return (pretenure == TENURED) ? preferred_old_space : NEW_SPACE; |
| 2109 } | 2167 } |
| 2110 | 2168 |
| 2111 // Allocate an uninitialized fixed array. | 2169 // Allocate an uninitialized fixed array. |
| 2112 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray( | 2170 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray( |
| 2113 int length, PretenureFlag pretenure); | 2171 int length, PretenureFlag pretenure); |
| 2114 | 2172 |
| 2115 // Allocate an uninitialized fixed double array. | 2173 // Allocate an uninitialized fixed double array. |
| 2116 MUST_USE_RESULT MaybeObject* AllocateRawFixedDoubleArray( | 2174 MUST_USE_RESULT MaybeObject* AllocateRawFixedDoubleArray( |
| 2117 int length, PretenureFlag pretenure); | 2175 int length, PretenureFlag pretenure); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2129 | 2187 |
| 2130 bool CreateInitialMaps(); | 2188 bool CreateInitialMaps(); |
| 2131 bool CreateInitialObjects(); | 2189 bool CreateInitialObjects(); |
| 2132 | 2190 |
| 2133 // These five Create*EntryStub functions are here and forced to not be inlined | 2191 // These five Create*EntryStub functions are here and forced to not be inlined |
| 2134 // because of a gcc-4.4 bug that assigns wrong vtable entries. | 2192 // because of a gcc-4.4 bug that assigns wrong vtable entries. |
| 2135 NO_INLINE(void CreateJSEntryStub()); | 2193 NO_INLINE(void CreateJSEntryStub()); |
| 2136 NO_INLINE(void CreateJSConstructEntryStub()); | 2194 NO_INLINE(void CreateJSConstructEntryStub()); |
| 2137 | 2195 |
| 2138 void CreateFixedStubs(); | 2196 void CreateFixedStubs(); |
| 2139 void CreateStubsRequiringBuiltins(); | |
| 2140 | 2197 |
| 2141 MUST_USE_RESULT MaybeObject* CreateOddball(const char* to_string, | 2198 MUST_USE_RESULT MaybeObject* CreateOddball(const char* to_string, |
| 2142 Object* to_number, | 2199 Object* to_number, |
| 2143 byte kind); | 2200 byte kind); |
| 2144 | 2201 |
| 2145 // Allocate a JSArray with no elements | 2202 // Allocate a JSArray with no elements |
| 2146 MUST_USE_RESULT MaybeObject* AllocateJSArray( | 2203 MUST_USE_RESULT MaybeObject* AllocateJSArray( |
| 2147 ElementsKind elements_kind, | 2204 ElementsKind elements_kind, |
| 2148 PretenureFlag pretenure = NOT_TENURED); | 2205 PretenureFlag pretenure = NOT_TENURED); |
| 2149 | 2206 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2238 // Allocates a small number to string cache. | 2295 // Allocates a small number to string cache. |
| 2239 MUST_USE_RESULT MaybeObject* AllocateInitialNumberStringCache(); | 2296 MUST_USE_RESULT MaybeObject* AllocateInitialNumberStringCache(); |
| 2240 // Creates and installs the full-sized number string cache. | 2297 // Creates and installs the full-sized number string cache. |
| 2241 void AllocateFullSizeNumberStringCache(); | 2298 void AllocateFullSizeNumberStringCache(); |
| 2242 // Get the length of the number to string cache based on the max semispace | 2299 // Get the length of the number to string cache based on the max semispace |
| 2243 // size. | 2300 // size. |
| 2244 int FullSizeNumberStringCacheLength(); | 2301 int FullSizeNumberStringCacheLength(); |
| 2245 // Flush the number to string cache. | 2302 // Flush the number to string cache. |
| 2246 void FlushNumberStringCache(); | 2303 void FlushNumberStringCache(); |
| 2247 | 2304 |
| 2305 // Allocates a fixed-size allocation sites scratchpad. |
| 2306 MUST_USE_RESULT MaybeObject* AllocateAllocationSitesScratchpad(); |
| 2307 |
| 2308 // Sets used allocation sites entries to undefined. |
| 2309 void FlushAllocationSitesScratchpad(); |
| 2310 |
| 2311 // Initializes the allocation sites scratchpad with undefined values. |
| 2312 void InitializeAllocationSitesScratchpad(); |
| 2313 |
| 2314 // Adds an allocation site to the scratchpad if there is space left. |
| 2315 void AddAllocationSiteToScratchpad(AllocationSite* site); |
| 2316 |
| 2248 void UpdateSurvivalRateTrend(int start_new_space_size); | 2317 void UpdateSurvivalRateTrend(int start_new_space_size); |
| 2249 | 2318 |
| 2250 enum SurvivalRateTrend { INCREASING, STABLE, DECREASING, FLUCTUATING }; | 2319 enum SurvivalRateTrend { INCREASING, STABLE, DECREASING, FLUCTUATING }; |
| 2251 | 2320 |
| 2252 static const int kYoungSurvivalRateHighThreshold = 90; | 2321 static const int kYoungSurvivalRateHighThreshold = 90; |
| 2253 static const int kYoungSurvivalRateLowThreshold = 10; | 2322 static const int kYoungSurvivalRateLowThreshold = 10; |
| 2254 static const int kYoungSurvivalRateAllowedDeviation = 15; | 2323 static const int kYoungSurvivalRateAllowedDeviation = 15; |
| 2255 | 2324 |
| 2256 static const int kOldSurvivalRateLowThreshold = 20; | 2325 static const int kOldSurvivalRateLowThreshold = 20; |
| 2257 | 2326 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2410 | 2479 |
| 2411 // If the --deopt_every_n_garbage_collections flag is set to a positive value, | 2480 // If the --deopt_every_n_garbage_collections flag is set to a positive value, |
| 2412 // this variable holds the number of garbage collections since the last | 2481 // this variable holds the number of garbage collections since the last |
| 2413 // deoptimization triggered by garbage collection. | 2482 // deoptimization triggered by garbage collection. |
| 2414 int gcs_since_last_deopt_; | 2483 int gcs_since_last_deopt_; |
| 2415 | 2484 |
| 2416 #ifdef VERIFY_HEAP | 2485 #ifdef VERIFY_HEAP |
| 2417 int no_weak_object_verification_scope_depth_; | 2486 int no_weak_object_verification_scope_depth_; |
| 2418 #endif | 2487 #endif |
| 2419 | 2488 |
| 2420 | |
| 2421 static const int kAllocationSiteScratchpadSize = 256; | 2489 static const int kAllocationSiteScratchpadSize = 256; |
| 2422 int allocation_sites_scratchpad_length; | 2490 int allocation_sites_scratchpad_length_; |
| 2423 AllocationSite* allocation_sites_scratchpad[kAllocationSiteScratchpadSize]; | |
| 2424 | 2491 |
| 2425 static const int kMaxMarkSweepsInIdleRound = 7; | 2492 static const int kMaxMarkSweepsInIdleRound = 7; |
| 2426 static const int kIdleScavengeThreshold = 5; | 2493 static const int kIdleScavengeThreshold = 5; |
| 2427 | 2494 |
| 2428 // Shared state read by the scavenge collector and set by ScavengeObject. | 2495 // Shared state read by the scavenge collector and set by ScavengeObject. |
| 2429 PromotionQueue promotion_queue_; | 2496 PromotionQueue promotion_queue_; |
| 2430 | 2497 |
| 2431 // Flag is set when the heap has been configured. The heap can be repeatedly | 2498 // Flag is set when the heap has been configured. The heap can be repeatedly |
| 2432 // configured through the API until it is set up. | 2499 // configured through the API until it is set up. |
| 2433 bool configured_; | 2500 bool configured_; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2531 // or care about intergenerational references. All heap object pointers have to | 2598 // or care about intergenerational references. All heap object pointers have to |
| 2532 // point into the heap to a location that has a map pointer at its first word. | 2599 // point into the heap to a location that has a map pointer at its first word. |
| 2533 // Caveat: Heap::Contains is an approximation because it can return true for | 2600 // Caveat: Heap::Contains is an approximation because it can return true for |
| 2534 // objects in a heap space but above the allocation pointer. | 2601 // objects in a heap space but above the allocation pointer. |
| 2535 class VerifyPointersVisitor: public ObjectVisitor { | 2602 class VerifyPointersVisitor: public ObjectVisitor { |
| 2536 public: | 2603 public: |
| 2537 inline void VisitPointers(Object** start, Object** end); | 2604 inline void VisitPointers(Object** start, Object** end); |
| 2538 }; | 2605 }; |
| 2539 | 2606 |
| 2540 | 2607 |
| 2608 // Verify that all objects are Smis. |
| 2609 class VerifySmisVisitor: public ObjectVisitor { |
| 2610 public: |
| 2611 inline void VisitPointers(Object** start, Object** end); |
| 2612 }; |
| 2613 |
| 2614 |
| 2541 // Space iterator for iterating over all spaces of the heap. Returns each space | 2615 // Space iterator for iterating over all spaces of the heap. Returns each space |
| 2542 // in turn, and null when it is done. | 2616 // in turn, and null when it is done. |
| 2543 class AllSpaces BASE_EMBEDDED { | 2617 class AllSpaces BASE_EMBEDDED { |
| 2544 public: | 2618 public: |
| 2545 explicit AllSpaces(Heap* heap) : heap_(heap), counter_(FIRST_SPACE) {} | 2619 explicit AllSpaces(Heap* heap) : heap_(heap), counter_(FIRST_SPACE) {} |
| 2546 Space* next(); | 2620 Space* next(); |
| 2547 private: | 2621 private: |
| 2548 Heap* heap_; | 2622 Heap* heap_; |
| 2549 int counter_; | 2623 int counter_; |
| 2550 }; | 2624 }; |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3040 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 3114 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 3041 | 3115 |
| 3042 private: | 3116 private: |
| 3043 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 3117 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 3044 }; | 3118 }; |
| 3045 #endif // DEBUG | 3119 #endif // DEBUG |
| 3046 | 3120 |
| 3047 } } // namespace v8::internal | 3121 } } // namespace v8::internal |
| 3048 | 3122 |
| 3049 #endif // V8_HEAP_H_ | 3123 #endif // V8_HEAP_H_ |
| OLD | NEW |