Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: src/mark-compact.cc

Issue 22852024: Track JS allocations as they arrive with no affection on performance when tracking is switched off (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Make separate API for JS allocations recording, add example of checking JS allocations recording in… Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2724 matching lines...) Expand 10 before | Expand all | Expand 10 after
2735 // The second pass updates pointers to new space in all spaces. It is possible 2735 // The second pass updates pointers to new space in all spaces. It is possible
2736 // to encounter pointers to dead new space objects during traversal of pointers 2736 // to encounter pointers to dead new space objects during traversal of pointers
2737 // to new space. We should clear them to avoid encountering them during next 2737 // to new space. We should clear them to avoid encountering them during next
2738 // pointer iteration. This is an issue if the store buffer overflows and we 2738 // pointer iteration. This is an issue if the store buffer overflows and we
2739 // have to scan the entire old space, including dead objects, looking for 2739 // have to scan the entire old space, including dead objects, looking for
2740 // pointers to new space. 2740 // pointers to new space.
2741 void MarkCompactCollector::MigrateObject(Address dst, 2741 void MarkCompactCollector::MigrateObject(Address dst,
2742 Address src, 2742 Address src,
2743 int size, 2743 int size,
2744 AllocationSpace dest) { 2744 AllocationSpace dest) {
2745 HEAP_PROFILE(heap(), ObjectMoveEvent(src, dst)); 2745 HEAP_PROFILE(heap(), ObjectMoveEvent(src, dst, size));
2746 // TODO(hpayer): Replace these checks with asserts. 2746 // TODO(hpayer): Replace these checks with asserts.
2747 CHECK(heap()->AllowedToBeMigrated(HeapObject::FromAddress(src), dest)); 2747 CHECK(heap()->AllowedToBeMigrated(HeapObject::FromAddress(src), dest));
2748 CHECK(dest != LO_SPACE && size <= Page::kMaxNonCodeHeapObjectSize); 2748 CHECK(dest != LO_SPACE && size <= Page::kMaxNonCodeHeapObjectSize);
2749 if (dest == OLD_POINTER_SPACE) { 2749 if (dest == OLD_POINTER_SPACE) {
2750 Address src_slot = src; 2750 Address src_slot = src;
2751 Address dst_slot = dst; 2751 Address dst_slot = dst;
2752 ASSERT(IsAligned(size, kPointerSize)); 2752 ASSERT(IsAligned(size, kPointerSize));
2753 2753
2754 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { 2754 for (int remaining = size / kPointerSize; remaining > 0; remaining--) {
2755 Object* value = Memory::Object_at(src_slot); 2755 Object* value = Memory::Object_at(src_slot);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2919 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, 2919 bool MarkCompactCollector::TryPromoteObject(HeapObject* object,
2920 int object_size) { 2920 int object_size) {
2921 // TODO(hpayer): Replace that check with an assert. 2921 // TODO(hpayer): Replace that check with an assert.
2922 CHECK(object_size <= Page::kMaxNonCodeHeapObjectSize); 2922 CHECK(object_size <= Page::kMaxNonCodeHeapObjectSize);
2923 2923
2924 OldSpace* target_space = heap()->TargetSpace(object); 2924 OldSpace* target_space = heap()->TargetSpace(object);
2925 2925
2926 ASSERT(target_space == heap()->old_pointer_space() || 2926 ASSERT(target_space == heap()->old_pointer_space() ||
2927 target_space == heap()->old_data_space()); 2927 target_space == heap()->old_data_space());
2928 Object* result; 2928 Object* result;
2929 MaybeObject* maybe_result = target_space->AllocateRaw(object_size); 2929 MaybeObject* maybe_result = target_space->AllocateRawForMigration(object_size) ;
loislo 2013/08/27 09:04:57 style: 80 symbols
Alexandra Mikhaylova 2013/09/19 16:03:38 Done.
2930 if (maybe_result->ToObject(&result)) { 2930 if (maybe_result->ToObject(&result)) {
2931 HeapObject* target = HeapObject::cast(result); 2931 HeapObject* target = HeapObject::cast(result);
2932 MigrateObject(target->address(), 2932 MigrateObject(target->address(),
2933 object->address(), 2933 object->address(),
2934 object_size, 2934 object_size,
2935 target_space->identity()); 2935 target_space->identity());
2936 heap()->mark_compact_collector()->tracer()-> 2936 heap()->mark_compact_collector()->tracer()->
2937 increment_promoted_objects_size(object_size); 2937 increment_promoted_objects_size(object_size);
2938 return true; 2938 return true;
2939 } 2939 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2992 if (*cell == 0) continue; 2992 if (*cell == 0) continue;
2993 2993
2994 int live_objects = MarkWordToObjectStarts(*cell, offsets); 2994 int live_objects = MarkWordToObjectStarts(*cell, offsets);
2995 for (int i = 0; i < live_objects; i++) { 2995 for (int i = 0; i < live_objects; i++) {
2996 Address object_addr = cell_base + offsets[i] * kPointerSize; 2996 Address object_addr = cell_base + offsets[i] * kPointerSize;
2997 HeapObject* object = HeapObject::FromAddress(object_addr); 2997 HeapObject* object = HeapObject::FromAddress(object_addr);
2998 ASSERT(Marking::IsBlack(Marking::MarkBitFrom(object))); 2998 ASSERT(Marking::IsBlack(Marking::MarkBitFrom(object)));
2999 2999
3000 int size = object->Size(); 3000 int size = object->Size();
3001 3001
3002 MaybeObject* target = space->AllocateRaw(size); 3002 MaybeObject* target = space->AllocateRawForMigration(size);
3003 if (target->IsFailure()) { 3003 if (target->IsFailure()) {
3004 // OS refused to give us memory. 3004 // OS refused to give us memory.
3005 V8::FatalProcessOutOfMemory("Evacuation"); 3005 V8::FatalProcessOutOfMemory("Evacuation");
3006 return; 3006 return;
3007 } 3007 }
3008 3008
3009 Object* target_object = target->ToObjectUnchecked(); 3009 Object* target_object = target->ToObjectUnchecked();
3010 3010
3011 MigrateObject(HeapObject::cast(target_object)->address(), 3011 MigrateObject(HeapObject::cast(target_object)->address(),
3012 object_addr, 3012 object_addr,
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
4333 while (buffer != NULL) { 4333 while (buffer != NULL) {
4334 SlotsBuffer* next_buffer = buffer->next(); 4334 SlotsBuffer* next_buffer = buffer->next();
4335 DeallocateBuffer(buffer); 4335 DeallocateBuffer(buffer);
4336 buffer = next_buffer; 4336 buffer = next_buffer;
4337 } 4337 }
4338 *buffer_address = NULL; 4338 *buffer_address = NULL;
4339 } 4339 }
4340 4340
4341 4341
4342 } } // namespace v8::internal 4342 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698