| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 Address current_top = allocation_info_.top(); | 267 Address current_top = allocation_info_.top(); |
| 268 Address new_top = current_top + size_in_bytes; | 268 Address new_top = current_top + size_in_bytes; |
| 269 if (new_top > allocation_info_.limit()) return NULL; | 269 if (new_top > allocation_info_.limit()) return NULL; |
| 270 | 270 |
| 271 allocation_info_.set_top(new_top); | 271 allocation_info_.set_top(new_top); |
| 272 return HeapObject::FromAddress(current_top); | 272 return HeapObject::FromAddress(current_top); |
| 273 } | 273 } |
| 274 | 274 |
| 275 | 275 |
| 276 // Raw allocation. | 276 // Raw allocation. |
| 277 MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes, | 277 MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) { |
| 278 AllocationType event) { | |
| 279 HeapProfiler* profiler = heap()->isolate()->heap_profiler(); | |
| 280 | |
| 281 HeapObject* object = AllocateLinearly(size_in_bytes); | 278 HeapObject* object = AllocateLinearly(size_in_bytes); |
| 282 if (object != NULL) { | 279 if (object != NULL) { |
| 283 if (identity() == CODE_SPACE) { | 280 if (identity() == CODE_SPACE) { |
| 284 SkipList::Update(object->address(), size_in_bytes); | 281 SkipList::Update(object->address(), size_in_bytes); |
| 285 } | 282 } |
| 286 if (event == NEW_OBJECT && profiler->is_tracking_allocations()) { | |
| 287 profiler->NewObjectEvent(object->address(), size_in_bytes); | |
| 288 } | |
| 289 return object; | 283 return object; |
| 290 } | 284 } |
| 291 | 285 |
| 292 ASSERT(!heap()->linear_allocation() || | 286 ASSERT(!heap()->linear_allocation() || |
| 293 (anchor_.next_chunk() == &anchor_ && | 287 (anchor_.next_chunk() == &anchor_ && |
| 294 anchor_.prev_chunk() == &anchor_)); | 288 anchor_.prev_chunk() == &anchor_)); |
| 295 | 289 |
| 296 object = free_list_.Allocate(size_in_bytes); | 290 object = free_list_.Allocate(size_in_bytes); |
| 297 if (object != NULL) { | 291 if (object != NULL) { |
| 298 if (identity() == CODE_SPACE) { | 292 if (identity() == CODE_SPACE) { |
| 299 SkipList::Update(object->address(), size_in_bytes); | 293 SkipList::Update(object->address(), size_in_bytes); |
| 300 } | 294 } |
| 301 if (event == NEW_OBJECT && profiler->is_tracking_allocations()) { | |
| 302 profiler->NewObjectEvent(object->address(), size_in_bytes); | |
| 303 } | |
| 304 return object; | 295 return object; |
| 305 } | 296 } |
| 306 | 297 |
| 307 object = SlowAllocateRaw(size_in_bytes); | 298 object = SlowAllocateRaw(size_in_bytes); |
| 308 if (object != NULL) { | 299 if (object != NULL) { |
| 309 if (identity() == CODE_SPACE) { | 300 if (identity() == CODE_SPACE) { |
| 310 SkipList::Update(object->address(), size_in_bytes); | 301 SkipList::Update(object->address(), size_in_bytes); |
| 311 } | 302 } |
| 312 if (event == NEW_OBJECT && profiler->is_tracking_allocations()) { | |
| 313 profiler->NewObjectEvent(object->address(), size_in_bytes); | |
| 314 } | |
| 315 return object; | 303 return object; |
| 316 } | 304 } |
| 317 | 305 |
| 318 return Failure::RetryAfterGC(identity()); | 306 return Failure::RetryAfterGC(identity()); |
| 319 } | 307 } |
| 320 | 308 |
| 321 | 309 |
| 322 // ----------------------------------------------------------------------------- | 310 // ----------------------------------------------------------------------------- |
| 323 // NewSpace | 311 // NewSpace |
| 324 | 312 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 Map* map = object->map(); | 356 Map* map = object->map(); |
| 369 Heap* heap = object->GetHeap(); | 357 Heap* heap = object->GetHeap(); |
| 370 return map == heap->raw_unchecked_free_space_map() | 358 return map == heap->raw_unchecked_free_space_map() |
| 371 || map == heap->raw_unchecked_one_pointer_filler_map() | 359 || map == heap->raw_unchecked_one_pointer_filler_map() |
| 372 || map == heap->raw_unchecked_two_pointer_filler_map(); | 360 || map == heap->raw_unchecked_two_pointer_filler_map(); |
| 373 } | 361 } |
| 374 | 362 |
| 375 } } // namespace v8::internal | 363 } } // namespace v8::internal |
| 376 | 364 |
| 377 #endif // V8_SPACES_INL_H_ | 365 #endif // V8_SPACES_INL_H_ |
| OLD | NEW |