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

Side by Side Diff: src/heap.cc

Issue 362723003: Added a promotion queue unit test that test promotion queue memory corruption (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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.h ('k') | test/cctest/test-heap.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/once.h" 9 #include "src/base/once.h"
10 #include "src/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 } 1943 }
1944 } 1944 }
1945 1945
1946 // Helper function used by CopyObject to copy a source object to an 1946 // Helper function used by CopyObject to copy a source object to an
1947 // allocated target object and update the forwarding pointer in the source 1947 // allocated target object and update the forwarding pointer in the source
1948 // object. Returns the target object. 1948 // object. Returns the target object.
1949 INLINE(static void MigrateObject(Heap* heap, 1949 INLINE(static void MigrateObject(Heap* heap,
1950 HeapObject* source, 1950 HeapObject* source,
1951 HeapObject* target, 1951 HeapObject* target,
1952 int size)) { 1952 int size)) {
1953 // If we migrate into to-space, then the to-space top pointer should be
1954 // right after the target object. Incorporate double alignment
1955 // over-allocation.
1956 ASSERT(!heap->InToSpace(target) ||
1957 target->address() + size == heap->new_space()->top() ||
1958 target->address() + size + kPointerSize == heap->new_space()->top());
1959
1960 // Make sure that we do not overwrite the promotion queue which is at
1961 // the end of to-space.
1962 ASSERT(!heap->InToSpace(target) ||
1963 heap->promotion_queue()->IsBelowPromotionQueue(
1964 heap->new_space()->top()));
1965
1953 // Copy the content of source to target. 1966 // Copy the content of source to target.
1954 heap->CopyBlock(target->address(), source->address(), size); 1967 heap->CopyBlock(target->address(), source->address(), size);
1955 1968
1956 // Set the forwarding address. 1969 // Set the forwarding address.
1957 source->set_map_word(MapWord::FromForwardingAddress(target)); 1970 source->set_map_word(MapWord::FromForwardingAddress(target));
1958 1971
1959 if (logging_and_profiling_mode == LOGGING_AND_PROFILING_ENABLED) { 1972 if (logging_and_profiling_mode == LOGGING_AND_PROFILING_ENABLED) {
1960 // Update NewSpace stats if necessary. 1973 // Update NewSpace stats if necessary.
1961 RecordCopiedObject(heap, target); 1974 RecordCopiedObject(heap, target);
1962 heap->OnMoveEvent(target, source, size); 1975 heap->OnMoveEvent(target, source, size);
(...skipping 4480 matching lines...) Expand 10 before | Expand all | Expand 10 after
6443 static_cast<int>(object_sizes_last_time_[index])); 6456 static_cast<int>(object_sizes_last_time_[index]));
6444 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6457 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6445 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6458 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6446 6459
6447 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6460 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6448 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6461 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6449 ClearObjectStats(); 6462 ClearObjectStats();
6450 } 6463 }
6451 6464
6452 } } // namespace v8::internal 6465 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698