| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 /* Cluster the most popular ones in a few cache lines here at the top. */ \ | 54 /* Cluster the most popular ones in a few cache lines here at the top. */ \ |
| 55 V(Smi, store_buffer_top, StoreBufferTop) \ | 55 V(Smi, store_buffer_top, StoreBufferTop) \ |
| 56 V(Oddball, undefined_value, UndefinedValue) \ | 56 V(Oddball, undefined_value, UndefinedValue) \ |
| 57 V(Oddball, the_hole_value, TheHoleValue) \ | 57 V(Oddball, the_hole_value, TheHoleValue) \ |
| 58 V(Oddball, null_value, NullValue) \ | 58 V(Oddball, null_value, NullValue) \ |
| 59 V(Oddball, true_value, TrueValue) \ | 59 V(Oddball, true_value, TrueValue) \ |
| 60 V(Oddball, false_value, FalseValue) \ | 60 V(Oddball, false_value, FalseValue) \ |
| 61 V(Map, global_property_cell_map, GlobalPropertyCellMap) \ | 61 V(Map, global_property_cell_map, GlobalPropertyCellMap) \ |
| 62 V(Map, shared_function_info_map, SharedFunctionInfoMap) \ | 62 V(Map, shared_function_info_map, SharedFunctionInfoMap) \ |
| 63 V(Map, meta_map, MetaMap) \ | 63 V(Map, meta_map, MetaMap) \ |
| 64 V(Map, ascii_symbol_map, AsciiSymbolMap) \ | |
| 65 V(Map, ascii_string_map, AsciiStringMap) \ | |
| 66 V(Map, heap_number_map, HeapNumberMap) \ | 64 V(Map, heap_number_map, HeapNumberMap) \ |
| 67 V(Map, native_context_map, NativeContextMap) \ | 65 V(Map, native_context_map, NativeContextMap) \ |
| 68 V(Map, fixed_array_map, FixedArrayMap) \ | 66 V(Map, fixed_array_map, FixedArrayMap) \ |
| 69 V(Map, code_map, CodeMap) \ | 67 V(Map, code_map, CodeMap) \ |
| 70 V(Map, scope_info_map, ScopeInfoMap) \ | 68 V(Map, scope_info_map, ScopeInfoMap) \ |
| 71 V(Map, fixed_cow_array_map, FixedCOWArrayMap) \ | 69 V(Map, fixed_cow_array_map, FixedCOWArrayMap) \ |
| 72 V(Map, fixed_double_array_map, FixedDoubleArrayMap) \ | 70 V(Map, fixed_double_array_map, FixedDoubleArrayMap) \ |
| 73 V(Object, no_interceptor_result_sentinel, NoInterceptorResultSentinel) \ | 71 V(Object, no_interceptor_result_sentinel, NoInterceptorResultSentinel) \ |
| 74 V(Map, hash_table_map, HashTableMap) \ | 72 V(Map, hash_table_map, HashTableMap) \ |
| 75 V(FixedArray, empty_fixed_array, EmptyFixedArray) \ | 73 V(FixedArray, empty_fixed_array, EmptyFixedArray) \ |
| 76 V(ByteArray, empty_byte_array, EmptyByteArray) \ | 74 V(ByteArray, empty_byte_array, EmptyByteArray) \ |
| 77 V(String, empty_string, EmptyString) \ | |
| 78 V(DescriptorArray, empty_descriptor_array, EmptyDescriptorArray) \ | 75 V(DescriptorArray, empty_descriptor_array, EmptyDescriptorArray) \ |
| 79 V(Smi, stack_limit, StackLimit) \ | 76 V(Smi, stack_limit, StackLimit) \ |
| 80 V(Oddball, arguments_marker, ArgumentsMarker) \ | 77 V(Oddball, arguments_marker, ArgumentsMarker) \ |
| 81 /* The first 32 roots above this line should be boring from a GC point of */ \ | 78 /* The first 32 roots above this line should be boring from a GC point of */ \ |
| 82 /* view. This means they are never in new space and never on a page that */ \ | 79 /* view. This means they are never in new space and never on a page that */ \ |
| 83 /* is being compacted. */ \ | 80 /* is being compacted. */ \ |
| 84 V(FixedArray, number_string_cache, NumberStringCache) \ | 81 V(FixedArray, number_string_cache, NumberStringCache) \ |
| 85 V(Object, instanceof_cache_function, InstanceofCacheFunction) \ | 82 V(Object, instanceof_cache_function, InstanceofCacheFunction) \ |
| 86 V(Object, instanceof_cache_map, InstanceofCacheMap) \ | 83 V(Object, instanceof_cache_map, InstanceofCacheMap) \ |
| 87 V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \ | 84 V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \ |
| 88 V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \ | 85 V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \ |
| 89 V(FixedArray, string_split_cache, StringSplitCache) \ | 86 V(FixedArray, string_split_cache, StringSplitCache) \ |
| 90 V(FixedArray, regexp_multiple_cache, RegExpMultipleCache) \ | 87 V(FixedArray, regexp_multiple_cache, RegExpMultipleCache) \ |
| 91 V(Object, termination_exception, TerminationException) \ | 88 V(Object, termination_exception, TerminationException) \ |
| 92 V(Smi, hash_seed, HashSeed) \ | 89 V(Smi, hash_seed, HashSeed) \ |
| 93 V(Map, string_map, StringMap) \ | 90 V(Map, string_map, StringMap) \ |
| 94 V(Map, symbol_map, SymbolMap) \ | 91 V(Map, ascii_string_map, AsciiStringMap) \ |
| 95 V(Map, cons_string_map, ConsStringMap) \ | 92 V(Map, cons_string_map, ConsStringMap) \ |
| 96 V(Map, cons_ascii_string_map, ConsAsciiStringMap) \ | 93 V(Map, cons_ascii_string_map, ConsAsciiStringMap) \ |
| 97 V(Map, sliced_string_map, SlicedStringMap) \ | 94 V(Map, sliced_string_map, SlicedStringMap) \ |
| 98 V(Map, sliced_ascii_string_map, SlicedAsciiStringMap) \ | 95 V(Map, sliced_ascii_string_map, SlicedAsciiStringMap) \ |
| 99 V(Map, cons_symbol_map, ConsSymbolMap) \ | |
| 100 V(Map, cons_ascii_symbol_map, ConsAsciiSymbolMap) \ | |
| 101 V(Map, external_symbol_map, ExternalSymbolMap) \ | |
| 102 V(Map, external_symbol_with_ascii_data_map, ExternalSymbolWithAsciiDataMap) \ | |
| 103 V(Map, external_ascii_symbol_map, ExternalAsciiSymbolMap) \ | |
| 104 V(Map, external_string_map, ExternalStringMap) \ | 96 V(Map, external_string_map, ExternalStringMap) \ |
| 105 V(Map, external_string_with_ascii_data_map, ExternalStringWithAsciiDataMap) \ | 97 V(Map, external_string_with_ascii_data_map, ExternalStringWithAsciiDataMap) \ |
| 106 V(Map, external_ascii_string_map, ExternalAsciiStringMap) \ | 98 V(Map, external_ascii_string_map, ExternalAsciiStringMap) \ |
| 107 V(Map, short_external_symbol_map, ShortExternalSymbolMap) \ | |
| 108 V(Map, \ | |
| 109 short_external_symbol_with_ascii_data_map, \ | |
| 110 ShortExternalSymbolWithAsciiDataMap) \ | |
| 111 V(Map, short_external_ascii_symbol_map, ShortExternalAsciiSymbolMap) \ | |
| 112 V(Map, short_external_string_map, ShortExternalStringMap) \ | 99 V(Map, short_external_string_map, ShortExternalStringMap) \ |
| 113 V(Map, \ | 100 V(Map, \ |
| 114 short_external_string_with_ascii_data_map, \ | 101 short_external_string_with_ascii_data_map, \ |
| 115 ShortExternalStringWithAsciiDataMap) \ | 102 ShortExternalStringWithAsciiDataMap) \ |
| 103 V(Map, internalized_string_map, InternalizedStringMap) \ |
| 104 V(Map, ascii_internalized_string_map, AsciiInternalizedStringMap) \ |
| 105 V(Map, cons_internalized_string_map, ConsInternalizedStringMap) \ |
| 106 V(Map, cons_ascii_internalized_string_map, ConsAsciiInternalizedStringMap) \ |
| 107 V(Map, \ |
| 108 external_internalized_string_map, \ |
| 109 ExternalInternalizedStringMap) \ |
| 110 V(Map, \ |
| 111 external_internalized_string_with_ascii_data_map, \ |
| 112 ExternalInternalizedStringWithAsciiDataMap) \ |
| 113 V(Map, \ |
| 114 external_ascii_internalized_string_map, \ |
| 115 ExternalAsciiInternalizedStringMap) \ |
| 116 V(Map, \ |
| 117 short_external_internalized_string_map, \ |
| 118 ShortExternalInternalizedStringMap) \ |
| 119 V(Map, \ |
| 120 short_external_internalized_string_with_ascii_data_map, \ |
| 121 ShortExternalInternalizedStringWithAsciiDataMap) \ |
| 122 V(Map, \ |
| 123 short_external_ascii_internalized_string_map, \ |
| 124 ShortExternalAsciiInternalizedStringMap) \ |
| 116 V(Map, short_external_ascii_string_map, ShortExternalAsciiStringMap) \ | 125 V(Map, short_external_ascii_string_map, ShortExternalAsciiStringMap) \ |
| 117 V(Map, undetectable_string_map, UndetectableStringMap) \ | 126 V(Map, undetectable_string_map, UndetectableStringMap) \ |
| 118 V(Map, undetectable_ascii_string_map, UndetectableAsciiStringMap) \ | 127 V(Map, undetectable_ascii_string_map, UndetectableAsciiStringMap) \ |
| 119 V(Map, external_pixel_array_map, ExternalPixelArrayMap) \ | 128 V(Map, external_pixel_array_map, ExternalPixelArrayMap) \ |
| 120 V(Map, external_byte_array_map, ExternalByteArrayMap) \ | 129 V(Map, external_byte_array_map, ExternalByteArrayMap) \ |
| 121 V(Map, external_unsigned_byte_array_map, ExternalUnsignedByteArrayMap) \ | 130 V(Map, external_unsigned_byte_array_map, ExternalUnsignedByteArrayMap) \ |
| 122 V(Map, external_short_array_map, ExternalShortArrayMap) \ | 131 V(Map, external_short_array_map, ExternalShortArrayMap) \ |
| 123 V(Map, external_unsigned_short_array_map, ExternalUnsignedShortArrayMap) \ | 132 V(Map, external_unsigned_short_array_map, ExternalUnsignedShortArrayMap) \ |
| 124 V(Map, external_int_array_map, ExternalIntArrayMap) \ | 133 V(Map, external_int_array_map, ExternalIntArrayMap) \ |
| 125 V(Map, external_unsigned_int_array_map, ExternalUnsignedIntArrayMap) \ | 134 V(Map, external_unsigned_int_array_map, ExternalUnsignedIntArrayMap) \ |
| (...skipping 27 matching lines...) Expand all Loading... |
| 153 V(StringDictionary, intrinsic_function_names, IntrinsicFunctionNames) \ | 162 V(StringDictionary, intrinsic_function_names, IntrinsicFunctionNames) \ |
| 154 V(Smi, arguments_adaptor_deopt_pc_offset, ArgumentsAdaptorDeoptPCOffset) \ | 163 V(Smi, arguments_adaptor_deopt_pc_offset, ArgumentsAdaptorDeoptPCOffset) \ |
| 155 V(Smi, construct_stub_deopt_pc_offset, ConstructStubDeoptPCOffset) \ | 164 V(Smi, construct_stub_deopt_pc_offset, ConstructStubDeoptPCOffset) \ |
| 156 V(Smi, getter_stub_deopt_pc_offset, GetterStubDeoptPCOffset) \ | 165 V(Smi, getter_stub_deopt_pc_offset, GetterStubDeoptPCOffset) \ |
| 157 V(Smi, setter_stub_deopt_pc_offset, SetterStubDeoptPCOffset) \ | 166 V(Smi, setter_stub_deopt_pc_offset, SetterStubDeoptPCOffset) \ |
| 158 V(JSObject, observation_state, ObservationState) \ | 167 V(JSObject, observation_state, ObservationState) \ |
| 159 V(Map, external_map, ExternalMap) | 168 V(Map, external_map, ExternalMap) |
| 160 | 169 |
| 161 #define ROOT_LIST(V) \ | 170 #define ROOT_LIST(V) \ |
| 162 STRONG_ROOT_LIST(V) \ | 171 STRONG_ROOT_LIST(V) \ |
| 163 V(SymbolTable, symbol_table, SymbolTable) | 172 V(StringTable, string_table, StringTable) |
| 164 | 173 |
| 165 #define SYMBOL_LIST(V) \ | 174 #define INTERNALIZED_STRING_LIST(V) \ |
| 166 V(Array_symbol, "Array") \ | 175 V(Array_string, "Array") \ |
| 167 V(Object_symbol, "Object") \ | 176 V(Object_string, "Object") \ |
| 168 V(Proto_symbol, "__proto__") \ | 177 V(proto_string, "__proto__") \ |
| 169 V(StringImpl_symbol, "StringImpl") \ | 178 V(StringImpl_string, "StringImpl") \ |
| 170 V(arguments_symbol, "arguments") \ | 179 V(arguments_string, "arguments") \ |
| 171 V(Arguments_symbol, "Arguments") \ | 180 V(Arguments_string, "Arguments") \ |
| 172 V(call_symbol, "call") \ | 181 V(call_string, "call") \ |
| 173 V(apply_symbol, "apply") \ | 182 V(apply_string, "apply") \ |
| 174 V(caller_symbol, "caller") \ | 183 V(caller_string, "caller") \ |
| 175 V(boolean_symbol, "boolean") \ | 184 V(boolean_string, "boolean") \ |
| 176 V(Boolean_symbol, "Boolean") \ | 185 V(Boolean_string, "Boolean") \ |
| 177 V(callee_symbol, "callee") \ | 186 V(callee_string, "callee") \ |
| 178 V(constructor_symbol, "constructor") \ | 187 V(constructor_string, "constructor") \ |
| 179 V(code_symbol, ".code") \ | 188 V(code_string, ".code") \ |
| 180 V(result_symbol, ".result") \ | 189 V(result_string, ".result") \ |
| 181 V(dot_for_symbol, ".for.") \ | 190 V(dot_for_string, ".for.") \ |
| 182 V(catch_var_symbol, ".catch-var") \ | 191 V(catch_var_string, ".catch-var") \ |
| 183 V(empty_symbol, "") \ | 192 V(empty_string, "") \ |
| 184 V(eval_symbol, "eval") \ | 193 V(eval_string, "eval") \ |
| 185 V(function_symbol, "function") \ | 194 V(function_string, "function") \ |
| 186 V(length_symbol, "length") \ | 195 V(length_string, "length") \ |
| 187 V(module_symbol, "module") \ | 196 V(module_string, "module") \ |
| 188 V(name_symbol, "name") \ | 197 V(name_string, "name") \ |
| 189 V(native_symbol, "native") \ | 198 V(native_string, "native") \ |
| 190 V(null_symbol, "null") \ | 199 V(null_string, "null") \ |
| 191 V(number_symbol, "number") \ | 200 V(number_string, "number") \ |
| 192 V(Number_symbol, "Number") \ | 201 V(Number_string, "Number") \ |
| 193 V(nan_symbol, "NaN") \ | 202 V(nan_string, "NaN") \ |
| 194 V(RegExp_symbol, "RegExp") \ | 203 V(RegExp_string, "RegExp") \ |
| 195 V(source_symbol, "source") \ | 204 V(source_string, "source") \ |
| 196 V(global_symbol, "global") \ | 205 V(global_string, "global") \ |
| 197 V(ignore_case_symbol, "ignoreCase") \ | 206 V(ignore_case_string, "ignoreCase") \ |
| 198 V(multiline_symbol, "multiline") \ | 207 V(multiline_string, "multiline") \ |
| 199 V(input_symbol, "input") \ | 208 V(input_string, "input") \ |
| 200 V(index_symbol, "index") \ | 209 V(index_string, "index") \ |
| 201 V(last_index_symbol, "lastIndex") \ | 210 V(last_index_string, "lastIndex") \ |
| 202 V(object_symbol, "object") \ | 211 V(object_string, "object") \ |
| 203 V(prototype_symbol, "prototype") \ | 212 V(prototype_string, "prototype") \ |
| 204 V(string_symbol, "string") \ | 213 V(string_string, "string") \ |
| 205 V(String_symbol, "String") \ | 214 V(String_string, "String") \ |
| 206 V(Date_symbol, "Date") \ | 215 V(Date_string, "Date") \ |
| 207 V(this_symbol, "this") \ | 216 V(this_string, "this") \ |
| 208 V(to_string_symbol, "toString") \ | 217 V(to_string_string, "toString") \ |
| 209 V(char_at_symbol, "CharAt") \ | 218 V(char_at_string, "CharAt") \ |
| 210 V(undefined_symbol, "undefined") \ | 219 V(undefined_string, "undefined") \ |
| 211 V(value_of_symbol, "valueOf") \ | 220 V(value_of_string, "valueOf") \ |
| 212 V(stack_symbol, "stack") \ | 221 V(stack_string, "stack") \ |
| 213 V(InitializeVarGlobal_symbol, "InitializeVarGlobal") \ | 222 V(InitializeVarGlobal_string, "InitializeVarGlobal") \ |
| 214 V(InitializeConstGlobal_symbol, "InitializeConstGlobal") \ | 223 V(InitializeConstGlobal_string, "InitializeConstGlobal") \ |
| 215 V(KeyedLoadElementMonomorphic_symbol, \ | 224 V(KeyedLoadElementMonomorphic_string, \ |
| 216 "KeyedLoadElementMonomorphic") \ | 225 "KeyedLoadElementMonomorphic") \ |
| 217 V(KeyedStoreElementMonomorphic_symbol, \ | 226 V(KeyedStoreElementMonomorphic_string, \ |
| 218 "KeyedStoreElementMonomorphic") \ | 227 "KeyedStoreElementMonomorphic") \ |
| 219 V(KeyedStoreAndGrowElementMonomorphic_symbol, \ | 228 V(KeyedStoreAndGrowElementMonomorphic_string, \ |
| 220 "KeyedStoreAndGrowElementMonomorphic") \ | 229 "KeyedStoreAndGrowElementMonomorphic") \ |
| 221 V(stack_overflow_symbol, "kStackOverflowBoilerplate") \ | 230 V(stack_overflow_string, "kStackOverflowBoilerplate") \ |
| 222 V(illegal_access_symbol, "illegal access") \ | 231 V(illegal_access_string, "illegal access") \ |
| 223 V(out_of_memory_symbol, "out-of-memory") \ | 232 V(out_of_memory_string, "out-of-memory") \ |
| 224 V(illegal_execution_state_symbol, "illegal execution state") \ | 233 V(illegal_execution_state_string, "illegal execution state") \ |
| 225 V(get_symbol, "get") \ | 234 V(get_string, "get") \ |
| 226 V(set_symbol, "set") \ | 235 V(set_string, "set") \ |
| 227 V(map_field_symbol, "%map") \ | 236 V(map_field_string, "%map") \ |
| 228 V(elements_field_symbol, "%elements") \ | 237 V(elements_field_string, "%elements") \ |
| 229 V(length_field_symbol, "%length") \ | 238 V(length_field_string, "%length") \ |
| 230 V(function_class_symbol, "Function") \ | 239 V(function_class_string, "Function") \ |
| 231 V(illegal_argument_symbol, "illegal argument") \ | 240 V(illegal_argument_string, "illegal argument") \ |
| 232 V(MakeReferenceError_symbol, "MakeReferenceError") \ | 241 V(MakeReferenceError_string, "MakeReferenceError") \ |
| 233 V(MakeSyntaxError_symbol, "MakeSyntaxError") \ | 242 V(MakeSyntaxError_string, "MakeSyntaxError") \ |
| 234 V(MakeTypeError_symbol, "MakeTypeError") \ | 243 V(MakeTypeError_string, "MakeTypeError") \ |
| 235 V(invalid_lhs_in_assignment_symbol, "invalid_lhs_in_assignment") \ | 244 V(invalid_lhs_in_assignment_string, "invalid_lhs_in_assignment") \ |
| 236 V(invalid_lhs_in_for_in_symbol, "invalid_lhs_in_for_in") \ | 245 V(invalid_lhs_in_for_in_string, "invalid_lhs_in_for_in") \ |
| 237 V(invalid_lhs_in_postfix_op_symbol, "invalid_lhs_in_postfix_op") \ | 246 V(invalid_lhs_in_postfix_op_string, "invalid_lhs_in_postfix_op") \ |
| 238 V(invalid_lhs_in_prefix_op_symbol, "invalid_lhs_in_prefix_op") \ | 247 V(invalid_lhs_in_prefix_op_string, "invalid_lhs_in_prefix_op") \ |
| 239 V(illegal_return_symbol, "illegal_return") \ | 248 V(illegal_return_string, "illegal_return") \ |
| 240 V(illegal_break_symbol, "illegal_break") \ | 249 V(illegal_break_string, "illegal_break") \ |
| 241 V(illegal_continue_symbol, "illegal_continue") \ | 250 V(illegal_continue_string, "illegal_continue") \ |
| 242 V(unknown_label_symbol, "unknown_label") \ | 251 V(unknown_label_string, "unknown_label") \ |
| 243 V(redeclaration_symbol, "redeclaration") \ | 252 V(redeclaration_string, "redeclaration") \ |
| 244 V(failure_symbol, "<failure>") \ | 253 V(failure_string, "<failure>") \ |
| 245 V(space_symbol, " ") \ | 254 V(space_string, " ") \ |
| 246 V(exec_symbol, "exec") \ | 255 V(exec_string, "exec") \ |
| 247 V(zero_symbol, "0") \ | 256 V(zero_string, "0") \ |
| 248 V(global_eval_symbol, "GlobalEval") \ | 257 V(global_eval_string, "GlobalEval") \ |
| 249 V(identity_hash_symbol, "v8::IdentityHash") \ | 258 V(identity_hash_string, "v8::IdentityHash") \ |
| 250 V(closure_symbol, "(closure)") \ | 259 V(closure_string, "(closure)") \ |
| 251 V(use_strict, "use strict") \ | 260 V(use_strict_string, "use strict") \ |
| 252 V(dot_symbol, ".") \ | 261 V(dot_string, ".") \ |
| 253 V(anonymous_function_symbol, "(anonymous function)") \ | 262 V(anonymous_function_string, "(anonymous function)") \ |
| 254 V(compare_ic_symbol, "==") \ | 263 V(compare_ic_string, "==") \ |
| 255 V(strict_compare_ic_symbol, "===") \ | 264 V(strict_compare_ic_string, "===") \ |
| 256 V(infinity_symbol, "Infinity") \ | 265 V(infinity_string, "Infinity") \ |
| 257 V(minus_infinity_symbol, "-Infinity") \ | 266 V(minus_infinity_string, "-Infinity") \ |
| 258 V(hidden_stack_trace_symbol, "v8::hidden_stack_trace") \ | 267 V(hidden_stack_trace_string, "v8::hidden_stack_trace") \ |
| 259 V(query_colon_symbol, "(?:)") | 268 V(query_colon_string, "(?:)") \ |
| 260 | 269 |
| 261 // Forward declarations. | 270 // Forward declarations. |
| 262 class GCTracer; | 271 class GCTracer; |
| 263 class HeapStats; | 272 class HeapStats; |
| 264 class Isolate; | 273 class Isolate; |
| 265 class WeakObjectRetainer; | 274 class WeakObjectRetainer; |
| 266 | 275 |
| 267 | 276 |
| 268 typedef String* (*ExternalStringTableUpdaterCallback)(Heap* heap, | 277 typedef String* (*ExternalStringTableUpdaterCallback)(Heap* heap, |
| 269 Object** pointer); | 278 Object** pointer); |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 Vector<const char> str, | 762 Vector<const char> str, |
| 754 PretenureFlag pretenure = NOT_TENURED); | 763 PretenureFlag pretenure = NOT_TENURED); |
| 755 MUST_USE_RESULT MaybeObject* AllocateStringFromUtf8Slow( | 764 MUST_USE_RESULT MaybeObject* AllocateStringFromUtf8Slow( |
| 756 Vector<const char> str, | 765 Vector<const char> str, |
| 757 int non_ascii_start, | 766 int non_ascii_start, |
| 758 PretenureFlag pretenure = NOT_TENURED); | 767 PretenureFlag pretenure = NOT_TENURED); |
| 759 MUST_USE_RESULT MaybeObject* AllocateStringFromTwoByte( | 768 MUST_USE_RESULT MaybeObject* AllocateStringFromTwoByte( |
| 760 Vector<const uc16> str, | 769 Vector<const uc16> str, |
| 761 PretenureFlag pretenure = NOT_TENURED); | 770 PretenureFlag pretenure = NOT_TENURED); |
| 762 | 771 |
| 763 // Allocates a symbol in old space based on the character stream. | 772 // Allocates an internalized string in old space based on the character |
| 764 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 773 // stream. Returns Failure::RetryAfterGC(requested_bytes, space) if the |
| 765 // failed. | 774 // allocation failed. |
| 766 // Please note this function does not perform a garbage collection. | 775 // Please note this function does not perform a garbage collection. |
| 767 MUST_USE_RESULT inline MaybeObject* AllocateSymbolFromUtf8( | 776 MUST_USE_RESULT inline MaybeObject* AllocateInternalizedStringFromUtf8( |
| 768 Vector<const char> str, | 777 Vector<const char> str, |
| 769 int chars, | 778 int chars, |
| 770 uint32_t hash_field); | 779 uint32_t hash_field); |
| 771 | 780 |
| 772 MUST_USE_RESULT inline MaybeObject* AllocateOneByteSymbol( | 781 MUST_USE_RESULT inline MaybeObject* AllocateOneByteInternalizedString( |
| 773 Vector<const uint8_t> str, | 782 Vector<const uint8_t> str, |
| 774 uint32_t hash_field); | 783 uint32_t hash_field); |
| 775 | 784 |
| 776 MUST_USE_RESULT inline MaybeObject* AllocateTwoByteSymbol( | 785 MUST_USE_RESULT inline MaybeObject* AllocateTwoByteInternalizedString( |
| 777 Vector<const uc16> str, | 786 Vector<const uc16> str, |
| 778 uint32_t hash_field); | 787 uint32_t hash_field); |
| 779 | 788 |
| 780 template<typename T> | 789 template<typename T> |
| 781 static inline bool IsOneByte(T t, int chars); | 790 static inline bool IsOneByte(T t, int chars); |
| 782 | 791 |
| 783 template<typename T> | 792 template<typename T> |
| 784 MUST_USE_RESULT inline MaybeObject* AllocateInternalSymbol( | 793 MUST_USE_RESULT inline MaybeObject* AllocateInternalizedStringImpl( |
| 785 T t, int chars, uint32_t hash_field); | 794 T t, int chars, uint32_t hash_field); |
| 786 | 795 |
| 787 template<bool is_one_byte, typename T> | 796 template<bool is_one_byte, typename T> |
| 788 MUST_USE_RESULT MaybeObject* AllocateInternalSymbol( | 797 MUST_USE_RESULT MaybeObject* AllocateInternalizedStringImpl( |
| 789 T t, int chars, uint32_t hash_field); | 798 T t, int chars, uint32_t hash_field); |
| 790 | 799 |
| 791 // Allocates and partially initializes a String. There are two String | 800 // Allocates and partially initializes a String. There are two String |
| 792 // encodings: ASCII and two byte. These functions allocate a string of the | 801 // encodings: ASCII and two byte. These functions allocate a string of the |
| 793 // given length and set its map and length fields. The characters of the | 802 // given length and set its map and length fields. The characters of the |
| 794 // string are uninitialized. | 803 // string are uninitialized. |
| 795 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 804 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 796 // failed. | 805 // failed. |
| 797 // Please note this does not perform a garbage collection. | 806 // Please note this does not perform a garbage collection. |
| 798 MUST_USE_RESULT MaybeObject* AllocateRawOneByteString( | 807 MUST_USE_RESULT MaybeObject* AllocateRawOneByteString( |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 Code::Flags flags, | 1084 Code::Flags flags, |
| 1076 Handle<Object> self_reference, | 1085 Handle<Object> self_reference, |
| 1077 bool immovable = false); | 1086 bool immovable = false); |
| 1078 | 1087 |
| 1079 MUST_USE_RESULT MaybeObject* CopyCode(Code* code); | 1088 MUST_USE_RESULT MaybeObject* CopyCode(Code* code); |
| 1080 | 1089 |
| 1081 // Copy the code and scope info part of the code object, but insert | 1090 // Copy the code and scope info part of the code object, but insert |
| 1082 // the provided data as the relocation information. | 1091 // the provided data as the relocation information. |
| 1083 MUST_USE_RESULT MaybeObject* CopyCode(Code* code, Vector<byte> reloc_info); | 1092 MUST_USE_RESULT MaybeObject* CopyCode(Code* code, Vector<byte> reloc_info); |
| 1084 | 1093 |
| 1085 // Finds the symbol for string in the symbol table. | 1094 // Finds the internalized copy for string in the string table. |
| 1086 // If not found, a new symbol is added to the table and returned. | 1095 // If not found, a new string is added to the table and returned. |
| 1087 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation | 1096 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation |
| 1088 // failed. | 1097 // failed. |
| 1089 // Please note this function does not perform a garbage collection. | 1098 // Please note this function does not perform a garbage collection. |
| 1090 MUST_USE_RESULT MaybeObject* LookupUtf8Symbol(Vector<const char> str); | 1099 MUST_USE_RESULT MaybeObject* InternalizeUtf8String(Vector<const char> str); |
| 1091 MUST_USE_RESULT MaybeObject* LookupUtf8Symbol(const char* str) { | 1100 MUST_USE_RESULT MaybeObject* InternalizeUtf8String(const char* str) { |
| 1092 return LookupUtf8Symbol(CStrVector(str)); | 1101 return InternalizeUtf8String(CStrVector(str)); |
| 1093 } | 1102 } |
| 1094 MUST_USE_RESULT MaybeObject* LookupOneByteSymbol(Vector<const uint8_t> str); | 1103 MUST_USE_RESULT MaybeObject* InternalizeOneByteString( |
| 1095 MUST_USE_RESULT MaybeObject* LookupTwoByteSymbol(Vector<const uc16> str); | 1104 Vector<const uint8_t> str); |
| 1096 MUST_USE_RESULT MaybeObject* LookupSymbol(String* str); | 1105 MUST_USE_RESULT MaybeObject* InternalizeTwoByteString(Vector<const uc16> str); |
| 1097 MUST_USE_RESULT MaybeObject* LookupOneByteSymbol( | 1106 MUST_USE_RESULT MaybeObject* InternalizeString(String* str); |
| 1107 MUST_USE_RESULT MaybeObject* InternalizeOneByteString( |
| 1098 Handle<SeqOneByteString> string, int from, int length); | 1108 Handle<SeqOneByteString> string, int from, int length); |
| 1099 | 1109 |
| 1100 bool LookupSymbolIfExists(String* str, String** symbol); | 1110 bool InternalizeStringIfExists(String* str, String** result); |
| 1101 bool LookupTwoCharsSymbolIfExists(String* str, String** symbol); | 1111 bool InternalizeTwoCharsStringIfExists(String* str, String** result); |
| 1102 | 1112 |
| 1103 // Compute the matching symbol map for a string if possible. | 1113 // Compute the matching internalized string map for a string if possible. |
| 1104 // NULL is returned if string is in new space or not flattened. | 1114 // NULL is returned if string is in new space or not flattened. |
| 1105 Map* SymbolMapForString(String* str); | 1115 Map* InternalizedStringMapForString(String* str); |
| 1106 | 1116 |
| 1107 // Tries to flatten a string before compare operation. | 1117 // Tries to flatten a string before compare operation. |
| 1108 // | 1118 // |
| 1109 // Returns a failure in case it was decided that flattening was | 1119 // Returns a failure in case it was decided that flattening was |
| 1110 // necessary and failed. Note, if flattening is not necessary the | 1120 // necessary and failed. Note, if flattening is not necessary the |
| 1111 // string might stay non-flat even when not a failure is returned. | 1121 // string might stay non-flat even when not a failure is returned. |
| 1112 // | 1122 // |
| 1113 // Please note this function does not perform a garbage collection. | 1123 // Please note this function does not perform a garbage collection. |
| 1114 MUST_USE_RESULT inline MaybeObject* PrepareForCompare(String* str); | 1124 MUST_USE_RESULT inline MaybeObject* PrepareForCompare(String* str); |
| 1115 | 1125 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 #undef ROOT_ACCESSOR | 1233 #undef ROOT_ACCESSOR |
| 1224 | 1234 |
| 1225 // Utility type maps | 1235 // Utility type maps |
| 1226 #define STRUCT_MAP_ACCESSOR(NAME, Name, name) \ | 1236 #define STRUCT_MAP_ACCESSOR(NAME, Name, name) \ |
| 1227 Map* name##_map() { \ | 1237 Map* name##_map() { \ |
| 1228 return Map::cast(roots_[k##Name##MapRootIndex]); \ | 1238 return Map::cast(roots_[k##Name##MapRootIndex]); \ |
| 1229 } | 1239 } |
| 1230 STRUCT_LIST(STRUCT_MAP_ACCESSOR) | 1240 STRUCT_LIST(STRUCT_MAP_ACCESSOR) |
| 1231 #undef STRUCT_MAP_ACCESSOR | 1241 #undef STRUCT_MAP_ACCESSOR |
| 1232 | 1242 |
| 1233 #define SYMBOL_ACCESSOR(name, str) String* name() { \ | 1243 #define STRING_ACCESSOR(name, str) String* name() { \ |
| 1234 return String::cast(roots_[k##name##RootIndex]); \ | 1244 return String::cast(roots_[k##name##RootIndex]); \ |
| 1235 } | 1245 } |
| 1236 SYMBOL_LIST(SYMBOL_ACCESSOR) | 1246 INTERNALIZED_STRING_LIST(STRING_ACCESSOR) |
| 1237 #undef SYMBOL_ACCESSOR | 1247 #undef STRING_ACCESSOR |
| 1238 | 1248 |
| 1239 // The hidden_symbol is special because it is the empty string, but does | 1249 // The hidden_string is special because it is the empty string, but does |
| 1240 // not match the empty string. | 1250 // not match the empty string. |
| 1241 String* hidden_symbol() { return hidden_symbol_; } | 1251 String* hidden_string() { return hidden_string_; } |
| 1242 | 1252 |
| 1243 void set_native_contexts_list(Object* object) { | 1253 void set_native_contexts_list(Object* object) { |
| 1244 native_contexts_list_ = object; | 1254 native_contexts_list_ = object; |
| 1245 } | 1255 } |
| 1246 Object* native_contexts_list() { return native_contexts_list_; } | 1256 Object* native_contexts_list() { return native_contexts_list_; } |
| 1247 | 1257 |
| 1248 // Number of mark-sweeps. | 1258 // Number of mark-sweeps. |
| 1249 unsigned int ms_count() { return ms_count_; } | 1259 unsigned int ms_count() { return ms_count_; } |
| 1250 | 1260 |
| 1251 // Iterates over all roots in the heap. | 1261 // Iterates over all roots in the heap. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 #endif | 1367 #endif |
| 1358 #endif | 1368 #endif |
| 1359 } | 1369 } |
| 1360 | 1370 |
| 1361 // Fill in bogus values in from space | 1371 // Fill in bogus values in from space |
| 1362 void ZapFromSpace(); | 1372 void ZapFromSpace(); |
| 1363 | 1373 |
| 1364 // Print short heap statistics. | 1374 // Print short heap statistics. |
| 1365 void PrintShortHeapStatistics(); | 1375 void PrintShortHeapStatistics(); |
| 1366 | 1376 |
| 1367 // Makes a new symbol object | 1377 // Makes a new internalized string object |
| 1368 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 1378 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 1369 // failed. | 1379 // failed. |
| 1370 // Please note this function does not perform a garbage collection. | 1380 // Please note this function does not perform a garbage collection. |
| 1371 MUST_USE_RESULT MaybeObject* CreateSymbol( | 1381 MUST_USE_RESULT MaybeObject* CreateInternalizedString( |
| 1372 const char* str, int length, int hash); | 1382 const char* str, int length, int hash); |
| 1373 MUST_USE_RESULT MaybeObject* CreateSymbol(String* str); | 1383 MUST_USE_RESULT MaybeObject* CreateInternalizedString(String* str); |
| 1374 | 1384 |
| 1375 // Write barrier support for address[offset] = o. | 1385 // Write barrier support for address[offset] = o. |
| 1376 inline void RecordWrite(Address address, int offset); | 1386 inline void RecordWrite(Address address, int offset); |
| 1377 | 1387 |
| 1378 // Write barrier support for address[start : start + len[ = o. | 1388 // Write barrier support for address[start : start + len[ = o. |
| 1379 inline void RecordWrites(Address address, int start, int len); | 1389 inline void RecordWrites(Address address, int start, int len); |
| 1380 | 1390 |
| 1381 // Given an address occupied by a live code object, return that object. | 1391 // Given an address occupied by a live code object, return that object. |
| 1382 Object* FindCodeObject(Address a); | 1392 Object* FindCodeObject(Address a); |
| 1383 | 1393 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 | 1493 |
| 1484 // Implements the corresponding V8 API function. | 1494 // Implements the corresponding V8 API function. |
| 1485 bool IdleNotification(int hint); | 1495 bool IdleNotification(int hint); |
| 1486 | 1496 |
| 1487 // Declare all the root indices. | 1497 // Declare all the root indices. |
| 1488 enum RootListIndex { | 1498 enum RootListIndex { |
| 1489 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, | 1499 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, |
| 1490 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) | 1500 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) |
| 1491 #undef ROOT_INDEX_DECLARATION | 1501 #undef ROOT_INDEX_DECLARATION |
| 1492 | 1502 |
| 1493 #define SYMBOL_INDEX_DECLARATION(name, str) k##name##RootIndex, | 1503 #define STRING_INDEX_DECLARATION(name, str) k##name##RootIndex, |
| 1494 SYMBOL_LIST(SYMBOL_INDEX_DECLARATION) | 1504 INTERNALIZED_STRING_LIST(STRING_INDEX_DECLARATION) |
| 1495 #undef SYMBOL_DECLARATION | 1505 #undef STRING_DECLARATION |
| 1496 | 1506 |
| 1497 // Utility type maps | 1507 // Utility type maps |
| 1498 #define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex, | 1508 #define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex, |
| 1499 STRUCT_LIST(DECLARE_STRUCT_MAP) | 1509 STRUCT_LIST(DECLARE_STRUCT_MAP) |
| 1500 #undef DECLARE_STRUCT_MAP | 1510 #undef DECLARE_STRUCT_MAP |
| 1501 | 1511 |
| 1502 kSymbolTableRootIndex, | 1512 kStringTableRootIndex, |
| 1503 kStrongRootListLength = kSymbolTableRootIndex, | 1513 kStrongRootListLength = kStringTableRootIndex, |
| 1504 kRootListLength | 1514 kRootListLength |
| 1505 }; | 1515 }; |
| 1506 | 1516 |
| 1507 STATIC_CHECK(kUndefinedValueRootIndex == Internals::kUndefinedValueRootIndex); | 1517 STATIC_CHECK(kUndefinedValueRootIndex == Internals::kUndefinedValueRootIndex); |
| 1508 STATIC_CHECK(kNullValueRootIndex == Internals::kNullValueRootIndex); | 1518 STATIC_CHECK(kNullValueRootIndex == Internals::kNullValueRootIndex); |
| 1509 STATIC_CHECK(kTrueValueRootIndex == Internals::kTrueValueRootIndex); | 1519 STATIC_CHECK(kTrueValueRootIndex == Internals::kTrueValueRootIndex); |
| 1510 STATIC_CHECK(kFalseValueRootIndex == Internals::kFalseValueRootIndex); | 1520 STATIC_CHECK(kFalseValueRootIndex == Internals::kFalseValueRootIndex); |
| 1511 STATIC_CHECK(kempty_symbolRootIndex == Internals::kEmptySymbolRootIndex); | 1521 STATIC_CHECK(kempty_stringRootIndex == Internals::kEmptyStringRootIndex); |
| 1512 | 1522 |
| 1513 // Generated code can embed direct references to non-writable roots if | 1523 // Generated code can embed direct references to non-writable roots if |
| 1514 // they are in new space. | 1524 // they are in new space. |
| 1515 static bool RootCanBeWrittenAfterInitialization(RootListIndex root_index); | 1525 static bool RootCanBeWrittenAfterInitialization(RootListIndex root_index); |
| 1516 | 1526 |
| 1517 MUST_USE_RESULT MaybeObject* NumberToString( | 1527 MUST_USE_RESULT MaybeObject* NumberToString( |
| 1518 Object* number, bool check_number_string_cache = true); | 1528 Object* number, bool check_number_string_cache = true); |
| 1519 MUST_USE_RESULT MaybeObject* Uint32ToString( | 1529 MUST_USE_RESULT MaybeObject* Uint32ToString( |
| 1520 uint32_t value, bool check_number_string_cache = true); | 1530 uint32_t value, bool check_number_string_cache = true); |
| 1521 | 1531 |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1907 Object* native_contexts_list_; | 1917 Object* native_contexts_list_; |
| 1908 | 1918 |
| 1909 StoreBufferRebuilder store_buffer_rebuilder_; | 1919 StoreBufferRebuilder store_buffer_rebuilder_; |
| 1910 | 1920 |
| 1911 struct StringTypeTable { | 1921 struct StringTypeTable { |
| 1912 InstanceType type; | 1922 InstanceType type; |
| 1913 int size; | 1923 int size; |
| 1914 RootListIndex index; | 1924 RootListIndex index; |
| 1915 }; | 1925 }; |
| 1916 | 1926 |
| 1917 struct ConstantSymbolTable { | 1927 struct ConstantStringTable { |
| 1918 const char* contents; | 1928 const char* contents; |
| 1919 RootListIndex index; | 1929 RootListIndex index; |
| 1920 }; | 1930 }; |
| 1921 | 1931 |
| 1922 struct StructTable { | 1932 struct StructTable { |
| 1923 InstanceType type; | 1933 InstanceType type; |
| 1924 int size; | 1934 int size; |
| 1925 RootListIndex index; | 1935 RootListIndex index; |
| 1926 }; | 1936 }; |
| 1927 | 1937 |
| 1928 static const StringTypeTable string_type_table[]; | 1938 static const StringTypeTable string_type_table[]; |
| 1929 static const ConstantSymbolTable constant_symbol_table[]; | 1939 static const ConstantStringTable constant_string_table[]; |
| 1930 static const StructTable struct_table[]; | 1940 static const StructTable struct_table[]; |
| 1931 | 1941 |
| 1932 // The special hidden symbol which is an empty string, but does not match | 1942 // The special hidden string which is an empty string, but does not match |
| 1933 // any string when looked up in properties. | 1943 // any string when looked up in properties. |
| 1934 String* hidden_symbol_; | 1944 String* hidden_string_; |
| 1935 | 1945 |
| 1936 // GC callback function, called before and after mark-compact GC. | 1946 // GC callback function, called before and after mark-compact GC. |
| 1937 // Allocations in the callback function are disallowed. | 1947 // Allocations in the callback function are disallowed. |
| 1938 struct GCPrologueCallbackPair { | 1948 struct GCPrologueCallbackPair { |
| 1939 GCPrologueCallbackPair(GCPrologueCallback callback, GCType gc_type) | 1949 GCPrologueCallbackPair(GCPrologueCallback callback, GCType gc_type) |
| 1940 : callback(callback), gc_type(gc_type) { | 1950 : callback(callback), gc_type(gc_type) { |
| 1941 } | 1951 } |
| 1942 bool operator==(const GCPrologueCallbackPair& pair) const { | 1952 bool operator==(const GCPrologueCallbackPair& pair) const { |
| 1943 return pair.callback == callback; | 1953 return pair.callback == callback; |
| 1944 } | 1954 } |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2166 return heap_size_mb / kMbPerMs; | 2176 return heap_size_mb / kMbPerMs; |
| 2167 } | 2177 } |
| 2168 | 2178 |
| 2169 // Returns true if no more GC work is left. | 2179 // Returns true if no more GC work is left. |
| 2170 bool IdleGlobalGC(); | 2180 bool IdleGlobalGC(); |
| 2171 | 2181 |
| 2172 void AdvanceIdleIncrementalMarking(intptr_t step_size); | 2182 void AdvanceIdleIncrementalMarking(intptr_t step_size); |
| 2173 | 2183 |
| 2174 void ClearObjectStats(bool clear_last_time_stats = false); | 2184 void ClearObjectStats(bool clear_last_time_stats = false); |
| 2175 | 2185 |
| 2176 static const int kInitialSymbolTableSize = 2048; | 2186 static const int kInitialStringTableSize = 2048; |
| 2177 static const int kInitialEvalCacheSize = 64; | 2187 static const int kInitialEvalCacheSize = 64; |
| 2178 static const int kInitialNumberStringCacheSize = 256; | 2188 static const int kInitialNumberStringCacheSize = 256; |
| 2179 | 2189 |
| 2180 // Object counts and used memory by InstanceType | 2190 // Object counts and used memory by InstanceType |
| 2181 size_t object_counts_[OBJECT_STATS_COUNT]; | 2191 size_t object_counts_[OBJECT_STATS_COUNT]; |
| 2182 size_t object_counts_last_time_[OBJECT_STATS_COUNT]; | 2192 size_t object_counts_last_time_[OBJECT_STATS_COUNT]; |
| 2183 size_t object_sizes_[OBJECT_STATS_COUNT]; | 2193 size_t object_sizes_[OBJECT_STATS_COUNT]; |
| 2184 size_t object_sizes_last_time_[OBJECT_STATS_COUNT]; | 2194 size_t object_sizes_last_time_[OBJECT_STATS_COUNT]; |
| 2185 | 2195 |
| 2186 // Maximum GC pause. | 2196 // Maximum GC pause. |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2497 | 2507 |
| 2498 // Cache for mapping (map, property name) into descriptor index. | 2508 // Cache for mapping (map, property name) into descriptor index. |
| 2499 // The cache contains both positive and negative results. | 2509 // The cache contains both positive and negative results. |
| 2500 // Descriptor index equals kNotFound means the property is absent. | 2510 // Descriptor index equals kNotFound means the property is absent. |
| 2501 // Cleared at startup and prior to any gc. | 2511 // Cleared at startup and prior to any gc. |
| 2502 class DescriptorLookupCache { | 2512 class DescriptorLookupCache { |
| 2503 public: | 2513 public: |
| 2504 // Lookup descriptor index for (map, name). | 2514 // Lookup descriptor index for (map, name). |
| 2505 // If absent, kAbsent is returned. | 2515 // If absent, kAbsent is returned. |
| 2506 int Lookup(Map* source, String* name) { | 2516 int Lookup(Map* source, String* name) { |
| 2507 if (!StringShape(name).IsSymbol()) return kAbsent; | 2517 if (!StringShape(name).IsInternalized()) return kAbsent; |
| 2508 int index = Hash(source, name); | 2518 int index = Hash(source, name); |
| 2509 Key& key = keys_[index]; | 2519 Key& key = keys_[index]; |
| 2510 if ((key.source == source) && (key.name == name)) return results_[index]; | 2520 if ((key.source == source) && (key.name == name)) return results_[index]; |
| 2511 return kAbsent; | 2521 return kAbsent; |
| 2512 } | 2522 } |
| 2513 | 2523 |
| 2514 // Update an element in the cache. | 2524 // Update an element in the cache. |
| 2515 void Update(Map* source, String* name, int result) { | 2525 void Update(Map* source, String* name, int result) { |
| 2516 ASSERT(result != kAbsent); | 2526 ASSERT(result != kAbsent); |
| 2517 if (StringShape(name).IsSymbol()) { | 2527 if (StringShape(name).IsInternalized()) { |
| 2518 int index = Hash(source, name); | 2528 int index = Hash(source, name); |
| 2519 Key& key = keys_[index]; | 2529 Key& key = keys_[index]; |
| 2520 key.source = source; | 2530 key.source = source; |
| 2521 key.name = name; | 2531 key.name = name; |
| 2522 results_[index] = result; | 2532 results_[index] = result; |
| 2523 } | 2533 } |
| 2524 } | 2534 } |
| 2525 | 2535 |
| 2526 // Clear the cache. | 2536 // Clear the cache. |
| 2527 void Clear(); | 2537 void Clear(); |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2940 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 2950 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
| 2941 | 2951 |
| 2942 private: | 2952 private: |
| 2943 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2953 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2944 }; | 2954 }; |
| 2945 #endif // DEBUG | 2955 #endif // DEBUG |
| 2946 | 2956 |
| 2947 } } // namespace v8::internal | 2957 } } // namespace v8::internal |
| 2948 | 2958 |
| 2949 #endif // V8_HEAP_H_ | 2959 #endif // V8_HEAP_H_ |
| OLD | NEW |