| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_HEAP_INL_H_ | 5 #ifndef V8_HEAP_HEAP_INL_H_ |
| 6 #define V8_HEAP_HEAP_INL_H_ | 6 #define V8_HEAP_HEAP_INL_H_ |
| 7 | 7 |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 Heap::allocation_timeout_-- <= 0) { | 166 Heap::allocation_timeout_-- <= 0) { |
| 167 return AllocationResult::Retry(space); | 167 return AllocationResult::Retry(space); |
| 168 } | 168 } |
| 169 isolate_->counters()->objs_since_last_full()->Increment(); | 169 isolate_->counters()->objs_since_last_full()->Increment(); |
| 170 isolate_->counters()->objs_since_last_young()->Increment(); | 170 isolate_->counters()->objs_since_last_young()->Increment(); |
| 171 #endif | 171 #endif |
| 172 | 172 |
| 173 HeapObject* object; | 173 HeapObject* object; |
| 174 AllocationResult allocation; | 174 AllocationResult allocation; |
| 175 if (NEW_SPACE == space) { | 175 if (NEW_SPACE == space) { |
| 176 #ifndef V8_HOST_ARCH_64_BIT | 176 allocation = new_space_.AllocateRaw(size_in_bytes, alignment); |
| 177 if (alignment == kWordAligned) { | |
| 178 allocation = new_space_.AllocateRaw(size_in_bytes); | |
| 179 } else { | |
| 180 allocation = new_space_.AllocateRawAligned(size_in_bytes, alignment); | |
| 181 } | |
| 182 #else | |
| 183 allocation = new_space_.AllocateRaw(size_in_bytes); | |
| 184 #endif | |
| 185 if (always_allocate() && allocation.IsRetry() && retry_space != NEW_SPACE) { | 177 if (always_allocate() && allocation.IsRetry() && retry_space != NEW_SPACE) { |
| 186 space = retry_space; | 178 space = retry_space; |
| 187 } else { | 179 } else { |
| 188 if (allocation.To(&object)) { | 180 if (allocation.To(&object)) { |
| 189 OnAllocationEvent(object, size_in_bytes); | 181 OnAllocationEvent(object, size_in_bytes); |
| 190 } | 182 } |
| 191 return allocation; | 183 return allocation; |
| 192 } | 184 } |
| 193 } | 185 } |
| 194 | 186 |
| 195 if (OLD_SPACE == space) { | 187 if (OLD_SPACE == space) { |
| 196 #ifndef V8_HOST_ARCH_64_BIT | 188 allocation = old_space_->AllocateRaw(size_in_bytes, alignment); |
| 197 if (alignment == kWordAligned) { | |
| 198 allocation = old_space_->AllocateRaw(size_in_bytes); | |
| 199 } else { | |
| 200 allocation = old_space_->AllocateRawAligned(size_in_bytes, alignment); | |
| 201 } | |
| 202 #else | |
| 203 allocation = old_space_->AllocateRaw(size_in_bytes); | |
| 204 #endif | |
| 205 } else if (CODE_SPACE == space) { | 189 } else if (CODE_SPACE == space) { |
| 206 if (size_in_bytes <= code_space()->AreaSize()) { | 190 if (size_in_bytes <= code_space()->AreaSize()) { |
| 207 allocation = code_space_->AllocateRaw(size_in_bytes); | 191 allocation = code_space_->AllocateRawUnaligned(size_in_bytes); |
| 208 } else { | 192 } else { |
| 209 // Large code objects are allocated in large object space. | 193 // Large code objects are allocated in large object space. |
| 210 allocation = lo_space_->AllocateRaw(size_in_bytes, EXECUTABLE); | 194 allocation = lo_space_->AllocateRaw(size_in_bytes, EXECUTABLE); |
| 211 } | 195 } |
| 212 } else if (LO_SPACE == space) { | 196 } else if (LO_SPACE == space) { |
| 213 allocation = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE); | 197 allocation = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE); |
| 214 } else { | 198 } else { |
| 215 DCHECK(MAP_SPACE == space); | 199 DCHECK(MAP_SPACE == space); |
| 216 allocation = map_space_->AllocateRaw(size_in_bytes); | 200 allocation = map_space_->AllocateRawUnaligned(size_in_bytes); |
| 217 } | 201 } |
| 218 if (allocation.To(&object)) { | 202 if (allocation.To(&object)) { |
| 219 OnAllocationEvent(object, size_in_bytes); | 203 OnAllocationEvent(object, size_in_bytes); |
| 220 } else { | 204 } else { |
| 221 old_gen_exhausted_ = true; | 205 old_gen_exhausted_ = true; |
| 222 } | 206 } |
| 223 return allocation; | 207 return allocation; |
| 224 } | 208 } |
| 225 | 209 |
| 226 | 210 |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 | 688 |
| 705 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 689 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
| 706 for (Object** current = start; current < end; current++) { | 690 for (Object** current = start; current < end; current++) { |
| 707 CHECK((*current)->IsSmi()); | 691 CHECK((*current)->IsSmi()); |
| 708 } | 692 } |
| 709 } | 693 } |
| 710 } | 694 } |
| 711 } // namespace v8::internal | 695 } // namespace v8::internal |
| 712 | 696 |
| 713 #endif // V8_HEAP_HEAP_INL_H_ | 697 #endif // V8_HEAP_HEAP_INL_H_ |
| OLD | NEW |