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

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

Issue 136633002: Inline AllocationMemento::FindForHeapObject() into the two call sites. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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 | « no previous file | src/objects.h » ('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 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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 478 }
479 479
480 480
481 void Heap::ScavengePointer(HeapObject** p) { 481 void Heap::ScavengePointer(HeapObject** p) {
482 ScavengeObject(p, *p); 482 ScavengeObject(p, *p);
483 } 483 }
484 484
485 485
486 void Heap::UpdateAllocationSiteFeedback(HeapObject* object) { 486 void Heap::UpdateAllocationSiteFeedback(HeapObject* object) {
487 Heap* heap = object->GetHeap(); 487 Heap* heap = object->GetHeap();
488 if (FLAG_allocation_site_pretenuring && 488 ASSERT(heap->InNewSpace(object));
489 heap->new_space_high_promotion_mode_active_ && 489
490 AllocationSite::CanTrack(object->map()->instance_type())) { 490 if (!FLAG_allocation_site_pretenuring ||
491 AllocationMemento* memento = AllocationMemento::FindForHeapObject( 491 !heap->new_space_high_promotion_mode_active_ ||
492 object, heap, true); 492 !AllocationSite::CanTrack(object->map()->instance_type())) return;
493 if (memento != NULL) { 493
494 ASSERT(memento->IsValid()); 494 // Either object is the last object in the from space, or there is another
495 bool add_to_scratchpad = 495 // object of at least word size (the header map word) following it, so
496 memento->GetAllocationSite()->IncrementMementoFoundCount(); 496 // suffices to compare ptr and top here.
497 if (add_to_scratchpad && heap->allocation_sites_scratchpad_length < 497 Address ptr = object->address() + object->Size();
498 kAllocationSiteScratchpadSize) { 498 Address top = heap->new_space()->FromSpacePageHigh();
499 heap->allocation_sites_scratchpad[ 499 ASSERT(ptr == top || ptr + HeapObject::kHeaderSize <= top);
500 heap->allocation_sites_scratchpad_length++] = 500 if (ptr == top) return;
501 memento->GetAllocationSite(); 501
502 } 502 HeapObject* candidate = HeapObject::FromAddress(ptr);
503 } 503 if (candidate->map() != heap->allocation_memento_map()) return;
504
505 AllocationMemento* memento = AllocationMemento::cast(candidate);
506 if (!memento->IsValid()) return;
507
508 if (memento->GetAllocationSite()->IncrementMementoFoundCount() &&
509 heap->allocation_sites_scratchpad_length <
510 kAllocationSiteScratchpadSize) {
511 heap->allocation_sites_scratchpad[
512 heap->allocation_sites_scratchpad_length++] =
513 memento->GetAllocationSite();
504 } 514 }
505 } 515 }
506 516
507 517
508 void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { 518 void Heap::ScavengeObject(HeapObject** p, HeapObject* object) {
509 ASSERT(object->GetIsolate()->heap()->InFromSpace(object)); 519 ASSERT(object->GetIsolate()->heap()->InFromSpace(object));
510 520
511 // We use the first word (where the map pointer usually is) of a heap 521 // We use the first word (where the map pointer usually is) of a heap
512 // object to record the forwarding pointer. A forwarding pointer can 522 // object to record the forwarding pointer. A forwarding pointer can
513 // point to an old space, the code space, or the to space of the new 523 // point to an old space, the code space, or the to space of the new
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 #ifdef DEBUG 831 #ifdef DEBUG
822 Isolate* isolate = Isolate::Current(); 832 Isolate* isolate = Isolate::Current();
823 isolate->heap()->disallow_allocation_failure_ = old_state_; 833 isolate->heap()->disallow_allocation_failure_ = old_state_;
824 #endif 834 #endif
825 } 835 }
826 836
827 837
828 } } // namespace v8::internal 838 } } // namespace v8::internal
829 839
830 #endif // V8_HEAP_INL_H_ 840 #endif // V8_HEAP_INL_H_
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698