Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/spaces-inl.h

Issue 22852024: Track JS allocations as they arrive with no affection on performance when tracking is switched off (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix style + rebase Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/spaces.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_SPACES_INL_H_ 28 #ifndef V8_SPACES_INL_H_
29 #define V8_SPACES_INL_H_ 29 #define V8_SPACES_INL_H_
30 30
31 #include "heap-profiler.h"
31 #include "isolate.h" 32 #include "isolate.h"
32 #include "spaces.h" 33 #include "spaces.h"
33 #include "v8memory.h" 34 #include "v8memory.h"
34 35
35 namespace v8 { 36 namespace v8 {
36 namespace internal { 37 namespace internal {
37 38
38 39
39 // ----------------------------------------------------------------------------- 40 // -----------------------------------------------------------------------------
40 // Bitmap 41 // Bitmap
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 Address current_top = allocation_info_.top; 267 Address current_top = allocation_info_.top;
267 Address new_top = current_top + size_in_bytes; 268 Address new_top = current_top + size_in_bytes;
268 if (new_top > allocation_info_.limit) return NULL; 269 if (new_top > allocation_info_.limit) return NULL;
269 270
270 allocation_info_.top = new_top; 271 allocation_info_.top = new_top;
271 return HeapObject::FromAddress(current_top); 272 return HeapObject::FromAddress(current_top);
272 } 273 }
273 274
274 275
275 // Raw allocation. 276 // Raw allocation.
276 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
277 HeapObject* object = AllocateLinearly(size_in_bytes); 281 HeapObject* object = AllocateLinearly(size_in_bytes);
278 if (object != NULL) { 282 if (object != NULL) {
279 if (identity() == CODE_SPACE) { 283 if (identity() == CODE_SPACE) {
280 SkipList::Update(object->address(), size_in_bytes); 284 SkipList::Update(object->address(), size_in_bytes);
281 } 285 }
286 if (event == NEW_OBJECT && profiler->is_tracking_allocations()) {
287 profiler->NewObjectEvent(object->address(), size_in_bytes);
288 }
282 return object; 289 return object;
283 } 290 }
284 291
285 ASSERT(!heap()->linear_allocation() || 292 ASSERT(!heap()->linear_allocation() ||
286 (anchor_.next_chunk() == &anchor_ && 293 (anchor_.next_chunk() == &anchor_ &&
287 anchor_.prev_chunk() == &anchor_)); 294 anchor_.prev_chunk() == &anchor_));
288 295
289 object = free_list_.Allocate(size_in_bytes); 296 object = free_list_.Allocate(size_in_bytes);
290 if (object != NULL) { 297 if (object != NULL) {
291 if (identity() == CODE_SPACE) { 298 if (identity() == CODE_SPACE) {
292 SkipList::Update(object->address(), size_in_bytes); 299 SkipList::Update(object->address(), size_in_bytes);
293 } 300 }
301 if (event == NEW_OBJECT && profiler->is_tracking_allocations()) {
302 profiler->NewObjectEvent(object->address(), size_in_bytes);
303 }
294 return object; 304 return object;
295 } 305 }
296 306
297 object = SlowAllocateRaw(size_in_bytes); 307 object = SlowAllocateRaw(size_in_bytes);
298 if (object != NULL) { 308 if (object != NULL) {
299 if (identity() == CODE_SPACE) { 309 if (identity() == CODE_SPACE) {
300 SkipList::Update(object->address(), size_in_bytes); 310 SkipList::Update(object->address(), size_in_bytes);
301 } 311 }
312 if (event == NEW_OBJECT && profiler->is_tracking_allocations()) {
313 profiler->NewObjectEvent(object->address(), size_in_bytes);
314 }
302 return object; 315 return object;
303 } 316 }
304 317
305 return Failure::RetryAfterGC(identity()); 318 return Failure::RetryAfterGC(identity());
306 } 319 }
307 320
308 321
309 // ----------------------------------------------------------------------------- 322 // -----------------------------------------------------------------------------
310 // NewSpace 323 // NewSpace
311 324
(...skipping 13 matching lines...) Expand all
325 old_top += filler_size; 338 old_top += filler_size;
326 allocation_info_.top += filler_size; 339 allocation_info_.top += filler_size;
327 } 340 }
328 } 341 }
329 #endif 342 #endif
330 343
331 if (allocation_info_.limit - old_top < size_in_bytes) { 344 if (allocation_info_.limit - old_top < size_in_bytes) {
332 return SlowAllocateRaw(size_in_bytes); 345 return SlowAllocateRaw(size_in_bytes);
333 } 346 }
334 347
335 Object* obj = HeapObject::FromAddress(old_top); 348 HeapObject* obj = HeapObject::FromAddress(old_top);
336 allocation_info_.top += size_in_bytes; 349 allocation_info_.top += size_in_bytes;
337 ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); 350 ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_);
338 351
352 HeapProfiler* profiler = heap()->isolate()->heap_profiler();
353 if (profiler != NULL && profiler->is_tracking_allocations()) {
354 profiler->NewObjectEvent(obj->address(), size_in_bytes);
355 }
356
339 return obj; 357 return obj;
340 } 358 }
341 359
342 360
343 LargePage* LargePage::Initialize(Heap* heap, MemoryChunk* chunk) { 361 LargePage* LargePage::Initialize(Heap* heap, MemoryChunk* chunk) {
344 heap->incremental_marking()->SetOldSpacePageFlags(chunk); 362 heap->incremental_marking()->SetOldSpacePageFlags(chunk);
345 return static_cast<LargePage*>(chunk); 363 return static_cast<LargePage*>(chunk);
346 } 364 }
347 365
348 366
349 intptr_t LargeObjectSpace::Available() { 367 intptr_t LargeObjectSpace::Available() {
350 return ObjectSizeFor(heap()->isolate()->memory_allocator()->Available()); 368 return ObjectSizeFor(heap()->isolate()->memory_allocator()->Available());
351 } 369 }
352 370
353 371
354 bool FreeListNode::IsFreeListNode(HeapObject* object) { 372 bool FreeListNode::IsFreeListNode(HeapObject* object) {
355 Map* map = object->map(); 373 Map* map = object->map();
356 Heap* heap = object->GetHeap(); 374 Heap* heap = object->GetHeap();
357 return map == heap->raw_unchecked_free_space_map() 375 return map == heap->raw_unchecked_free_space_map()
358 || map == heap->raw_unchecked_one_pointer_filler_map() 376 || map == heap->raw_unchecked_one_pointer_filler_map()
359 || map == heap->raw_unchecked_two_pointer_filler_map(); 377 || map == heap->raw_unchecked_two_pointer_filler_map();
360 } 378 }
361 379
362 } } // namespace v8::internal 380 } } // namespace v8::internal
363 381
364 #endif // V8_SPACES_INL_H_ 382 #endif // V8_SPACES_INL_H_
OLDNEW
« no previous file with comments | « src/spaces.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698