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

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

Issue 157503002: A64: Synchronize with r18444. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/heap.cc ('k') | src/heap-profiler.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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 } 477 }
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 if (FLAG_allocation_site_pretenuring && object->IsJSObject()) { 487 if (FLAG_allocation_site_pretenuring &&
488 AllocationMemento* memento = AllocationMemento::FindForJSObject( 488 AllocationSite::CanTrack(object->map()->instance_type())) {
489 JSObject::cast(object), true); 489 AllocationMemento* memento = AllocationMemento::FindForHeapObject(
490 object, true);
490 if (memento != NULL) { 491 if (memento != NULL) {
491 ASSERT(memento->IsValid()); 492 ASSERT(memento->IsValid());
492 memento->GetAllocationSite()->IncrementMementoFoundCount(); 493 bool add_to_scratchpad =
494 memento->GetAllocationSite()->IncrementMementoFoundCount();
495 Heap* heap = object->GetIsolate()->heap();
496 if (add_to_scratchpad && heap->allocation_sites_scratchpad_length <
497 kAllocationSiteScratchpadSize) {
498 heap->allocation_sites_scratchpad[
499 heap->allocation_sites_scratchpad_length++] =
500 memento->GetAllocationSite();
501 }
493 } 502 }
494 } 503 }
495 } 504 }
496 505
497 506
498 void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { 507 void Heap::ScavengeObject(HeapObject** p, HeapObject* object) {
499 ASSERT(object->GetIsolate()->heap()->InFromSpace(object)); 508 ASSERT(object->GetIsolate()->heap()->InFromSpace(object));
500 509
501 // We use the first word (where the map pointer usually is) of a heap 510 // 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 511 // object to record the forwarding pointer. A forwarding pointer can
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 return condition ? true_value() : false_value(); 749 return condition ? true_value() : false_value();
741 } 750 }
742 751
743 752
744 void Heap::CompletelyClearInstanceofCache() { 753 void Heap::CompletelyClearInstanceofCache() {
745 set_instanceof_cache_map(the_hole_value()); 754 set_instanceof_cache_map(the_hole_value());
746 set_instanceof_cache_function(the_hole_value()); 755 set_instanceof_cache_function(the_hole_value());
747 } 756 }
748 757
749 758
750 MaybeObject* TranscendentalCache::Get(Type type, double input) {
751 SubCache* cache = caches_[type];
752 if (cache == NULL) {
753 caches_[type] = cache = new SubCache(isolate_, type);
754 }
755 return cache->Get(input);
756 }
757
758
759 Address TranscendentalCache::cache_array_address() {
760 return reinterpret_cast<Address>(caches_);
761 }
762
763
764 double TranscendentalCache::SubCache::Calculate(double input) {
765 switch (type_) {
766 case LOG:
767 return fast_log(input);
768 default:
769 UNREACHABLE();
770 return 0.0; // Never happens.
771 }
772 }
773
774
775 MaybeObject* TranscendentalCache::SubCache::Get(double input) {
776 Converter c;
777 c.dbl = input;
778 int hash = Hash(c);
779 Element e = elements_[hash];
780 if (e.in[0] == c.integers[0] &&
781 e.in[1] == c.integers[1]) {
782 ASSERT(e.output != NULL);
783 isolate_->counters()->transcendental_cache_hit()->Increment();
784 return e.output;
785 }
786 double answer = Calculate(input);
787 isolate_->counters()->transcendental_cache_miss()->Increment();
788 Object* heap_number;
789 { MaybeObject* maybe_heap_number =
790 isolate_->heap()->AllocateHeapNumber(answer);
791 if (!maybe_heap_number->ToObject(&heap_number)) return maybe_heap_number;
792 }
793 elements_[hash].in[0] = c.integers[0];
794 elements_[hash].in[1] = c.integers[1];
795 elements_[hash].output = heap_number;
796 return heap_number;
797 }
798
799
800 AlwaysAllocateScope::AlwaysAllocateScope() { 759 AlwaysAllocateScope::AlwaysAllocateScope() {
801 // We shouldn't hit any nested scopes, because that requires 760 // We shouldn't hit any nested scopes, because that requires
802 // non-handle code to call handle code. The code still works but 761 // non-handle code to call handle code. The code still works but
803 // performance will degrade, so we want to catch this situation 762 // performance will degrade, so we want to catch this situation
804 // in debug mode. 763 // in debug mode.
805 Isolate* isolate = Isolate::Current(); 764 Isolate* isolate = Isolate::Current();
806 ASSERT(isolate->heap()->always_allocate_scope_depth_ == 0); 765 ASSERT(isolate->heap()->always_allocate_scope_depth_ == 0);
807 isolate->heap()->always_allocate_scope_depth_++; 766 isolate->heap()->always_allocate_scope_depth_++;
808 } 767 }
809 768
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 #ifdef DEBUG 817 #ifdef DEBUG
859 Isolate* isolate = Isolate::Current(); 818 Isolate* isolate = Isolate::Current();
860 isolate->heap()->disallow_allocation_failure_ = old_state_; 819 isolate->heap()->disallow_allocation_failure_ = old_state_;
861 #endif 820 #endif
862 } 821 }
863 822
864 823
865 } } // namespace v8::internal 824 } } // namespace v8::internal
866 825
867 #endif // V8_HEAP_INL_H_ 826 #endif // V8_HEAP_INL_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/heap-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698