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/heap.cc

Issue 25544002: Turn Heap::AllowedToBeMigrated checks into asserts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 | « no previous file | src/mark-compact.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 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 if (alignment != kObjectAlignment) { 2133 if (alignment != kObjectAlignment) {
2134 ASSERT(alignment == kDoubleAlignment); 2134 ASSERT(alignment == kDoubleAlignment);
2135 allocation_size += kPointerSize; 2135 allocation_size += kPointerSize;
2136 } 2136 }
2137 2137
2138 Heap* heap = map->GetHeap(); 2138 Heap* heap = map->GetHeap();
2139 if (heap->ShouldBePromoted(object->address(), object_size)) { 2139 if (heap->ShouldBePromoted(object->address(), object_size)) {
2140 MaybeObject* maybe_result; 2140 MaybeObject* maybe_result;
2141 2141
2142 if (object_contents == DATA_OBJECT) { 2142 if (object_contents == DATA_OBJECT) {
2143 // TODO(mstarzinger): Turn this check into a regular assert soon! 2143 ASSERT(heap->AllowedToBeMigrated(object, OLD_DATA_SPACE));
2144 CHECK(heap->AllowedToBeMigrated(object, OLD_DATA_SPACE));
2145 maybe_result = heap->old_data_space()->AllocateRaw(allocation_size); 2144 maybe_result = heap->old_data_space()->AllocateRaw(allocation_size);
2146 } else { 2145 } else {
2147 // TODO(mstarzinger): Turn this check into a regular assert soon! 2146 ASSERT(heap->AllowedToBeMigrated(object, OLD_POINTER_SPACE));
2148 CHECK(heap->AllowedToBeMigrated(object, OLD_POINTER_SPACE));
2149 maybe_result = heap->old_pointer_space()->AllocateRaw(allocation_size); 2147 maybe_result = heap->old_pointer_space()->AllocateRaw(allocation_size);
2150 } 2148 }
2151 2149
2152 Object* result = NULL; // Initialization to please compiler. 2150 Object* result = NULL; // Initialization to please compiler.
2153 if (maybe_result->ToObject(&result)) { 2151 if (maybe_result->ToObject(&result)) {
2154 HeapObject* target = HeapObject::cast(result); 2152 HeapObject* target = HeapObject::cast(result);
2155 2153
2156 if (alignment != kObjectAlignment) { 2154 if (alignment != kObjectAlignment) {
2157 target = EnsureDoubleAligned(heap, target, allocation_size); 2155 target = EnsureDoubleAligned(heap, target, allocation_size);
2158 } 2156 }
(...skipping 10 matching lines...) Expand all
2169 target, JSFunction::kNonWeakFieldsEndOffset); 2167 target, JSFunction::kNonWeakFieldsEndOffset);
2170 } else { 2168 } else {
2171 heap->promotion_queue()->insert(target, object_size); 2169 heap->promotion_queue()->insert(target, object_size);
2172 } 2170 }
2173 } 2171 }
2174 2172
2175 heap->tracer()->increment_promoted_objects_size(object_size); 2173 heap->tracer()->increment_promoted_objects_size(object_size);
2176 return; 2174 return;
2177 } 2175 }
2178 } 2176 }
2179 // TODO(mstarzinger): Turn this check into a regular assert soon! 2177 ASSERT(heap->AllowedToBeMigrated(object, NEW_SPACE));
2180 CHECK(heap->AllowedToBeMigrated(object, NEW_SPACE));
2181 MaybeObject* allocation = heap->new_space()->AllocateRaw(allocation_size); 2178 MaybeObject* allocation = heap->new_space()->AllocateRaw(allocation_size);
2182 heap->promotion_queue()->SetNewLimit(heap->new_space()->top()); 2179 heap->promotion_queue()->SetNewLimit(heap->new_space()->top());
2183 Object* result = allocation->ToObjectUnchecked(); 2180 Object* result = allocation->ToObjectUnchecked();
2184 HeapObject* target = HeapObject::cast(result); 2181 HeapObject* target = HeapObject::cast(result);
2185 2182
2186 if (alignment != kObjectAlignment) { 2183 if (alignment != kObjectAlignment) {
2187 target = EnsureDoubleAligned(heap, target, allocation_size); 2184 target = EnsureDoubleAligned(heap, target, allocation_size);
2188 } 2185 }
2189 2186
2190 // Order is important: slot might be inside of the target if target 2187 // Order is important: slot might be inside of the target if target
(...skipping 5683 matching lines...) Expand 10 before | Expand all | Expand 10 after
7874 if (FLAG_concurrent_recompilation) { 7871 if (FLAG_concurrent_recompilation) {
7875 heap_->relocation_mutex_->Lock(); 7872 heap_->relocation_mutex_->Lock();
7876 #ifdef DEBUG 7873 #ifdef DEBUG
7877 heap_->relocation_mutex_locked_by_optimizer_thread_ = 7874 heap_->relocation_mutex_locked_by_optimizer_thread_ =
7878 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); 7875 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
7879 #endif // DEBUG 7876 #endif // DEBUG
7880 } 7877 }
7881 } 7878 }
7882 7879
7883 } } // namespace v8::internal 7880 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698