OLD | NEW |
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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 #endif | 229 #endif |
230 | 230 |
231 HeapObject* object; | 231 HeapObject* object; |
232 MaybeObject* result; | 232 MaybeObject* result; |
233 if (NEW_SPACE == space) { | 233 if (NEW_SPACE == space) { |
234 result = new_space_.AllocateRaw(size_in_bytes); | 234 result = new_space_.AllocateRaw(size_in_bytes); |
235 if (always_allocate() && result->IsFailure() && retry_space != NEW_SPACE) { | 235 if (always_allocate() && result->IsFailure() && retry_space != NEW_SPACE) { |
236 space = retry_space; | 236 space = retry_space; |
237 } else { | 237 } else { |
238 if (profiler->is_tracking_allocations() && result->To(&object)) { | 238 if (profiler->is_tracking_allocations() && result->To(&object)) { |
239 profiler->NewObjectEvent(object->address(), size_in_bytes); | 239 profiler->AllocationEvent(object->address(), size_in_bytes); |
240 } | 240 } |
241 return result; | 241 return result; |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 if (OLD_POINTER_SPACE == space) { | 245 if (OLD_POINTER_SPACE == space) { |
246 result = old_pointer_space_->AllocateRaw(size_in_bytes); | 246 result = old_pointer_space_->AllocateRaw(size_in_bytes); |
247 } else if (OLD_DATA_SPACE == space) { | 247 } else if (OLD_DATA_SPACE == space) { |
248 result = old_data_space_->AllocateRaw(size_in_bytes); | 248 result = old_data_space_->AllocateRaw(size_in_bytes); |
249 } else if (CODE_SPACE == space) { | 249 } else if (CODE_SPACE == space) { |
250 result = code_space_->AllocateRaw(size_in_bytes); | 250 result = code_space_->AllocateRaw(size_in_bytes); |
251 } else if (LO_SPACE == space) { | 251 } else if (LO_SPACE == space) { |
252 result = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE); | 252 result = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE); |
253 } else if (CELL_SPACE == space) { | 253 } else if (CELL_SPACE == space) { |
254 result = cell_space_->AllocateRaw(size_in_bytes); | 254 result = cell_space_->AllocateRaw(size_in_bytes); |
255 } else if (PROPERTY_CELL_SPACE == space) { | 255 } else if (PROPERTY_CELL_SPACE == space) { |
256 result = property_cell_space_->AllocateRaw(size_in_bytes); | 256 result = property_cell_space_->AllocateRaw(size_in_bytes); |
257 } else { | 257 } else { |
258 ASSERT(MAP_SPACE == space); | 258 ASSERT(MAP_SPACE == space); |
259 result = map_space_->AllocateRaw(size_in_bytes); | 259 result = map_space_->AllocateRaw(size_in_bytes); |
260 } | 260 } |
261 if (result->IsFailure()) old_gen_exhausted_ = true; | 261 if (result->IsFailure()) old_gen_exhausted_ = true; |
262 if (profiler->is_tracking_allocations() && result->To(&object)) { | 262 if (profiler->is_tracking_allocations() && result->To(&object)) { |
263 profiler->NewObjectEvent(object->address(), size_in_bytes); | 263 profiler->AllocationEvent(object->address(), size_in_bytes); |
264 } | 264 } |
265 return result; | 265 return result; |
266 } | 266 } |
267 | 267 |
268 | 268 |
269 MaybeObject* Heap::NumberFromInt32( | 269 MaybeObject* Heap::NumberFromInt32( |
270 int32_t value, PretenureFlag pretenure) { | 270 int32_t value, PretenureFlag pretenure) { |
271 if (Smi::IsValid(value)) return Smi::FromInt(value); | 271 if (Smi::IsValid(value)) return Smi::FromInt(value); |
272 // Bypass NumberFromDouble to avoid various redundant checks. | 272 // Bypass NumberFromDouble to avoid various redundant checks. |
273 return AllocateHeapNumber(FastI2D(value), pretenure); | 273 return AllocateHeapNumber(FastI2D(value), pretenure); |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 #ifdef DEBUG | 871 #ifdef DEBUG |
872 Isolate* isolate = Isolate::Current(); | 872 Isolate* isolate = Isolate::Current(); |
873 isolate->heap()->disallow_allocation_failure_ = old_state_; | 873 isolate->heap()->disallow_allocation_failure_ = old_state_; |
874 #endif | 874 #endif |
875 } | 875 } |
876 | 876 |
877 | 877 |
878 } } // namespace v8::internal | 878 } } // namespace v8::internal |
879 | 879 |
880 #endif // V8_HEAP_INL_H_ | 880 #endif // V8_HEAP_INL_H_ |
OLD | NEW |