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

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: REBASE 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') | 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 6909 matching lines...) Expand 10 before | Expand all | Expand 10 after
6920 } else { 6920 } else {
6921 set_hash_seed(Smi::FromInt(FLAG_hash_seed)); 6921 set_hash_seed(Smi::FromInt(FLAG_hash_seed));
6922 } 6922 }
6923 } 6923 }
6924 6924
6925 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); 6925 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity()));
6926 LOG(isolate_, IntPtrTEvent("heap-available", Available())); 6926 LOG(isolate_, IntPtrTEvent("heap-available", Available()));
6927 6927
6928 store_buffer()->SetUp(); 6928 store_buffer()->SetUp();
6929 6929
6930 if (FLAG_concurrent_recompilation) relocation_mutex_ = OS::CreateMutex(); 6930 if (FLAG_concurrent_recompilation) relocation_mutex_ = new Mutex;
6931 #ifdef DEBUG 6931 #ifdef DEBUG
6932 relocation_mutex_locked_by_optimizer_thread_ = false; 6932 relocation_mutex_locked_by_optimizer_thread_ = false;
6933 #endif // DEBUG 6933 #endif // DEBUG
6934 6934
6935 return true; 6935 return true;
6936 } 6936 }
6937 6937
6938 6938
6939 bool Heap::CreateHeapObjects() { 6939 bool Heap::CreateHeapObjects() {
6940 // Create initial maps. 6940 // Create initial maps.
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
8025 memset(object_counts_last_time_, 0, sizeof(object_counts_last_time_)); 8025 memset(object_counts_last_time_, 0, sizeof(object_counts_last_time_));
8026 memset(object_sizes_last_time_, 0, sizeof(object_sizes_last_time_)); 8026 memset(object_sizes_last_time_, 0, sizeof(object_sizes_last_time_));
8027 } 8027 }
8028 } 8028 }
8029 8029
8030 8030
8031 static LazyMutex checkpoint_object_stats_mutex = LAZY_MUTEX_INITIALIZER; 8031 static LazyMutex checkpoint_object_stats_mutex = LAZY_MUTEX_INITIALIZER;
8032 8032
8033 8033
8034 void Heap::CheckpointObjectStats() { 8034 void Heap::CheckpointObjectStats() {
8035 ScopedLock lock(checkpoint_object_stats_mutex.Pointer()); 8035 LockGuard<Mutex> lock_guard(checkpoint_object_stats_mutex.Pointer());
8036 Counters* counters = isolate()->counters(); 8036 Counters* counters = isolate()->counters();
8037 #define ADJUST_LAST_TIME_OBJECT_COUNT(name) \ 8037 #define ADJUST_LAST_TIME_OBJECT_COUNT(name) \
8038 counters->count_of_##name()->Increment( \ 8038 counters->count_of_##name()->Increment( \
8039 static_cast<int>(object_counts_[name])); \ 8039 static_cast<int>(object_counts_[name])); \
8040 counters->count_of_##name()->Decrement( \ 8040 counters->count_of_##name()->Decrement( \
8041 static_cast<int>(object_counts_last_time_[name])); \ 8041 static_cast<int>(object_counts_last_time_[name])); \
8042 counters->size_of_##name()->Increment( \ 8042 counters->size_of_##name()->Increment( \
8043 static_cast<int>(object_sizes_[name])); \ 8043 static_cast<int>(object_sizes_[name])); \
8044 counters->size_of_##name()->Decrement( \ 8044 counters->size_of_##name()->Decrement( \
8045 static_cast<int>(object_sizes_last_time_[name])); 8045 static_cast<int>(object_sizes_last_time_[name]));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
8081 if (FLAG_concurrent_recompilation) { 8081 if (FLAG_concurrent_recompilation) {
8082 heap_->relocation_mutex_->Lock(); 8082 heap_->relocation_mutex_->Lock();
8083 #ifdef DEBUG 8083 #ifdef DEBUG
8084 heap_->relocation_mutex_locked_by_optimizer_thread_ = 8084 heap_->relocation_mutex_locked_by_optimizer_thread_ =
8085 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); 8085 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
8086 #endif // DEBUG 8086 #endif // DEBUG
8087 } 8087 }
8088 } 8088 }
8089 8089
8090 } } // namespace v8::internal 8090 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698