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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 V(Smi, construct_stub_deopt_pc_offset, ConstructStubDeoptPCOffset) \ | 194 V(Smi, construct_stub_deopt_pc_offset, ConstructStubDeoptPCOffset) \ |
195 V(Smi, getter_stub_deopt_pc_offset, GetterStubDeoptPCOffset) \ | 195 V(Smi, getter_stub_deopt_pc_offset, GetterStubDeoptPCOffset) \ |
196 V(Smi, setter_stub_deopt_pc_offset, SetterStubDeoptPCOffset) \ | 196 V(Smi, setter_stub_deopt_pc_offset, SetterStubDeoptPCOffset) \ |
197 V(Cell, undefined_cell, UndefineCell) \ | 197 V(Cell, undefined_cell, UndefineCell) \ |
198 V(JSObject, observation_state, ObservationState) \ | 198 V(JSObject, observation_state, ObservationState) \ |
199 V(Map, external_map, ExternalMap) \ | 199 V(Map, external_map, ExternalMap) \ |
200 V(Symbol, frozen_symbol, FrozenSymbol) \ | 200 V(Symbol, frozen_symbol, FrozenSymbol) \ |
201 V(Symbol, elements_transition_symbol, ElementsTransitionSymbol) \ | 201 V(Symbol, elements_transition_symbol, ElementsTransitionSymbol) \ |
202 V(SeededNumberDictionary, empty_slow_element_dictionary, \ | 202 V(SeededNumberDictionary, empty_slow_element_dictionary, \ |
203 EmptySlowElementDictionary) \ | 203 EmptySlowElementDictionary) \ |
204 V(Symbol, observed_symbol, ObservedSymbol) | 204 V(Symbol, observed_symbol, ObservedSymbol) \ |
| 205 V(FixedArray, materialized_objects, MaterializedObjects) |
205 | 206 |
206 #define ROOT_LIST(V) \ | 207 #define ROOT_LIST(V) \ |
207 STRONG_ROOT_LIST(V) \ | 208 STRONG_ROOT_LIST(V) \ |
208 V(StringTable, string_table, StringTable) | 209 V(StringTable, string_table, StringTable) |
209 | 210 |
| 211 // Heap roots that are known to be immortal immovable, for which we can safely |
| 212 // skip write barriers. |
| 213 #define IMMORTAL_IMMOVABLE_ROOT_LIST(V) \ |
| 214 V(byte_array_map) \ |
| 215 V(free_space_map) \ |
| 216 V(one_pointer_filler_map) \ |
| 217 V(two_pointer_filler_map) \ |
| 218 V(undefined_value) \ |
| 219 V(the_hole_value) \ |
| 220 V(null_value) \ |
| 221 V(true_value) \ |
| 222 V(false_value) \ |
| 223 V(uninitialized_value) \ |
| 224 V(cell_map) \ |
| 225 V(global_property_cell_map) \ |
| 226 V(shared_function_info_map) \ |
| 227 V(meta_map) \ |
| 228 V(heap_number_map) \ |
| 229 V(native_context_map) \ |
| 230 V(fixed_array_map) \ |
| 231 V(code_map) \ |
| 232 V(scope_info_map) \ |
| 233 V(fixed_cow_array_map) \ |
| 234 V(fixed_double_array_map) \ |
| 235 V(constant_pool_array_map) \ |
| 236 V(no_interceptor_result_sentinel) \ |
| 237 V(hash_table_map) \ |
| 238 V(empty_fixed_array) \ |
| 239 V(empty_byte_array) \ |
| 240 V(empty_descriptor_array) \ |
| 241 V(empty_constant_pool_array) \ |
| 242 V(arguments_marker) \ |
| 243 V(symbol_map) \ |
| 244 V(non_strict_arguments_elements_map) \ |
| 245 V(function_context_map) \ |
| 246 V(catch_context_map) \ |
| 247 V(with_context_map) \ |
| 248 V(block_context_map) \ |
| 249 V(module_context_map) \ |
| 250 V(global_context_map) \ |
| 251 V(oddball_map) \ |
| 252 V(message_object_map) \ |
| 253 V(foreign_map) \ |
| 254 V(neander_map) |
| 255 |
210 #define INTERNALIZED_STRING_LIST(V) \ | 256 #define INTERNALIZED_STRING_LIST(V) \ |
211 V(Array_string, "Array") \ | 257 V(Array_string, "Array") \ |
212 V(Object_string, "Object") \ | 258 V(Object_string, "Object") \ |
213 V(proto_string, "__proto__") \ | 259 V(proto_string, "__proto__") \ |
214 V(arguments_string, "arguments") \ | 260 V(arguments_string, "arguments") \ |
215 V(Arguments_string, "Arguments") \ | 261 V(Arguments_string, "Arguments") \ |
216 V(call_string, "call") \ | 262 V(call_string, "call") \ |
217 V(apply_string, "apply") \ | 263 V(apply_string, "apply") \ |
218 V(caller_string, "caller") \ | 264 V(caller_string, "caller") \ |
219 V(boolean_string, "boolean") \ | 265 V(boolean_string, "boolean") \ |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 } | 1406 } |
1361 | 1407 |
1362 void public_set_empty_script(Script* script) { | 1408 void public_set_empty_script(Script* script) { |
1363 roots_[kEmptyScriptRootIndex] = script; | 1409 roots_[kEmptyScriptRootIndex] = script; |
1364 } | 1410 } |
1365 | 1411 |
1366 void public_set_store_buffer_top(Address* top) { | 1412 void public_set_store_buffer_top(Address* top) { |
1367 roots_[kStoreBufferTopRootIndex] = reinterpret_cast<Smi*>(top); | 1413 roots_[kStoreBufferTopRootIndex] = reinterpret_cast<Smi*>(top); |
1368 } | 1414 } |
1369 | 1415 |
| 1416 void public_set_materialized_objects(FixedArray* objects) { |
| 1417 roots_[kMaterializedObjectsRootIndex] = objects; |
| 1418 } |
| 1419 |
1370 // Generated code can embed this address to get access to the roots. | 1420 // Generated code can embed this address to get access to the roots. |
1371 Object** roots_array_start() { return roots_; } | 1421 Object** roots_array_start() { return roots_; } |
1372 | 1422 |
1373 Address* store_buffer_top_address() { | 1423 Address* store_buffer_top_address() { |
1374 return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]); | 1424 return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]); |
1375 } | 1425 } |
1376 | 1426 |
1377 // Get address of native contexts list for serialization support. | 1427 // Get address of native contexts list for serialization support. |
1378 Object** native_contexts_list_address() { | 1428 Object** native_contexts_list_address() { |
1379 return &native_contexts_list_; | 1429 return &native_contexts_list_; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1505 } | 1555 } |
1506 | 1556 |
1507 inline intptr_t OldGenerationCapacityAvailable() { | 1557 inline intptr_t OldGenerationCapacityAvailable() { |
1508 return max_old_generation_size_ - PromotedTotalSize(); | 1558 return max_old_generation_size_ - PromotedTotalSize(); |
1509 } | 1559 } |
1510 | 1560 |
1511 static const intptr_t kMinimumOldGenerationAllocationLimit = | 1561 static const intptr_t kMinimumOldGenerationAllocationLimit = |
1512 8 * (Page::kPageSize > MB ? Page::kPageSize : MB); | 1562 8 * (Page::kPageSize > MB ? Page::kPageSize : MB); |
1513 | 1563 |
1514 intptr_t OldGenerationAllocationLimit(intptr_t old_gen_size) { | 1564 intptr_t OldGenerationAllocationLimit(intptr_t old_gen_size) { |
1515 const int divisor = FLAG_stress_compaction ? 10 : | 1565 const int divisor = FLAG_stress_compaction ? 10 : 1; |
1516 new_space_high_promotion_mode_active_ ? 1 : 3; | |
1517 intptr_t limit = | 1566 intptr_t limit = |
1518 Max(old_gen_size + old_gen_size / divisor, | 1567 Max(old_gen_size + old_gen_size / divisor, |
1519 kMinimumOldGenerationAllocationLimit); | 1568 kMinimumOldGenerationAllocationLimit); |
1520 limit += new_space_.Capacity(); | 1569 limit += new_space_.Capacity(); |
1521 // TODO(hpayer): Can be removed when when pretenuring is supported for all | |
1522 // allocation sites. | |
1523 if (IsHighSurvivalRate() && IsStableOrIncreasingSurvivalTrend()) { | |
1524 limit *= 2; | |
1525 } | |
1526 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; | 1570 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; |
1527 return Min(limit, halfway_to_the_max); | 1571 return Min(limit, halfway_to_the_max); |
1528 } | 1572 } |
1529 | 1573 |
1530 // Indicates whether inline bump-pointer allocation has been disabled. | 1574 // Indicates whether inline bump-pointer allocation has been disabled. |
1531 bool inline_allocation_disabled() { return inline_allocation_disabled_; } | 1575 bool inline_allocation_disabled() { return inline_allocation_disabled_; } |
1532 | 1576 |
1533 // Switch whether inline bump-pointer allocation should be used. | 1577 // Switch whether inline bump-pointer allocation should be used. |
1534 void EnableInlineAllocation(); | 1578 void EnableInlineAllocation(); |
1535 void DisableInlineAllocation(); | 1579 void DisableInlineAllocation(); |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2127 | 2171 |
2128 bool CreateInitialMaps(); | 2172 bool CreateInitialMaps(); |
2129 bool CreateInitialObjects(); | 2173 bool CreateInitialObjects(); |
2130 | 2174 |
2131 // These five Create*EntryStub functions are here and forced to not be inlined | 2175 // These five Create*EntryStub functions are here and forced to not be inlined |
2132 // because of a gcc-4.4 bug that assigns wrong vtable entries. | 2176 // because of a gcc-4.4 bug that assigns wrong vtable entries. |
2133 NO_INLINE(void CreateJSEntryStub()); | 2177 NO_INLINE(void CreateJSEntryStub()); |
2134 NO_INLINE(void CreateJSConstructEntryStub()); | 2178 NO_INLINE(void CreateJSConstructEntryStub()); |
2135 | 2179 |
2136 void CreateFixedStubs(); | 2180 void CreateFixedStubs(); |
2137 void CreateStubsRequiringBuiltins(); | |
2138 | 2181 |
2139 MUST_USE_RESULT MaybeObject* CreateOddball(const char* to_string, | 2182 MUST_USE_RESULT MaybeObject* CreateOddball(const char* to_string, |
2140 Object* to_number, | 2183 Object* to_number, |
2141 byte kind); | 2184 byte kind); |
2142 | 2185 |
2143 // Allocate a JSArray with no elements | 2186 // Allocate a JSArray with no elements |
2144 MUST_USE_RESULT MaybeObject* AllocateJSArray( | 2187 MUST_USE_RESULT MaybeObject* AllocateJSArray( |
2145 ElementsKind elements_kind, | 2188 ElementsKind elements_kind, |
2146 PretenureFlag pretenure = NOT_TENURED); | 2189 PretenureFlag pretenure = NOT_TENURED); |
2147 | 2190 |
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3038 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 3081 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
3039 | 3082 |
3040 private: | 3083 private: |
3041 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 3084 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
3042 }; | 3085 }; |
3043 #endif // DEBUG | 3086 #endif // DEBUG |
3044 | 3087 |
3045 } } // namespace v8::internal | 3088 } } // namespace v8::internal |
3046 | 3089 |
3047 #endif // V8_HEAP_H_ | 3090 #endif // V8_HEAP_H_ |
OLD | NEW |