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 // 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 #ifndef V8_HEAP_SPACES_INL_H_ | 5 #ifndef V8_HEAP_SPACES_INL_H_ |
| 6 #define V8_HEAP_SPACES_INL_H_ | 6 #define V8_HEAP_SPACES_INL_H_ |
| 7 | 7 |
| 8 #include "src/heap/incremental-marking.h" | 8 #include "src/heap/incremental-marking.h" |
| 9 #include "src/heap/spaces.h" | 9 #include "src/heap/spaces.h" |
| 10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 return object; | 418 return object; |
| 419 } | 419 } |
| 420 | 420 |
| 421 return AllocationResult::Retry(identity()); | 421 return AllocationResult::Retry(identity()); |
| 422 } | 422 } |
| 423 | 423 |
| 424 | 424 |
| 425 AllocationResult PagedSpace::AllocateRaw(int size_in_bytes, | 425 AllocationResult PagedSpace::AllocateRaw(int size_in_bytes, |
| 426 AllocationAlignment alignment) { | 426 AllocationAlignment alignment) { |
| 427 #ifdef V8_HOST_ARCH_32_BIT | 427 #ifdef V8_HOST_ARCH_32_BIT |
| 428 return alignment == kDoubleAligned | 428 AllocationResult result = |
| 429 ? AllocateRawAligned(size_in_bytes, kDoubleAligned) | 429 alignment == kDoubleAligned |
| 430 : AllocateRawUnaligned(size_in_bytes); | 430 ? AllocateRawAligned(size_in_bytes, kDoubleAligned) |
| 431 : AllocateRawUnaligned(size_in_bytes); | |
| 431 #else | 432 #else |
| 432 return AllocateRawUnaligned(size_in_bytes); | 433 AllocationResult result = AllocateRawUnaligned(size_in_bytes); |
| 433 #endif | 434 #endif |
| 435 if (!result.IsRetry()) { | |
| 436 Object* obj = result.ToObjectChecked(); | |
|
ofrobots
2016/02/11 05:51:46
This code would be much simpler if you used Alloca
mattloring
2016/02/11 14:54:14
Done.
| |
| 437 if (obj->IsHeapObject()) { | |
| 438 HeapObject* heap_obj = static_cast<HeapObject*>(obj); | |
| 439 AllocationStep(heap_obj->address(), size_in_bytes); | |
| 440 } | |
| 441 } | |
| 442 return result; | |
| 434 } | 443 } |
| 435 | 444 |
| 436 | 445 |
| 437 // ----------------------------------------------------------------------------- | 446 // ----------------------------------------------------------------------------- |
| 438 // NewSpace | 447 // NewSpace |
| 439 | 448 |
| 440 | 449 |
| 441 AllocationResult NewSpace::AllocateRawAligned(int size_in_bytes, | 450 AllocationResult NewSpace::AllocateRawAligned(int size_in_bytes, |
| 442 AllocationAlignment alignment) { | 451 AllocationAlignment alignment) { |
| 443 Address top = allocation_info_.top(); | 452 Address top = allocation_info_.top(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 544 other->allocation_info_.Reset(nullptr, nullptr); | 553 other->allocation_info_.Reset(nullptr, nullptr); |
| 545 return true; | 554 return true; |
| 546 } | 555 } |
| 547 return false; | 556 return false; |
| 548 } | 557 } |
| 549 | 558 |
| 550 } // namespace internal | 559 } // namespace internal |
| 551 } // namespace v8 | 560 } // namespace v8 |
| 552 | 561 |
| 553 #endif // V8_HEAP_SPACES_INL_H_ | 562 #endif // V8_HEAP_SPACES_INL_H_ |
| OLD | NEW |