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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 V(PolymorphicCodeCache, polymorphic_code_cache, PolymorphicCodeCache) \ | 168 V(PolymorphicCodeCache, polymorphic_code_cache, PolymorphicCodeCache) \ |
169 V(Code, js_entry_code, JsEntryCode) \ | 169 V(Code, js_entry_code, JsEntryCode) \ |
170 V(Code, js_construct_entry_code, JsConstructEntryCode) \ | 170 V(Code, js_construct_entry_code, JsConstructEntryCode) \ |
171 V(FixedArray, natives_source_cache, NativesSourceCache) \ | 171 V(FixedArray, natives_source_cache, NativesSourceCache) \ |
172 V(Script, empty_script, EmptyScript) \ | 172 V(Script, empty_script, EmptyScript) \ |
173 V(NameDictionary, intrinsic_function_names, IntrinsicFunctionNames) \ | 173 V(NameDictionary, intrinsic_function_names, IntrinsicFunctionNames) \ |
174 V(Cell, undefined_cell, UndefineCell) \ | 174 V(Cell, undefined_cell, UndefineCell) \ |
175 V(JSObject, observation_state, ObservationState) \ | 175 V(JSObject, observation_state, ObservationState) \ |
176 V(Map, external_map, ExternalMap) \ | 176 V(Map, external_map, ExternalMap) \ |
177 V(Object, symbol_registry, SymbolRegistry) \ | 177 V(Object, symbol_registry, SymbolRegistry) \ |
178 V(Symbol, frozen_symbol, FrozenSymbol) \ | |
179 V(Symbol, nonexistent_symbol, NonExistentSymbol) \ | |
180 V(Symbol, elements_transition_symbol, ElementsTransitionSymbol) \ | |
181 V(SeededNumberDictionary, empty_slow_element_dictionary, \ | 178 V(SeededNumberDictionary, empty_slow_element_dictionary, \ |
182 EmptySlowElementDictionary) \ | 179 EmptySlowElementDictionary) \ |
183 V(Symbol, observed_symbol, ObservedSymbol) \ | |
184 V(Symbol, uninitialized_symbol, UninitializedSymbol) \ | |
185 V(Symbol, megamorphic_symbol, MegamorphicSymbol) \ | |
186 V(Symbol, premonomorphic_symbol, PremonomorphicSymbol) \ | |
187 V(Symbol, generic_symbol, GenericSymbol) \ | |
188 V(Symbol, stack_trace_symbol, StackTraceSymbol) \ | |
189 V(Symbol, detailed_stack_trace_symbol, DetailedStackTraceSymbol) \ | |
190 V(Symbol, normal_ic_symbol, NormalICSymbol) \ | |
191 V(Symbol, home_object_symbol, HomeObjectSymbol) \ | |
192 V(FixedArray, materialized_objects, MaterializedObjects) \ | 180 V(FixedArray, materialized_objects, MaterializedObjects) \ |
193 V(FixedArray, allocation_sites_scratchpad, AllocationSitesScratchpad) \ | 181 V(FixedArray, allocation_sites_scratchpad, AllocationSitesScratchpad) \ |
194 V(FixedArray, microtask_queue, MicrotaskQueue) | 182 V(FixedArray, microtask_queue, MicrotaskQueue) |
195 | 183 |
196 // Entries in this list are limited to Smis and are not visited during GC. | 184 // Entries in this list are limited to Smis and are not visited during GC. |
197 #define SMI_ROOT_LIST(V) \ | 185 #define SMI_ROOT_LIST(V) \ |
198 V(Smi, stack_limit, StackLimit) \ | 186 V(Smi, stack_limit, StackLimit) \ |
199 V(Smi, real_stack_limit, RealStackLimit) \ | 187 V(Smi, real_stack_limit, RealStackLimit) \ |
200 V(Smi, last_script_id, LastScriptId) \ | 188 V(Smi, last_script_id, LastScriptId) \ |
201 V(Smi, arguments_adaptor_deopt_pc_offset, ArgumentsAdaptorDeoptPCOffset) \ | 189 V(Smi, arguments_adaptor_deopt_pc_offset, ArgumentsAdaptorDeoptPCOffset) \ |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 V(global_context_map) \ | 240 V(global_context_map) \ |
253 V(undefined_map) \ | 241 V(undefined_map) \ |
254 V(the_hole_map) \ | 242 V(the_hole_map) \ |
255 V(null_map) \ | 243 V(null_map) \ |
256 V(boolean_map) \ | 244 V(boolean_map) \ |
257 V(uninitialized_map) \ | 245 V(uninitialized_map) \ |
258 V(message_object_map) \ | 246 V(message_object_map) \ |
259 V(foreign_map) \ | 247 V(foreign_map) \ |
260 V(neander_map) | 248 V(neander_map) |
261 | 249 |
262 #define INTERNALIZED_STRING_LIST(V) \ | 250 #define INTERNALIZED_STRING_LIST(V) \ |
263 V(Object_string, "Object") \ | 251 V(Object_string, "Object") \ |
264 V(proto_string, "__proto__") \ | 252 V(proto_string, "__proto__") \ |
265 V(arguments_string, "arguments") \ | 253 V(arguments_string, "arguments") \ |
266 V(Arguments_string, "Arguments") \ | 254 V(Arguments_string, "Arguments") \ |
267 V(caller_string, "caller") \ | 255 V(caller_string, "caller") \ |
268 V(boolean_string, "boolean") \ | 256 V(boolean_string, "boolean") \ |
269 V(Boolean_string, "Boolean") \ | 257 V(Boolean_string, "Boolean") \ |
270 V(callee_string, "callee") \ | 258 V(callee_string, "callee") \ |
271 V(constructor_string, "constructor") \ | 259 V(constructor_string, "constructor") \ |
272 V(dot_result_string, ".result") \ | 260 V(dot_result_string, ".result") \ |
273 V(dot_for_string, ".for.") \ | 261 V(dot_for_string, ".for.") \ |
274 V(eval_string, "eval") \ | 262 V(eval_string, "eval") \ |
275 V(empty_string, "") \ | 263 V(empty_string, "") \ |
276 V(function_string, "function") \ | 264 V(function_string, "function") \ |
277 V(Function_string, "Function") \ | 265 V(Function_string, "Function") \ |
278 V(length_string, "length") \ | 266 V(length_string, "length") \ |
279 V(name_string, "name") \ | 267 V(name_string, "name") \ |
280 V(null_string, "null") \ | 268 V(null_string, "null") \ |
281 V(number_string, "number") \ | 269 V(number_string, "number") \ |
282 V(Number_string, "Number") \ | 270 V(Number_string, "Number") \ |
283 V(nan_string, "NaN") \ | 271 V(nan_string, "NaN") \ |
284 V(source_string, "source") \ | 272 V(source_string, "source") \ |
285 V(source_url_string, "source_url") \ | 273 V(source_url_string, "source_url") \ |
286 V(source_mapping_url_string, "source_mapping_url") \ | 274 V(source_mapping_url_string, "source_mapping_url") \ |
287 V(global_string, "global") \ | 275 V(global_string, "global") \ |
288 V(ignore_case_string, "ignoreCase") \ | 276 V(ignore_case_string, "ignoreCase") \ |
289 V(multiline_string, "multiline") \ | 277 V(multiline_string, "multiline") \ |
290 V(sticky_string, "sticky") \ | 278 V(sticky_string, "sticky") \ |
291 V(harmony_regexps_string, "harmony_regexps") \ | 279 V(harmony_regexps_string, "harmony_regexps") \ |
292 V(input_string, "input") \ | 280 V(input_string, "input") \ |
293 V(index_string, "index") \ | 281 V(index_string, "index") \ |
294 V(last_index_string, "lastIndex") \ | 282 V(last_index_string, "lastIndex") \ |
295 V(object_string, "object") \ | 283 V(object_string, "object") \ |
296 V(prototype_string, "prototype") \ | 284 V(prototype_string, "prototype") \ |
297 V(string_string, "string") \ | 285 V(string_string, "string") \ |
298 V(String_string, "String") \ | 286 V(String_string, "String") \ |
299 V(symbol_string, "symbol") \ | 287 V(symbol_string, "symbol") \ |
300 V(Symbol_string, "Symbol") \ | 288 V(Symbol_string, "Symbol") \ |
301 V(Map_string, "Map") \ | 289 V(Map_string, "Map") \ |
302 V(Set_string, "Set") \ | 290 V(Set_string, "Set") \ |
303 V(WeakMap_string, "WeakMap") \ | 291 V(WeakMap_string, "WeakMap") \ |
304 V(WeakSet_string, "WeakSet") \ | 292 V(WeakSet_string, "WeakSet") \ |
305 V(for_string, "for") \ | 293 V(for_string, "for") \ |
306 V(for_api_string, "for_api") \ | 294 V(for_api_string, "for_api") \ |
307 V(for_intern_string, "for_intern") \ | 295 V(for_intern_string, "for_intern") \ |
308 V(private_api_string, "private_api") \ | 296 V(private_api_string, "private_api") \ |
309 V(private_intern_string, "private_intern") \ | 297 V(private_intern_string, "private_intern") \ |
310 V(Date_string, "Date") \ | 298 V(Date_string, "Date") \ |
311 V(char_at_string, "CharAt") \ | 299 V(char_at_string, "CharAt") \ |
312 V(undefined_string, "undefined") \ | 300 V(undefined_string, "undefined") \ |
313 V(value_of_string, "valueOf") \ | 301 V(value_of_string, "valueOf") \ |
314 V(stack_string, "stack") \ | 302 V(stack_string, "stack") \ |
315 V(toJSON_string, "toJSON") \ | 303 V(toJSON_string, "toJSON") \ |
316 V(KeyedLoadMonomorphic_string, "KeyedLoadMonomorphic") \ | 304 V(KeyedLoadMonomorphic_string, "KeyedLoadMonomorphic") \ |
317 V(KeyedStoreMonomorphic_string, "KeyedStoreMonomorphic") \ | 305 V(KeyedStoreMonomorphic_string, "KeyedStoreMonomorphic") \ |
318 V(stack_overflow_string, "kStackOverflowBoilerplate") \ | 306 V(stack_overflow_string, "kStackOverflowBoilerplate") \ |
319 V(illegal_access_string, "illegal access") \ | 307 V(illegal_access_string, "illegal access") \ |
320 V(cell_value_string, "%cell_value") \ | 308 V(cell_value_string, "%cell_value") \ |
321 V(illegal_argument_string, "illegal argument") \ | 309 V(illegal_argument_string, "illegal argument") \ |
322 V(identity_hash_string, "v8::IdentityHash") \ | 310 V(identity_hash_string, "v8::IdentityHash") \ |
323 V(closure_string, "(closure)") \ | 311 V(closure_string, "(closure)") \ |
324 V(dot_string, ".") \ | 312 V(dot_string, ".") \ |
325 V(compare_ic_string, "==") \ | 313 V(compare_ic_string, "==") \ |
326 V(strict_compare_ic_string, "===") \ | 314 V(strict_compare_ic_string, "===") \ |
327 V(infinity_string, "Infinity") \ | 315 V(infinity_string, "Infinity") \ |
328 V(minus_infinity_string, "-Infinity") \ | 316 V(minus_infinity_string, "-Infinity") \ |
329 V(query_colon_string, "(?:)") \ | 317 V(query_colon_string, "(?:)") \ |
330 V(Generator_string, "Generator") \ | 318 V(Generator_string, "Generator") \ |
331 V(throw_string, "throw") \ | 319 V(throw_string, "throw") \ |
332 V(done_string, "done") \ | 320 V(done_string, "done") \ |
333 V(value_string, "value") \ | 321 V(value_string, "value") \ |
334 V(next_string, "next") \ | 322 V(next_string, "next") \ |
335 V(byte_length_string, "byteLength") \ | 323 V(byte_length_string, "byteLength") \ |
336 V(byte_offset_string, "byteOffset") \ | 324 V(byte_offset_string, "byteOffset") |
337 V(intl_initialized_marker_string, "v8::intl_initialized_marker") \ | 325 |
338 V(intl_impl_object_string, "v8::intl_object") | 326 #define PRIVATE_SYMBOL_LIST(V) \ |
| 327 V(frozen_symbol) \ |
| 328 V(nonexistent_symbol) \ |
| 329 V(elements_transition_symbol) \ |
| 330 V(observed_symbol) \ |
| 331 V(uninitialized_symbol) \ |
| 332 V(megamorphic_symbol) \ |
| 333 V(premonomorphic_symbol) \ |
| 334 V(generic_symbol) \ |
| 335 V(stack_trace_symbol) \ |
| 336 V(detailed_stack_trace_symbol) \ |
| 337 V(normal_ic_symbol) \ |
| 338 V(home_object_symbol) \ |
| 339 V(intl_initialized_marker_symbol) \ |
| 340 V(intl_impl_object_symbol) |
339 | 341 |
340 // Forward declarations. | 342 // Forward declarations. |
341 class HeapStats; | 343 class HeapStats; |
342 class Isolate; | 344 class Isolate; |
343 class WeakObjectRetainer; | 345 class WeakObjectRetainer; |
344 | 346 |
345 | 347 |
346 typedef String* (*ExternalStringTableUpdaterCallback)(Heap* heap, | 348 typedef String* (*ExternalStringTableUpdaterCallback)(Heap* heap, |
347 Object** pointer); | 349 Object** pointer); |
348 | 350 |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 #define STRUCT_MAP_ACCESSOR(NAME, Name, name) \ | 778 #define STRUCT_MAP_ACCESSOR(NAME, Name, name) \ |
777 Map* name##_map() { return Map::cast(roots_[k##Name##MapRootIndex]); } | 779 Map* name##_map() { return Map::cast(roots_[k##Name##MapRootIndex]); } |
778 STRUCT_LIST(STRUCT_MAP_ACCESSOR) | 780 STRUCT_LIST(STRUCT_MAP_ACCESSOR) |
779 #undef STRUCT_MAP_ACCESSOR | 781 #undef STRUCT_MAP_ACCESSOR |
780 | 782 |
781 #define STRING_ACCESSOR(name, str) \ | 783 #define STRING_ACCESSOR(name, str) \ |
782 String* name() { return String::cast(roots_[k##name##RootIndex]); } | 784 String* name() { return String::cast(roots_[k##name##RootIndex]); } |
783 INTERNALIZED_STRING_LIST(STRING_ACCESSOR) | 785 INTERNALIZED_STRING_LIST(STRING_ACCESSOR) |
784 #undef STRING_ACCESSOR | 786 #undef STRING_ACCESSOR |
785 | 787 |
| 788 #define SYMBOL_ACCESSOR(name) \ |
| 789 Symbol* name() { return Symbol::cast(roots_[k##name##RootIndex]); } |
| 790 PRIVATE_SYMBOL_LIST(SYMBOL_ACCESSOR) |
| 791 #undef SYMBOL_ACCESSOR |
| 792 |
786 // The hidden_string is special because it is the empty string, but does | 793 // The hidden_string is special because it is the empty string, but does |
787 // not match the empty string. | 794 // not match the empty string. |
788 String* hidden_string() { return hidden_string_; } | 795 String* hidden_string() { return hidden_string_; } |
789 | 796 |
790 void set_native_contexts_list(Object* object) { | 797 void set_native_contexts_list(Object* object) { |
791 native_contexts_list_ = object; | 798 native_contexts_list_ = object; |
792 } | 799 } |
793 Object* native_contexts_list() const { return native_contexts_list_; } | 800 Object* native_contexts_list() const { return native_contexts_list_; } |
794 | 801 |
795 void set_array_buffers_list(Object* object) { array_buffers_list_ = object; } | 802 void set_array_buffers_list(Object* object) { array_buffers_list_ = object; } |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 // Declare all the root indices. This defines the root list order. | 1060 // Declare all the root indices. This defines the root list order. |
1054 enum RootListIndex { | 1061 enum RootListIndex { |
1055 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, | 1062 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, |
1056 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) | 1063 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) |
1057 #undef ROOT_INDEX_DECLARATION | 1064 #undef ROOT_INDEX_DECLARATION |
1058 | 1065 |
1059 #define STRING_INDEX_DECLARATION(name, str) k##name##RootIndex, | 1066 #define STRING_INDEX_DECLARATION(name, str) k##name##RootIndex, |
1060 INTERNALIZED_STRING_LIST(STRING_INDEX_DECLARATION) | 1067 INTERNALIZED_STRING_LIST(STRING_INDEX_DECLARATION) |
1061 #undef STRING_DECLARATION | 1068 #undef STRING_DECLARATION |
1062 | 1069 |
| 1070 #define SYMBOL_INDEX_DECLARATION(name) k##name##RootIndex, |
| 1071 PRIVATE_SYMBOL_LIST(SYMBOL_INDEX_DECLARATION) |
| 1072 #undef SYMBOL_INDEX_DECLARATION |
| 1073 |
1063 // Utility type maps | 1074 // Utility type maps |
1064 #define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex, | 1075 #define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex, |
1065 STRUCT_LIST(DECLARE_STRUCT_MAP) | 1076 STRUCT_LIST(DECLARE_STRUCT_MAP) |
1066 #undef DECLARE_STRUCT_MAP | 1077 #undef DECLARE_STRUCT_MAP |
1067 kStringTableRootIndex, | 1078 kStringTableRootIndex, |
1068 | 1079 |
1069 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, | 1080 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, |
1070 SMI_ROOT_LIST(ROOT_INDEX_DECLARATION) | 1081 SMI_ROOT_LIST(ROOT_INDEX_DECLARATION) |
1071 #undef ROOT_INDEX_DECLARATION | 1082 #undef ROOT_INDEX_DECLARATION |
1072 kRootListLength, | 1083 kRootListLength, |
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2493 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2504 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2494 | 2505 |
2495 private: | 2506 private: |
2496 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2507 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2497 }; | 2508 }; |
2498 #endif // DEBUG | 2509 #endif // DEBUG |
2499 } | 2510 } |
2500 } // namespace v8::internal | 2511 } // namespace v8::internal |
2501 | 2512 |
2502 #endif // V8_HEAP_HEAP_H_ | 2513 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |