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

Side by Side Diff: src/heap-inl.h

Issue 66723003: Make runtime new-space allocations go through Heap::AllocateRaw. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Simplified implementation. 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.cc ('k') | src/runtime.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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 return CopyConstantPoolArrayWithMap(src, src->map()); 210 return CopyConstantPoolArrayWithMap(src, src->map());
211 } 211 }
212 212
213 213
214 MaybeObject* Heap::AllocateRaw(int size_in_bytes, 214 MaybeObject* Heap::AllocateRaw(int size_in_bytes,
215 AllocationSpace space, 215 AllocationSpace space,
216 AllocationSpace retry_space) { 216 AllocationSpace retry_space) {
217 ASSERT(AllowHandleAllocation::IsAllowed()); 217 ASSERT(AllowHandleAllocation::IsAllowed());
218 ASSERT(AllowHeapAllocation::IsAllowed()); 218 ASSERT(AllowHeapAllocation::IsAllowed());
219 ASSERT(gc_state_ == NOT_IN_GC); 219 ASSERT(gc_state_ == NOT_IN_GC);
220 ASSERT(space != NEW_SPACE ||
221 retry_space == OLD_POINTER_SPACE ||
222 retry_space == OLD_DATA_SPACE ||
223 retry_space == LO_SPACE);
224 #ifdef DEBUG 220 #ifdef DEBUG
225 if (FLAG_gc_interval >= 0 && 221 if (FLAG_gc_interval >= 0 &&
226 !disallow_allocation_failure_ && 222 !disallow_allocation_failure_ &&
227 Heap::allocation_timeout_-- <= 0) { 223 Heap::allocation_timeout_-- <= 0) {
228 return Failure::RetryAfterGC(space); 224 return Failure::RetryAfterGC(space);
229 } 225 }
230 isolate_->counters()->objs_since_last_full()->Increment(); 226 isolate_->counters()->objs_since_last_full()->Increment();
231 isolate_->counters()->objs_since_last_young()->Increment(); 227 isolate_->counters()->objs_since_last_young()->Increment();
232 #endif 228 #endif
233 MaybeObject* result; 229 MaybeObject* result;
234 if (NEW_SPACE == space) { 230 if (NEW_SPACE == space) {
235 result = new_space_.AllocateRaw(size_in_bytes); 231 result = new_space_.AllocateRaw(size_in_bytes);
236 if (always_allocate() && result->IsFailure()) { 232 if (always_allocate() && result->IsFailure() && retry_space != NEW_SPACE) {
237 space = retry_space; 233 space = retry_space;
238 } else { 234 } else {
239 return result; 235 return result;
240 } 236 }
241 } 237 }
242 238
243 if (OLD_POINTER_SPACE == space) { 239 if (OLD_POINTER_SPACE == space) {
244 result = old_pointer_space_->AllocateRaw(size_in_bytes); 240 result = old_pointer_space_->AllocateRaw(size_in_bytes);
245 } else if (OLD_DATA_SPACE == space) { 241 } else if (OLD_DATA_SPACE == space) {
246 result = old_data_space_->AllocateRaw(size_in_bytes); 242 result = old_data_space_->AllocateRaw(size_in_bytes);
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 #ifdef DEBUG 855 #ifdef DEBUG
860 Isolate* isolate = Isolate::Current(); 856 Isolate* isolate = Isolate::Current();
861 isolate->heap()->disallow_allocation_failure_ = old_state_; 857 isolate->heap()->disallow_allocation_failure_ = old_state_;
862 #endif 858 #endif
863 } 859 }
864 860
865 861
866 } } // namespace v8::internal 862 } } // namespace v8::internal
867 863
868 #endif // V8_HEAP_INL_H_ 864 #endif // V8_HEAP_INL_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698