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