OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 V(Map, external_float_array_map, ExternalFloatArrayMap) \ | 86 V(Map, external_float_array_map, ExternalFloatArrayMap) \ |
87 V(Map, context_map, ContextMap) \ | 87 V(Map, context_map, ContextMap) \ |
88 V(Map, catch_context_map, CatchContextMap) \ | 88 V(Map, catch_context_map, CatchContextMap) \ |
89 V(Map, code_map, CodeMap) \ | 89 V(Map, code_map, CodeMap) \ |
90 V(Map, oddball_map, OddballMap) \ | 90 V(Map, oddball_map, OddballMap) \ |
91 V(Map, global_property_cell_map, GlobalPropertyCellMap) \ | 91 V(Map, global_property_cell_map, GlobalPropertyCellMap) \ |
92 V(Map, shared_function_info_map, SharedFunctionInfoMap) \ | 92 V(Map, shared_function_info_map, SharedFunctionInfoMap) \ |
93 V(Map, proxy_map, ProxyMap) \ | 93 V(Map, proxy_map, ProxyMap) \ |
94 V(Object, nan_value, NanValue) \ | 94 V(Object, nan_value, NanValue) \ |
95 V(Object, minus_zero_value, MinusZeroValue) \ | 95 V(Object, minus_zero_value, MinusZeroValue) \ |
| 96 V(Object, instanceof_cache_function, InstanceofCacheFunction) \ |
| 97 V(Object, instanceof_cache_map, InstanceofCacheMap) \ |
| 98 V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \ |
96 V(String, empty_string, EmptyString) \ | 99 V(String, empty_string, EmptyString) \ |
97 V(DescriptorArray, empty_descriptor_array, EmptyDescriptorArray) \ | 100 V(DescriptorArray, empty_descriptor_array, EmptyDescriptorArray) \ |
98 V(Map, neander_map, NeanderMap) \ | 101 V(Map, neander_map, NeanderMap) \ |
99 V(JSObject, message_listeners, MessageListeners) \ | 102 V(JSObject, message_listeners, MessageListeners) \ |
100 V(Proxy, prototype_accessors, PrototypeAccessors) \ | 103 V(Proxy, prototype_accessors, PrototypeAccessors) \ |
101 V(NumberDictionary, code_stubs, CodeStubs) \ | 104 V(NumberDictionary, code_stubs, CodeStubs) \ |
102 V(NumberDictionary, non_monomorphic_cache, NonMonomorphicCache) \ | 105 V(NumberDictionary, non_monomorphic_cache, NonMonomorphicCache) \ |
103 V(Code, js_entry_code, JsEntryCode) \ | 106 V(Code, js_entry_code, JsEntryCode) \ |
104 V(Code, js_construct_entry_code, JsConstructEntryCode) \ | 107 V(Code, js_construct_entry_code, JsConstructEntryCode) \ |
105 V(Code, c_entry_code, CEntryCode) \ | 108 V(Code, c_entry_code, CEntryCode) \ |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 // Allocates a partial map for bootstrapping. | 357 // Allocates a partial map for bootstrapping. |
355 static Object* AllocatePartialMap(InstanceType instance_type, | 358 static Object* AllocatePartialMap(InstanceType instance_type, |
356 int instance_size); | 359 int instance_size); |
357 | 360 |
358 // Allocate a map for the specified function | 361 // Allocate a map for the specified function |
359 static Object* AllocateInitialMap(JSFunction* fun); | 362 static Object* AllocateInitialMap(JSFunction* fun); |
360 | 363 |
361 // Allocates an empty code cache. | 364 // Allocates an empty code cache. |
362 static Object* AllocateCodeCache(); | 365 static Object* AllocateCodeCache(); |
363 | 366 |
| 367 // Clear the Instanceof cache (used when a prototype changes). |
| 368 static void ClearInstanceofCache() { |
| 369 set_instanceof_cache_function(the_hole_value()); |
| 370 } |
| 371 |
364 // Allocates and fully initializes a String. There are two String | 372 // Allocates and fully initializes a String. There are two String |
365 // encodings: ASCII and two byte. One should choose between the three string | 373 // encodings: ASCII and two byte. One should choose between the three string |
366 // allocation functions based on the encoding of the string buffer used to | 374 // allocation functions based on the encoding of the string buffer used to |
367 // initialized the string. | 375 // initialized the string. |
368 // - ...FromAscii initializes the string from a buffer that is ASCII | 376 // - ...FromAscii initializes the string from a buffer that is ASCII |
369 // encoded (it does not check that the buffer is ASCII encoded) and the | 377 // encoded (it does not check that the buffer is ASCII encoded) and the |
370 // result will be ASCII encoded. | 378 // result will be ASCII encoded. |
371 // - ...FromUTF8 initializes the string from a buffer that is UTF-8 | 379 // - ...FromUTF8 initializes the string from a buffer that is UTF-8 |
372 // encoded. If the characters are all single-byte characters, the | 380 // encoded. If the characters are all single-byte characters, the |
373 // result will be ASCII encoded, otherwise it will converted to two | 381 // result will be ASCII encoded, otherwise it will converted to two |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 static Address DoScavenge(ObjectVisitor* scavenge_visitor, | 1172 static Address DoScavenge(ObjectVisitor* scavenge_visitor, |
1165 Address new_space_front); | 1173 Address new_space_front); |
1166 | 1174 |
1167 // Performs a major collection in the whole heap. | 1175 // Performs a major collection in the whole heap. |
1168 static void MarkCompact(GCTracer* tracer); | 1176 static void MarkCompact(GCTracer* tracer); |
1169 | 1177 |
1170 // Code to be run before and after mark-compact. | 1178 // Code to be run before and after mark-compact. |
1171 static void MarkCompactPrologue(bool is_compacting); | 1179 static void MarkCompactPrologue(bool is_compacting); |
1172 static void MarkCompactEpilogue(bool is_compacting); | 1180 static void MarkCompactEpilogue(bool is_compacting); |
1173 | 1181 |
| 1182 // Completely clear the Instanceof cache (to stop it keeping objects alive |
| 1183 // around a GC). |
| 1184 static void CompletelyClearInstanceofCache() { |
| 1185 set_instanceof_cache_map(the_hole_value()); |
| 1186 set_instanceof_cache_function(the_hole_value()); |
| 1187 } |
| 1188 |
1174 // Helper function used by CopyObject to copy a source object to an | 1189 // Helper function used by CopyObject to copy a source object to an |
1175 // allocated target object and update the forwarding pointer in the source | 1190 // allocated target object and update the forwarding pointer in the source |
1176 // object. Returns the target object. | 1191 // object. Returns the target object. |
1177 static inline HeapObject* MigrateObject(HeapObject* source, | 1192 static inline HeapObject* MigrateObject(HeapObject* source, |
1178 HeapObject* target, | 1193 HeapObject* target, |
1179 int size); | 1194 int size); |
1180 | 1195 |
1181 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) | 1196 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) |
1182 // Record the copy of an object in the NewSpace's statistics. | 1197 // Record the copy of an object in the NewSpace's statistics. |
1183 static void RecordCopiedObject(HeapObject* obj); | 1198 static void RecordCopiedObject(HeapObject* obj); |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1818 | 1833 |
1819 // To speed up scavenge collections new space string are kept | 1834 // To speed up scavenge collections new space string are kept |
1820 // separate from old space strings. | 1835 // separate from old space strings. |
1821 static List<Object*> new_space_strings_; | 1836 static List<Object*> new_space_strings_; |
1822 static List<Object*> old_space_strings_; | 1837 static List<Object*> old_space_strings_; |
1823 }; | 1838 }; |
1824 | 1839 |
1825 } } // namespace v8::internal | 1840 } } // namespace v8::internal |
1826 | 1841 |
1827 #endif // V8_HEAP_H_ | 1842 #endif // V8_HEAP_H_ |
OLD | NEW |