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

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

Issue 71163006: Merge bleeding_edge r17376:17693. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Fix all.gyp 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/heap-profiler.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 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 || 220 HeapProfiler* profiler = isolate_->heap_profiler();
221 retry_space == OLD_POINTER_SPACE ||
222 retry_space == OLD_DATA_SPACE ||
223 retry_space == LO_SPACE);
224 #ifdef DEBUG 221 #ifdef DEBUG
225 if (FLAG_gc_interval >= 0 && 222 if (FLAG_gc_interval >= 0 &&
226 !disallow_allocation_failure_ && 223 !disallow_allocation_failure_ &&
227 Heap::allocation_timeout_-- <= 0) { 224 Heap::allocation_timeout_-- <= 0) {
228 return Failure::RetryAfterGC(space); 225 return Failure::RetryAfterGC(space);
229 } 226 }
230 isolate_->counters()->objs_since_last_full()->Increment(); 227 isolate_->counters()->objs_since_last_full()->Increment();
231 isolate_->counters()->objs_since_last_young()->Increment(); 228 isolate_->counters()->objs_since_last_young()->Increment();
232 #endif 229 #endif
230
231 HeapObject* object;
233 MaybeObject* result; 232 MaybeObject* result;
234 if (NEW_SPACE == space) { 233 if (NEW_SPACE == space) {
235 result = new_space_.AllocateRaw(size_in_bytes); 234 result = new_space_.AllocateRaw(size_in_bytes);
236 if (always_allocate() && result->IsFailure()) { 235 if (always_allocate() && result->IsFailure() && retry_space != NEW_SPACE) {
237 space = retry_space; 236 space = retry_space;
238 } else { 237 } else {
238 if (profiler->is_tracking_allocations() && result->To(&object)) {
239 profiler->NewObjectEvent(object->address(), size_in_bytes);
240 }
239 return result; 241 return result;
240 } 242 }
241 } 243 }
242 244
243 if (OLD_POINTER_SPACE == space) { 245 if (OLD_POINTER_SPACE == space) {
244 result = old_pointer_space_->AllocateRaw(size_in_bytes); 246 result = old_pointer_space_->AllocateRaw(size_in_bytes);
245 } else if (OLD_DATA_SPACE == space) { 247 } else if (OLD_DATA_SPACE == space) {
246 result = old_data_space_->AllocateRaw(size_in_bytes); 248 result = old_data_space_->AllocateRaw(size_in_bytes);
247 } else if (CODE_SPACE == space) { 249 } else if (CODE_SPACE == space) {
248 result = code_space_->AllocateRaw(size_in_bytes); 250 result = code_space_->AllocateRaw(size_in_bytes);
249 } else if (LO_SPACE == space) { 251 } else if (LO_SPACE == space) {
250 result = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE); 252 result = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE);
251 } else if (CELL_SPACE == space) { 253 } else if (CELL_SPACE == space) {
252 result = cell_space_->AllocateRaw(size_in_bytes); 254 result = cell_space_->AllocateRaw(size_in_bytes);
253 } else if (PROPERTY_CELL_SPACE == space) { 255 } else if (PROPERTY_CELL_SPACE == space) {
254 result = property_cell_space_->AllocateRaw(size_in_bytes); 256 result = property_cell_space_->AllocateRaw(size_in_bytes);
255 } else { 257 } else {
256 ASSERT(MAP_SPACE == space); 258 ASSERT(MAP_SPACE == space);
257 result = map_space_->AllocateRaw(size_in_bytes); 259 result = map_space_->AllocateRaw(size_in_bytes);
258 } 260 }
259 if (result->IsFailure()) old_gen_exhausted_ = true; 261 if (result->IsFailure()) old_gen_exhausted_ = true;
262 if (profiler->is_tracking_allocations() && result->To(&object)) {
263 profiler->NewObjectEvent(object->address(), size_in_bytes);
264 }
260 return result; 265 return result;
261 } 266 }
262 267
263 268
264 MaybeObject* Heap::NumberFromInt32( 269 MaybeObject* Heap::NumberFromInt32(
265 int32_t value, PretenureFlag pretenure) { 270 int32_t value, PretenureFlag pretenure) {
266 if (Smi::IsValid(value)) return Smi::FromInt(value); 271 if (Smi::IsValid(value)) return Smi::FromInt(value);
267 // Bypass NumberFromDouble to avoid various redundant checks. 272 // Bypass NumberFromDouble to avoid various redundant checks.
268 return AllocateHeapNumber(FastI2D(value), pretenure); 273 return AllocateHeapNumber(FastI2D(value), pretenure);
269 } 274 }
(...skipping 19 matching lines...) Expand all
289 kHeapObjectTag); 294 kHeapObjectTag);
290 295
291 // Dispose of the C++ object if it has not already been disposed. 296 // Dispose of the C++ object if it has not already been disposed.
292 if (*resource_addr != NULL) { 297 if (*resource_addr != NULL) {
293 (*resource_addr)->Dispose(); 298 (*resource_addr)->Dispose();
294 *resource_addr = NULL; 299 *resource_addr = NULL;
295 } 300 }
296 } 301 }
297 302
298 303
299 MaybeObject* Heap::AllocateRawMap() {
300 #ifdef DEBUG
301 isolate_->counters()->objs_since_last_full()->Increment();
302 isolate_->counters()->objs_since_last_young()->Increment();
303 #endif
304 MaybeObject* result = map_space_->AllocateRaw(Map::kSize);
305 if (result->IsFailure()) old_gen_exhausted_ = true;
306 return result;
307 }
308
309
310 MaybeObject* Heap::AllocateRawCell() {
311 #ifdef DEBUG
312 isolate_->counters()->objs_since_last_full()->Increment();
313 isolate_->counters()->objs_since_last_young()->Increment();
314 #endif
315 MaybeObject* result = cell_space_->AllocateRaw(Cell::kSize);
316 if (result->IsFailure()) old_gen_exhausted_ = true;
317 return result;
318 }
319
320
321 MaybeObject* Heap::AllocateRawPropertyCell() {
322 #ifdef DEBUG
323 isolate_->counters()->objs_since_last_full()->Increment();
324 isolate_->counters()->objs_since_last_young()->Increment();
325 #endif
326 MaybeObject* result =
327 property_cell_space_->AllocateRaw(PropertyCell::kSize);
328 if (result->IsFailure()) old_gen_exhausted_ = true;
329 return result;
330 }
331
332
333 bool Heap::InNewSpace(Object* object) { 304 bool Heap::InNewSpace(Object* object) {
334 bool result = new_space_.Contains(object); 305 bool result = new_space_.Contains(object);
335 ASSERT(!result || // Either not in new space 306 ASSERT(!result || // Either not in new space
336 gc_state_ != NOT_IN_GC || // ... or in the middle of GC 307 gc_state_ != NOT_IN_GC || // ... or in the middle of GC
337 InToSpace(object)); // ... or in to-space (where we allocate). 308 InToSpace(object)); // ... or in to-space (where we allocate).
338 return result; 309 return result;
339 } 310 }
340 311
341 312
342 bool Heap::InNewSpace(Address address) { 313 bool Heap::InNewSpace(Address address) {
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 #ifdef DEBUG 864 #ifdef DEBUG
894 Isolate* isolate = Isolate::Current(); 865 Isolate* isolate = Isolate::Current();
895 isolate->heap()->disallow_allocation_failure_ = old_state_; 866 isolate->heap()->disallow_allocation_failure_ = old_state_;
896 #endif 867 #endif
897 } 868 }
898 869
899 870
900 } } // namespace v8::internal 871 } } // namespace v8::internal
901 872
902 #endif // V8_HEAP_INL_H_ 873 #endif // V8_HEAP_INL_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/heap-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698