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

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

Issue 23039014: Hook-allocation on bleeding edge (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 that check with an assert. 2746 // TODO(hpayer): Replace that check with an assert.
2747 CHECK(dest != LO_SPACE && size <= Page::kMaxNonCodeHeapObjectSize); 2747 CHECK(dest != LO_SPACE && size <= Page::kMaxNonCodeHeapObjectSize);
2748 if (dest == OLD_POINTER_SPACE) { 2748 if (dest == OLD_POINTER_SPACE) {
2749 // TODO(hpayer): Replace this check with an assert. 2749 // TODO(hpayer): Replace this check with an assert.
2750 HeapObject* heap_object = HeapObject::FromAddress(src); 2750 HeapObject* heap_object = HeapObject::FromAddress(src);
2751 CHECK(heap_->TargetSpace(heap_object) == heap_->old_pointer_space()); 2751 CHECK(heap_->TargetSpace(heap_object) == heap_->old_pointer_space());
2752 Address src_slot = src; 2752 Address src_slot = src;
2753 Address dst_slot = dst; 2753 Address dst_slot = dst;
2754 ASSERT(IsAligned(size, kPointerSize)); 2754 ASSERT(IsAligned(size, kPointerSize));
2755 2755
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
2928 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, 2928 bool MarkCompactCollector::TryPromoteObject(HeapObject* object,
2929 int object_size) { 2929 int object_size) {
2930 // TODO(hpayer): Replace that check with an assert. 2930 // TODO(hpayer): Replace that check with an assert.
2931 CHECK(object_size <= Page::kMaxNonCodeHeapObjectSize); 2931 CHECK(object_size <= Page::kMaxNonCodeHeapObjectSize);
2932 2932
2933 OldSpace* target_space = heap()->TargetSpace(object); 2933 OldSpace* target_space = heap()->TargetSpace(object);
2934 2934
2935 ASSERT(target_space == heap()->old_pointer_space() || 2935 ASSERT(target_space == heap()->old_pointer_space() ||
2936 target_space == heap()->old_data_space()); 2936 target_space == heap()->old_data_space());
2937 Object* result; 2937 Object* result;
2938 MaybeObject* maybe_result = target_space->AllocateRaw(object_size); 2938 MaybeObject* maybe_result = target_space->AllocateRawSilently(object_size);
2939 if (maybe_result->ToObject(&result)) { 2939 if (maybe_result->ToObject(&result)) {
2940 HeapObject* target = HeapObject::cast(result); 2940 HeapObject* target = HeapObject::cast(result);
2941 MigrateObject(target->address(), 2941 MigrateObject(target->address(),
2942 object->address(), 2942 object->address(),
2943 object_size, 2943 object_size,
2944 target_space->identity()); 2944 target_space->identity());
2945 heap()->mark_compact_collector()->tracer()-> 2945 heap()->mark_compact_collector()->tracer()->
2946 increment_promoted_objects_size(object_size); 2946 increment_promoted_objects_size(object_size);
2947 return true; 2947 return true;
2948 } 2948 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3001 if (*cell == 0) continue; 3001 if (*cell == 0) continue;
3002 3002
3003 int live_objects = MarkWordToObjectStarts(*cell, offsets); 3003 int live_objects = MarkWordToObjectStarts(*cell, offsets);
3004 for (int i = 0; i < live_objects; i++) { 3004 for (int i = 0; i < live_objects; i++) {
3005 Address object_addr = cell_base + offsets[i] * kPointerSize; 3005 Address object_addr = cell_base + offsets[i] * kPointerSize;
3006 HeapObject* object = HeapObject::FromAddress(object_addr); 3006 HeapObject* object = HeapObject::FromAddress(object_addr);
3007 ASSERT(Marking::IsBlack(Marking::MarkBitFrom(object))); 3007 ASSERT(Marking::IsBlack(Marking::MarkBitFrom(object)));
3008 3008
3009 int size = object->Size(); 3009 int size = object->Size();
3010 3010
3011 MaybeObject* target = space->AllocateRaw(size); 3011 MaybeObject* target = space->AllocateRawSilently(size);
3012 if (target->IsFailure()) { 3012 if (target->IsFailure()) {
3013 // OS refused to give us memory. 3013 // OS refused to give us memory.
3014 V8::FatalProcessOutOfMemory("Evacuation"); 3014 V8::FatalProcessOutOfMemory("Evacuation");
3015 return; 3015 return;
3016 } 3016 }
3017 3017
3018 Object* target_object = target->ToObjectUnchecked(); 3018 Object* target_object = target->ToObjectUnchecked();
3019 3019
3020 MigrateObject(HeapObject::cast(target_object)->address(), 3020 MigrateObject(HeapObject::cast(target_object)->address(),
3021 object_addr, 3021 object_addr,
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
4342 while (buffer != NULL) { 4342 while (buffer != NULL) {
4343 SlotsBuffer* next_buffer = buffer->next(); 4343 SlotsBuffer* next_buffer = buffer->next();
4344 DeallocateBuffer(buffer); 4344 DeallocateBuffer(buffer);
4345 buffer = next_buffer; 4345 buffer = next_buffer;
4346 } 4346 }
4347 *buffer_address = NULL; 4347 *buffer_address = NULL;
4348 } 4348 }
4349 4349
4350 4350
4351 } } // namespace v8::internal 4351 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698