| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 V(HeapNumber, infinity_value, InfinityValue) \ | 168 V(HeapNumber, infinity_value, InfinityValue) \ |
| 169 V(HeapNumber, minus_zero_value, MinusZeroValue) \ | 169 V(HeapNumber, minus_zero_value, MinusZeroValue) \ |
| 170 V(Map, neander_map, NeanderMap) \ | 170 V(Map, neander_map, NeanderMap) \ |
| 171 V(JSObject, message_listeners, MessageListeners) \ | 171 V(JSObject, message_listeners, MessageListeners) \ |
| 172 V(UnseededNumberDictionary, code_stubs, CodeStubs) \ | 172 V(UnseededNumberDictionary, code_stubs, CodeStubs) \ |
| 173 V(UnseededNumberDictionary, non_monomorphic_cache, NonMonomorphicCache) \ | 173 V(UnseededNumberDictionary, non_monomorphic_cache, NonMonomorphicCache) \ |
| 174 V(PolymorphicCodeCache, polymorphic_code_cache, PolymorphicCodeCache) \ | 174 V(PolymorphicCodeCache, polymorphic_code_cache, PolymorphicCodeCache) \ |
| 175 V(Code, js_entry_code, JsEntryCode) \ | 175 V(Code, js_entry_code, JsEntryCode) \ |
| 176 V(Code, js_construct_entry_code, JsConstructEntryCode) \ | 176 V(Code, js_construct_entry_code, JsConstructEntryCode) \ |
| 177 V(FixedArray, natives_source_cache, NativesSourceCache) \ | 177 V(FixedArray, natives_source_cache, NativesSourceCache) \ |
| 178 V(Object, last_script_id, LastScriptId) \ | 178 V(Smi, last_script_id, LastScriptId) \ |
| 179 V(Script, empty_script, EmptyScript) \ | 179 V(Script, empty_script, EmptyScript) \ |
| 180 V(Smi, real_stack_limit, RealStackLimit) \ | 180 V(Smi, real_stack_limit, RealStackLimit) \ |
| 181 V(NameDictionary, intrinsic_function_names, IntrinsicFunctionNames) \ | 181 V(NameDictionary, intrinsic_function_names, IntrinsicFunctionNames) \ |
| 182 V(Smi, arguments_adaptor_deopt_pc_offset, ArgumentsAdaptorDeoptPCOffset) \ | 182 V(Smi, arguments_adaptor_deopt_pc_offset, ArgumentsAdaptorDeoptPCOffset) \ |
| 183 V(Smi, construct_stub_deopt_pc_offset, ConstructStubDeoptPCOffset) \ | 183 V(Smi, construct_stub_deopt_pc_offset, ConstructStubDeoptPCOffset) \ |
| 184 V(Smi, getter_stub_deopt_pc_offset, GetterStubDeoptPCOffset) \ | 184 V(Smi, getter_stub_deopt_pc_offset, GetterStubDeoptPCOffset) \ |
| 185 V(Smi, setter_stub_deopt_pc_offset, SetterStubDeoptPCOffset) \ | 185 V(Smi, setter_stub_deopt_pc_offset, SetterStubDeoptPCOffset) \ |
| 186 V(JSObject, observation_state, ObservationState) \ | 186 V(JSObject, observation_state, ObservationState) \ |
| 187 V(Map, external_map, ExternalMap) \ | 187 V(Map, external_map, ExternalMap) \ |
| 188 V(Symbol, frozen_symbol, FrozenSymbol) \ | 188 V(Symbol, frozen_symbol, FrozenSymbol) \ |
| (...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1433 } | 1433 } |
| 1434 | 1434 |
| 1435 void public_set_empty_script(Script* script) { | 1435 void public_set_empty_script(Script* script) { |
| 1436 roots_[kEmptyScriptRootIndex] = script; | 1436 roots_[kEmptyScriptRootIndex] = script; |
| 1437 } | 1437 } |
| 1438 | 1438 |
| 1439 void public_set_store_buffer_top(Address* top) { | 1439 void public_set_store_buffer_top(Address* top) { |
| 1440 roots_[kStoreBufferTopRootIndex] = reinterpret_cast<Smi*>(top); | 1440 roots_[kStoreBufferTopRootIndex] = reinterpret_cast<Smi*>(top); |
| 1441 } | 1441 } |
| 1442 | 1442 |
| 1443 // Update the next script id. | |
| 1444 inline void SetLastScriptId(Object* last_script_id); | |
| 1445 | |
| 1446 // Generated code can embed this address to get access to the roots. | 1443 // Generated code can embed this address to get access to the roots. |
| 1447 Object** roots_array_start() { return roots_; } | 1444 Object** roots_array_start() { return roots_; } |
| 1448 | 1445 |
| 1449 Address* store_buffer_top_address() { | 1446 Address* store_buffer_top_address() { |
| 1450 return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]); | 1447 return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]); |
| 1451 } | 1448 } |
| 1452 | 1449 |
| 1453 // Get address of native contexts list for serialization support. | 1450 // Get address of native contexts list for serialization support. |
| 1454 Object** native_contexts_list_address() { | 1451 Object** native_contexts_list_address() { |
| 1455 return &native_contexts_list_; | 1452 return &native_contexts_list_; |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1866 intptr_t amount_of_external_allocated_memory() { | 1863 intptr_t amount_of_external_allocated_memory() { |
| 1867 return amount_of_external_allocated_memory_; | 1864 return amount_of_external_allocated_memory_; |
| 1868 } | 1865 } |
| 1869 | 1866 |
| 1870 // ObjectStats are kept in two arrays, counts and sizes. Related stats are | 1867 // ObjectStats are kept in two arrays, counts and sizes. Related stats are |
| 1871 // stored in a contiguous linear buffer. Stats groups are stored one after | 1868 // stored in a contiguous linear buffer. Stats groups are stored one after |
| 1872 // another. | 1869 // another. |
| 1873 enum { | 1870 enum { |
| 1874 FIRST_CODE_KIND_SUB_TYPE = LAST_TYPE + 1, | 1871 FIRST_CODE_KIND_SUB_TYPE = LAST_TYPE + 1, |
| 1875 FIRST_FIXED_ARRAY_SUB_TYPE = | 1872 FIRST_FIXED_ARRAY_SUB_TYPE = |
| 1876 FIRST_CODE_KIND_SUB_TYPE + Code::LAST_CODE_KIND + 1, | 1873 FIRST_CODE_KIND_SUB_TYPE + Code::NUMBER_OF_KINDS, |
| 1877 OBJECT_STATS_COUNT = | 1874 OBJECT_STATS_COUNT = |
| 1878 FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1 | 1875 FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1 |
| 1879 }; | 1876 }; |
| 1880 | 1877 |
| 1881 void RecordObjectStats(InstanceType type, int sub_type, size_t size) { | 1878 void RecordObjectStats(InstanceType type, int sub_type, size_t size) { |
| 1882 ASSERT(type <= LAST_TYPE); | 1879 ASSERT(type <= LAST_TYPE); |
| 1883 if (sub_type < 0) { | 1880 if (sub_type < 0) { |
| 1884 object_counts_[type]++; | 1881 object_counts_[type]++; |
| 1885 object_sizes_[type] += size; | 1882 object_sizes_[type] += size; |
| 1886 } else { | 1883 } else { |
| 1887 if (type == CODE_TYPE) { | 1884 if (type == CODE_TYPE) { |
| 1888 ASSERT(sub_type <= Code::LAST_CODE_KIND); | 1885 ASSERT(sub_type < Code::NUMBER_OF_KINDS); |
| 1889 object_counts_[FIRST_CODE_KIND_SUB_TYPE + sub_type]++; | 1886 object_counts_[FIRST_CODE_KIND_SUB_TYPE + sub_type]++; |
| 1890 object_sizes_[FIRST_CODE_KIND_SUB_TYPE + sub_type] += size; | 1887 object_sizes_[FIRST_CODE_KIND_SUB_TYPE + sub_type] += size; |
| 1891 } else if (type == FIXED_ARRAY_TYPE) { | 1888 } else if (type == FIXED_ARRAY_TYPE) { |
| 1892 ASSERT(sub_type <= LAST_FIXED_ARRAY_SUB_TYPE); | 1889 ASSERT(sub_type <= LAST_FIXED_ARRAY_SUB_TYPE); |
| 1893 object_counts_[FIRST_FIXED_ARRAY_SUB_TYPE + sub_type]++; | 1890 object_counts_[FIRST_FIXED_ARRAY_SUB_TYPE + sub_type]++; |
| 1894 object_sizes_[FIRST_FIXED_ARRAY_SUB_TYPE + sub_type] += size; | 1891 object_sizes_[FIRST_FIXED_ARRAY_SUB_TYPE + sub_type] += size; |
| 1895 } | 1892 } |
| 1896 } | 1893 } |
| 1897 } | 1894 } |
| 1898 | 1895 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2185 | 2182 |
| 2186 // Performs a major collection in the whole heap. | 2183 // Performs a major collection in the whole heap. |
| 2187 void MarkCompact(GCTracer* tracer); | 2184 void MarkCompact(GCTracer* tracer); |
| 2188 | 2185 |
| 2189 // Code to be run before and after mark-compact. | 2186 // Code to be run before and after mark-compact. |
| 2190 void MarkCompactPrologue(); | 2187 void MarkCompactPrologue(); |
| 2191 | 2188 |
| 2192 void ProcessNativeContexts(WeakObjectRetainer* retainer, bool record_slots); | 2189 void ProcessNativeContexts(WeakObjectRetainer* retainer, bool record_slots); |
| 2193 void ProcessArrayBuffers(WeakObjectRetainer* retainer, bool record_slots); | 2190 void ProcessArrayBuffers(WeakObjectRetainer* retainer, bool record_slots); |
| 2194 | 2191 |
| 2192 // Called on heap tear-down. |
| 2193 void TearDownArrayBuffers(); |
| 2194 |
| 2195 // Record statistics before and after garbage collection. | 2195 // Record statistics before and after garbage collection. |
| 2196 void ReportStatisticsBeforeGC(); | 2196 void ReportStatisticsBeforeGC(); |
| 2197 void ReportStatisticsAfterGC(); | 2197 void ReportStatisticsAfterGC(); |
| 2198 | 2198 |
| 2199 // Slow part of scavenge object. | 2199 // Slow part of scavenge object. |
| 2200 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object); | 2200 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object); |
| 2201 | 2201 |
| 2202 // Initializes a function with a shared part and prototype. | 2202 // Initializes a function with a shared part and prototype. |
| 2203 // Note: this code was factored out of AllocateFunction such that | 2203 // Note: this code was factored out of AllocateFunction such that |
| 2204 // other parts of the VM could use it. Specifically, a function that creates | 2204 // other parts of the VM could use it. Specifically, a function that creates |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3074 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 3074 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 3075 | 3075 |
| 3076 private: | 3076 private: |
| 3077 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 3077 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 3078 }; | 3078 }; |
| 3079 #endif // DEBUG | 3079 #endif // DEBUG |
| 3080 | 3080 |
| 3081 } } // namespace v8::internal | 3081 } } // namespace v8::internal |
| 3082 | 3082 |
| 3083 #endif // V8_HEAP_H_ | 3083 #endif // V8_HEAP_H_ |
| OLD | NEW |