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

Side by Side Diff: src/heap.cc

Issue 13982023: Do not dereference handles during relocation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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
« src/heap.h ('K') | « src/heap.h ('k') | src/heap-inl.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 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 } 1293 }
1294 return NULL; 1294 return NULL;
1295 } 1295 }
1296 1296
1297 private: 1297 private:
1298 Heap* heap_; 1298 Heap* heap_;
1299 }; 1299 };
1300 1300
1301 1301
1302 void Heap::Scavenge() { 1302 void Heap::Scavenge() {
1303 RelocationLock relocation_lock(this);
1304
1303 #ifdef VERIFY_HEAP 1305 #ifdef VERIFY_HEAP
1304 if (FLAG_verify_heap) VerifyNonPointerSpacePointers(); 1306 if (FLAG_verify_heap) VerifyNonPointerSpacePointers();
1305 #endif 1307 #endif
1306 1308
1307 gc_state_ = SCAVENGE; 1309 gc_state_ = SCAVENGE;
1308 1310
1309 // Implements Cheney's copying algorithm 1311 // Implements Cheney's copying algorithm
1310 LOG(isolate_, ResourceEvent("scavenge", "begin")); 1312 LOG(isolate_, ResourceEvent("scavenge", "begin"));
1311 1313
1312 // Clear descriptor cache. 1314 // Clear descriptor cache.
(...skipping 5315 matching lines...) Expand 10 before | Expand all | Expand 10 after
6628 } else { 6630 } else {
6629 set_hash_seed(Smi::FromInt(FLAG_hash_seed)); 6631 set_hash_seed(Smi::FromInt(FLAG_hash_seed));
6630 } 6632 }
6631 } 6633 }
6632 6634
6633 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); 6635 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity()));
6634 LOG(isolate_, IntPtrTEvent("heap-available", Available())); 6636 LOG(isolate_, IntPtrTEvent("heap-available", Available()));
6635 6637
6636 store_buffer()->SetUp(); 6638 store_buffer()->SetUp();
6637 6639
6640 if (FLAG_parallel_recompilation) relocation_mutex_ = OS::CreateMutex();
6641 #ifdef DEBUG
6642 relocation_mutex_locked_by_optimizer_thread_ = false;
6643 #endif // DEBUG
6644
6638 return true; 6645 return true;
6639 } 6646 }
6640 6647
6641 bool Heap::CreateHeapObjects() { 6648 bool Heap::CreateHeapObjects() {
6642 // Create initial maps. 6649 // Create initial maps.
6643 if (!CreateInitialMaps()) return false; 6650 if (!CreateInitialMaps()) return false;
6644 if (!CreateApiObjects()) return false; 6651 if (!CreateApiObjects()) return false;
6645 6652
6646 // Create initial objects 6653 // Create initial objects
6647 if (!CreateInitialObjects()) return false; 6654 if (!CreateInitialObjects()) return false;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
6730 if (lo_space_ != NULL) { 6737 if (lo_space_ != NULL) {
6731 lo_space_->TearDown(); 6738 lo_space_->TearDown();
6732 delete lo_space_; 6739 delete lo_space_;
6733 lo_space_ = NULL; 6740 lo_space_ = NULL;
6734 } 6741 }
6735 6742
6736 store_buffer()->TearDown(); 6743 store_buffer()->TearDown();
6737 incremental_marking()->TearDown(); 6744 incremental_marking()->TearDown();
6738 6745
6739 isolate_->memory_allocator()->TearDown(); 6746 isolate_->memory_allocator()->TearDown();
6747
6748 delete relocation_mutex_;
6740 } 6749 }
6741 6750
6742 6751
6743 void Heap::AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type) { 6752 void Heap::AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type) {
6744 ASSERT(callback != NULL); 6753 ASSERT(callback != NULL);
6745 GCPrologueCallbackPair pair(callback, gc_type); 6754 GCPrologueCallbackPair pair(callback, gc_type);
6746 ASSERT(!gc_prologue_callbacks_.Contains(pair)); 6755 ASSERT(!gc_prologue_callbacks_.Contains(pair));
6747 return gc_prologue_callbacks_.Add(pair); 6756 return gc_prologue_callbacks_.Add(pair);
6748 } 6757 }
6749 6758
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
7859 counters->size_of_FIXED_ARRAY_##name()->Decrement( \ 7868 counters->size_of_FIXED_ARRAY_##name()->Decrement( \
7860 static_cast<int>(object_sizes_last_time_[index])); 7869 static_cast<int>(object_sizes_last_time_[index]));
7861 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7870 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7862 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7871 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7863 7872
7864 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7873 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7865 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7874 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7866 ClearObjectStats(); 7875 ClearObjectStats();
7867 } 7876 }
7868 7877
7878
7879 Heap::RelocationLock::RelocationLock(Heap* heap) : heap_(heap) {
7880 if (FLAG_parallel_recompilation) {
7881 heap_->relocation_mutex_->Lock();
7882 #ifdef DEBUG
7883 heap_->relocation_mutex_locked_by_optimizer_thread_ =
7884 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
7885 #endif // DEBUG
7886 }
7887 }
7888
7869 } } // namespace v8::internal 7889 } } // namespace v8::internal
OLDNEW
« src/heap.h ('K') | « src/heap.h ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698