Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 288 return Failure::RetryAfterGC(identity()); | 288 return Failure::RetryAfterGC(identity()); |
| 289 } | 289 } |
| 290 | 290 |
| 291 | 291 |
| 292 // ----------------------------------------------------------------------------- | 292 // ----------------------------------------------------------------------------- |
| 293 // NewSpace | 293 // NewSpace |
| 294 | 294 |
| 295 | 295 |
| 296 MaybeObject* NewSpace::AllocateRaw(int size_in_bytes) { | 296 MaybeObject* NewSpace::AllocateRaw(int size_in_bytes) { |
| 297 Address old_top = allocation_info_.top; | 297 Address old_top = allocation_info_.top; |
| 298 #ifdef DEBUG | |
| 299 if (FLAG_stress_compaction) { | |
| 300 if (allocation_info_.limit - old_top >= size_in_bytes * 4) { | |
|
Michael Starzinger
2012/04/24 11:39:15
Could you add a one-liner comment why it helps to
| |
| 301 int filler_size = size_in_bytes * 4; | |
| 302 for (int i = 0; i < filler_size; i += kPointerSize) { | |
| 303 *(reinterpret_cast<Object**>(old_top + i)) = | |
| 304 HEAP->one_pointer_filler_map(); | |
| 305 } | |
| 306 old_top += filler_size; | |
| 307 allocation_info_.top += filler_size; | |
| 308 } | |
| 309 } | |
| 310 #endif | |
| 311 | |
| 298 if (allocation_info_.limit - old_top < size_in_bytes) { | 312 if (allocation_info_.limit - old_top < size_in_bytes) { |
| 299 return SlowAllocateRaw(size_in_bytes); | 313 return SlowAllocateRaw(size_in_bytes); |
| 300 } | 314 } |
| 301 | 315 |
| 302 Object* obj = HeapObject::FromAddress(allocation_info_.top); | 316 Object* obj = HeapObject::FromAddress(old_top); |
| 303 allocation_info_.top += size_in_bytes; | 317 allocation_info_.top += size_in_bytes; |
| 304 ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); | 318 ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); |
| 305 | 319 |
| 306 return obj; | 320 return obj; |
| 307 } | 321 } |
| 308 | 322 |
| 309 | 323 |
| 310 LargePage* LargePage::Initialize(Heap* heap, MemoryChunk* chunk) { | 324 LargePage* LargePage::Initialize(Heap* heap, MemoryChunk* chunk) { |
| 311 heap->incremental_marking()->SetOldSpacePageFlags(chunk); | 325 heap->incremental_marking()->SetOldSpacePageFlags(chunk); |
| 312 return static_cast<LargePage*>(chunk); | 326 return static_cast<LargePage*>(chunk); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 339 Map* map = object->map(); | 353 Map* map = object->map(); |
| 340 Heap* heap = object->GetHeap(); | 354 Heap* heap = object->GetHeap(); |
| 341 return map == heap->raw_unchecked_free_space_map() | 355 return map == heap->raw_unchecked_free_space_map() |
| 342 || map == heap->raw_unchecked_one_pointer_filler_map() | 356 || map == heap->raw_unchecked_one_pointer_filler_map() |
| 343 || map == heap->raw_unchecked_two_pointer_filler_map(); | 357 || map == heap->raw_unchecked_two_pointer_filler_map(); |
| 344 } | 358 } |
| 345 | 359 |
| 346 } } // namespace v8::internal | 360 } } // namespace v8::internal |
| 347 | 361 |
| 348 #endif // V8_SPACES_INL_H_ | 362 #endif // V8_SPACES_INL_H_ |
| OLD | NEW |