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

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

Issue 68663002: Move old-space allocation tracking into Heap::AllocateRaw. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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-inl.h ('k') | src/spaces.h » ('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 2921 matching lines...) Expand 10 before | Expand all | Expand 10 after
2932 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, 2932 bool MarkCompactCollector::TryPromoteObject(HeapObject* object,
2933 int object_size) { 2933 int object_size) {
2934 // TODO(hpayer): Replace that check with an assert. 2934 // TODO(hpayer): Replace that check with an assert.
2935 CHECK(object_size <= Page::kMaxNonCodeHeapObjectSize); 2935 CHECK(object_size <= Page::kMaxNonCodeHeapObjectSize);
2936 2936
2937 OldSpace* target_space = heap()->TargetSpace(object); 2937 OldSpace* target_space = heap()->TargetSpace(object);
2938 2938
2939 ASSERT(target_space == heap()->old_pointer_space() || 2939 ASSERT(target_space == heap()->old_pointer_space() ||
2940 target_space == heap()->old_data_space()); 2940 target_space == heap()->old_data_space());
2941 Object* result; 2941 Object* result;
2942 MaybeObject* maybe_result = target_space->AllocateRaw( 2942 MaybeObject* maybe_result = target_space->AllocateRaw(object_size);
2943 object_size,
2944 PagedSpace::MOVE_OBJECT);
2945 if (maybe_result->ToObject(&result)) { 2943 if (maybe_result->ToObject(&result)) {
2946 HeapObject* target = HeapObject::cast(result); 2944 HeapObject* target = HeapObject::cast(result);
2947 MigrateObject(target->address(), 2945 MigrateObject(target->address(),
2948 object->address(), 2946 object->address(),
2949 object_size, 2947 object_size,
2950 target_space->identity()); 2948 target_space->identity());
2951 heap()->mark_compact_collector()->tracer()-> 2949 heap()->mark_compact_collector()->tracer()->
2952 increment_promoted_objects_size(object_size); 2950 increment_promoted_objects_size(object_size);
2953 return true; 2951 return true;
2954 } 2952 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3007 if (*cell == 0) continue; 3005 if (*cell == 0) continue;
3008 3006
3009 int live_objects = MarkWordToObjectStarts(*cell, offsets); 3007 int live_objects = MarkWordToObjectStarts(*cell, offsets);
3010 for (int i = 0; i < live_objects; i++) { 3008 for (int i = 0; i < live_objects; i++) {
3011 Address object_addr = cell_base + offsets[i] * kPointerSize; 3009 Address object_addr = cell_base + offsets[i] * kPointerSize;
3012 HeapObject* object = HeapObject::FromAddress(object_addr); 3010 HeapObject* object = HeapObject::FromAddress(object_addr);
3013 ASSERT(Marking::IsBlack(Marking::MarkBitFrom(object))); 3011 ASSERT(Marking::IsBlack(Marking::MarkBitFrom(object)));
3014 3012
3015 int size = object->Size(); 3013 int size = object->Size();
3016 3014
3017 MaybeObject* target = space->AllocateRaw(size, PagedSpace::MOVE_OBJECT); 3015 MaybeObject* target = space->AllocateRaw(size);
3018 if (target->IsFailure()) { 3016 if (target->IsFailure()) {
3019 // OS refused to give us memory. 3017 // OS refused to give us memory.
3020 V8::FatalProcessOutOfMemory("Evacuation"); 3018 V8::FatalProcessOutOfMemory("Evacuation");
3021 return; 3019 return;
3022 } 3020 }
3023 3021
3024 Object* target_object = target->ToObjectUnchecked(); 3022 Object* target_object = target->ToObjectUnchecked();
3025 3023
3026 MigrateObject(HeapObject::cast(target_object)->address(), 3024 MigrateObject(HeapObject::cast(target_object)->address(),
3027 object_addr, 3025 object_addr,
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
4353 while (buffer != NULL) { 4351 while (buffer != NULL) {
4354 SlotsBuffer* next_buffer = buffer->next(); 4352 SlotsBuffer* next_buffer = buffer->next();
4355 DeallocateBuffer(buffer); 4353 DeallocateBuffer(buffer);
4356 buffer = next_buffer; 4354 buffer = next_buffer;
4357 } 4355 }
4358 *buffer_address = NULL; 4356 *buffer_address = NULL;
4359 } 4357 }
4360 4358
4361 4359
4362 } } // namespace v8::internal 4360 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698