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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 if (FLAG_allocation_site_pretenuring && object->IsJSObject()) { | 487 if (FLAG_allocation_site_pretenuring && object->IsJSObject()) { |
488 AllocationMemento* memento = AllocationMemento::FindForJSObject( | 488 AllocationMemento* memento = AllocationMemento::FindForJSObject( |
489 JSObject::cast(object), true); | 489 JSObject::cast(object), true); |
490 if (memento != NULL) { | 490 if (memento != NULL) { |
491 ASSERT(memento->IsValid()); | 491 ASSERT(memento->IsValid()); |
492 memento->GetAllocationSite()->IncrementMementoFoundCount(); | 492 bool add_to_scratchpad = |
| 493 memento->GetAllocationSite()->IncrementMementoFoundCount(); |
| 494 Heap* heap = object->GetIsolate()->heap(); |
| 495 if (add_to_scratchpad && heap->allocation_sites_scratchpad_length < |
| 496 kAllocationSiteScratchpadSize) { |
| 497 heap->allocation_sites_scratchpad[ |
| 498 heap->allocation_sites_scratchpad_length++] = |
| 499 memento->GetAllocationSite(); |
| 500 } |
493 } | 501 } |
494 } | 502 } |
495 } | 503 } |
496 | 504 |
497 | 505 |
498 void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { | 506 void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { |
499 ASSERT(object->GetIsolate()->heap()->InFromSpace(object)); | 507 ASSERT(object->GetIsolate()->heap()->InFromSpace(object)); |
500 | 508 |
501 // We use the first word (where the map pointer usually is) of a heap | 509 // We use the first word (where the map pointer usually is) of a heap |
502 // object to record the forwarding pointer. A forwarding pointer can | 510 // object to record the forwarding pointer. A forwarding pointer can |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 #ifdef DEBUG | 866 #ifdef DEBUG |
859 Isolate* isolate = Isolate::Current(); | 867 Isolate* isolate = Isolate::Current(); |
860 isolate->heap()->disallow_allocation_failure_ = old_state_; | 868 isolate->heap()->disallow_allocation_failure_ = old_state_; |
861 #endif | 869 #endif |
862 } | 870 } |
863 | 871 |
864 | 872 |
865 } } // namespace v8::internal | 873 } } // namespace v8::internal |
866 | 874 |
867 #endif // V8_HEAP_INL_H_ | 875 #endif // V8_HEAP_INL_H_ |
OLD | NEW |