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

Side by Side Diff: src/heap.cc

Issue 23625003: Cleanup Mutex and related classes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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.h ('k') | src/isolate.h » ('j') | src/isolate.cc » ('J')
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 6879 matching lines...) Expand 10 before | Expand all | Expand 10 after
6890 } else { 6890 } else {
6891 set_hash_seed(Smi::FromInt(FLAG_hash_seed)); 6891 set_hash_seed(Smi::FromInt(FLAG_hash_seed));
6892 } 6892 }
6893 } 6893 }
6894 6894
6895 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); 6895 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity()));
6896 LOG(isolate_, IntPtrTEvent("heap-available", Available())); 6896 LOG(isolate_, IntPtrTEvent("heap-available", Available()));
6897 6897
6898 store_buffer()->SetUp(); 6898 store_buffer()->SetUp();
6899 6899
6900 if (FLAG_concurrent_recompilation) relocation_mutex_ = OS::CreateMutex(); 6900 if (FLAG_concurrent_recompilation) relocation_mutex_ = new Mutex;
6901 #ifdef DEBUG 6901 #ifdef DEBUG
6902 relocation_mutex_locked_by_optimizer_thread_ = false; 6902 relocation_mutex_locked_by_optimizer_thread_ = false;
6903 #endif // DEBUG 6903 #endif // DEBUG
6904 6904
6905 return true; 6905 return true;
6906 } 6906 }
6907 6907
6908 6908
6909 bool Heap::CreateHeapObjects() { 6909 bool Heap::CreateHeapObjects() {
6910 // Create initial maps. 6910 // Create initial maps.
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
7995 memset(object_counts_last_time_, 0, sizeof(object_counts_last_time_)); 7995 memset(object_counts_last_time_, 0, sizeof(object_counts_last_time_));
7996 memset(object_sizes_last_time_, 0, sizeof(object_sizes_last_time_)); 7996 memset(object_sizes_last_time_, 0, sizeof(object_sizes_last_time_));
7997 } 7997 }
7998 } 7998 }
7999 7999
8000 8000
8001 static LazyMutex checkpoint_object_stats_mutex = LAZY_MUTEX_INITIALIZER; 8001 static LazyMutex checkpoint_object_stats_mutex = LAZY_MUTEX_INITIALIZER;
8002 8002
8003 8003
8004 void Heap::CheckpointObjectStats() { 8004 void Heap::CheckpointObjectStats() {
8005 ScopedLock lock(checkpoint_object_stats_mutex.Pointer()); 8005 LockGuard<Mutex> lock_guard(checkpoint_object_stats_mutex.Pointer());
8006 Counters* counters = isolate()->counters(); 8006 Counters* counters = isolate()->counters();
8007 #define ADJUST_LAST_TIME_OBJECT_COUNT(name) \ 8007 #define ADJUST_LAST_TIME_OBJECT_COUNT(name) \
8008 counters->count_of_##name()->Increment( \ 8008 counters->count_of_##name()->Increment( \
8009 static_cast<int>(object_counts_[name])); \ 8009 static_cast<int>(object_counts_[name])); \
8010 counters->count_of_##name()->Decrement( \ 8010 counters->count_of_##name()->Decrement( \
8011 static_cast<int>(object_counts_last_time_[name])); \ 8011 static_cast<int>(object_counts_last_time_[name])); \
8012 counters->size_of_##name()->Increment( \ 8012 counters->size_of_##name()->Increment( \
8013 static_cast<int>(object_sizes_[name])); \ 8013 static_cast<int>(object_sizes_[name])); \
8014 counters->size_of_##name()->Decrement( \ 8014 counters->size_of_##name()->Decrement( \
8015 static_cast<int>(object_sizes_last_time_[name])); 8015 static_cast<int>(object_sizes_last_time_[name]));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
8051 if (FLAG_concurrent_recompilation) { 8051 if (FLAG_concurrent_recompilation) {
8052 heap_->relocation_mutex_->Lock(); 8052 heap_->relocation_mutex_->Lock();
8053 #ifdef DEBUG 8053 #ifdef DEBUG
8054 heap_->relocation_mutex_locked_by_optimizer_thread_ = 8054 heap_->relocation_mutex_locked_by_optimizer_thread_ =
8055 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); 8055 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
8056 #endif // DEBUG 8056 #endif // DEBUG
8057 } 8057 }
8058 } 8058 }
8059 8059
8060 } } // namespace v8::internal 8060 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/isolate.h » ('j') | src/isolate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698