| 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 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2189 heap->CopyBlock(target->address(), source->address(), size); | 2189 heap->CopyBlock(target->address(), source->address(), size); |
| 2190 | 2190 |
| 2191 // Set the forwarding address. | 2191 // Set the forwarding address. |
| 2192 source->set_map_word(MapWord::FromForwardingAddress(target)); | 2192 source->set_map_word(MapWord::FromForwardingAddress(target)); |
| 2193 | 2193 |
| 2194 if (logging_and_profiling_mode == LOGGING_AND_PROFILING_ENABLED) { | 2194 if (logging_and_profiling_mode == LOGGING_AND_PROFILING_ENABLED) { |
| 2195 // Update NewSpace stats if necessary. | 2195 // Update NewSpace stats if necessary. |
| 2196 RecordCopiedObject(heap, target); | 2196 RecordCopiedObject(heap, target); |
| 2197 Isolate* isolate = heap->isolate(); | 2197 Isolate* isolate = heap->isolate(); |
| 2198 HeapProfiler* heap_profiler = isolate->heap_profiler(); | 2198 HeapProfiler* heap_profiler = isolate->heap_profiler(); |
| 2199 if (heap_profiler->is_profiling()) { | 2199 if (heap_profiler->is_tracking_object_moves()) { |
| 2200 heap_profiler->ObjectMoveEvent(source->address(), target->address(), | 2200 heap_profiler->ObjectMoveEvent(source->address(), target->address(), |
| 2201 size); | 2201 size); |
| 2202 } | 2202 } |
| 2203 if (isolate->logger()->is_logging_code_events() || | 2203 if (isolate->logger()->is_logging_code_events() || |
| 2204 isolate->cpu_profiler()->is_profiling()) { | 2204 isolate->cpu_profiler()->is_profiling()) { |
| 2205 if (target->IsSharedFunctionInfo()) { | 2205 if (target->IsSharedFunctionInfo()) { |
| 2206 PROFILE(isolate, SharedFunctionInfoMoveEvent( | 2206 PROFILE(isolate, SharedFunctionInfoMoveEvent( |
| 2207 source->address(), target->address())); | 2207 source->address(), target->address())); |
| 2208 } | 2208 } |
| 2209 } | 2209 } |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2440 LOGGING_AND_PROFILING_ENABLED>::Initialize(); | 2440 LOGGING_AND_PROFILING_ENABLED>::Initialize(); |
| 2441 ScavengingVisitor<IGNORE_MARKS, LOGGING_AND_PROFILING_ENABLED>::Initialize(); | 2441 ScavengingVisitor<IGNORE_MARKS, LOGGING_AND_PROFILING_ENABLED>::Initialize(); |
| 2442 } | 2442 } |
| 2443 | 2443 |
| 2444 | 2444 |
| 2445 void Heap::SelectScavengingVisitorsTable() { | 2445 void Heap::SelectScavengingVisitorsTable() { |
| 2446 bool logging_and_profiling = | 2446 bool logging_and_profiling = |
| 2447 isolate()->logger()->is_logging() || | 2447 isolate()->logger()->is_logging() || |
| 2448 isolate()->cpu_profiler()->is_profiling() || | 2448 isolate()->cpu_profiler()->is_profiling() || |
| 2449 (isolate()->heap_profiler() != NULL && | 2449 (isolate()->heap_profiler() != NULL && |
| 2450 isolate()->heap_profiler()->is_profiling()); | 2450 isolate()->heap_profiler()->is_tracking_object_moves()); |
| 2451 | 2451 |
| 2452 if (!incremental_marking()->IsMarking()) { | 2452 if (!incremental_marking()->IsMarking()) { |
| 2453 if (!logging_and_profiling) { | 2453 if (!logging_and_profiling) { |
| 2454 scavenging_visitors_table_.CopyFrom( | 2454 scavenging_visitors_table_.CopyFrom( |
| 2455 ScavengingVisitor<IGNORE_MARKS, | 2455 ScavengingVisitor<IGNORE_MARKS, |
| 2456 LOGGING_AND_PROFILING_DISABLED>::GetTable()); | 2456 LOGGING_AND_PROFILING_DISABLED>::GetTable()); |
| 2457 } else { | 2457 } else { |
| 2458 scavenging_visitors_table_.CopyFrom( | 2458 scavenging_visitors_table_.CopyFrom( |
| 2459 ScavengingVisitor<IGNORE_MARKS, | 2459 ScavengingVisitor<IGNORE_MARKS, |
| 2460 LOGGING_AND_PROFILING_ENABLED>::GetTable()); | 2460 LOGGING_AND_PROFILING_ENABLED>::GetTable()); |
| (...skipping 2422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4883 // Since we know the clone is allocated in new space, we can copy | 4883 // Since we know the clone is allocated in new space, we can copy |
| 4884 // the contents without worrying about updating the write barrier. | 4884 // the contents without worrying about updating the write barrier. |
| 4885 CopyBlock(HeapObject::cast(clone)->address(), | 4885 CopyBlock(HeapObject::cast(clone)->address(), |
| 4886 source->address(), | 4886 source->address(), |
| 4887 object_size); | 4887 object_size); |
| 4888 | 4888 |
| 4889 if (site != NULL) { | 4889 if (site != NULL) { |
| 4890 AllocationMemento* alloc_memento = reinterpret_cast<AllocationMemento*>( | 4890 AllocationMemento* alloc_memento = reinterpret_cast<AllocationMemento*>( |
| 4891 reinterpret_cast<Address>(clone) + object_size); | 4891 reinterpret_cast<Address>(clone) + object_size); |
| 4892 InitializeAllocationMemento(alloc_memento, site); | 4892 InitializeAllocationMemento(alloc_memento, site); |
| 4893 HeapProfiler* profiler = isolate()->heap_profiler(); | |
| 4894 if (profiler->is_tracking_allocations()) { | |
| 4895 profiler->UpdateObjectSizeEvent(HeapObject::cast(clone)->address(), | |
| 4896 object_size); | |
| 4897 profiler->NewObjectEvent(alloc_memento->address(), | |
| 4898 AllocationMemento::kSize); | |
| 4899 } | |
| 4900 } | 4893 } |
| 4901 } | 4894 } |
| 4902 | 4895 |
| 4903 SLOW_ASSERT( | 4896 SLOW_ASSERT( |
| 4904 JSObject::cast(clone)->GetElementsKind() == source->GetElementsKind()); | 4897 JSObject::cast(clone)->GetElementsKind() == source->GetElementsKind()); |
| 4905 FixedArrayBase* elements = FixedArrayBase::cast(source->elements()); | 4898 FixedArrayBase* elements = FixedArrayBase::cast(source->elements()); |
| 4906 FixedArray* properties = FixedArray::cast(source->properties()); | 4899 FixedArray* properties = FixedArray::cast(source->properties()); |
| 4907 // Update elements if necessary. | 4900 // Update elements if necessary. |
| 4908 if (elements->length() > 0) { | 4901 if (elements->length() > 0) { |
| 4909 Object* elem; | 4902 Object* elem; |
| (...skipping 3090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8000 static_cast<int>(object_sizes_last_time_[index])); | 7993 static_cast<int>(object_sizes_last_time_[index])); |
| 8001 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 7994 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 8002 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7995 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 8003 | 7996 |
| 8004 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7997 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 8005 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7998 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 8006 ClearObjectStats(); | 7999 ClearObjectStats(); |
| 8007 } | 8000 } |
| 8008 | 8001 |
| 8009 } } // namespace v8::internal | 8002 } } // namespace v8::internal |
| OLD | NEW |