Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 3196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3207 | 3207 |
| 3208 | 3208 |
| 3209 void V8::SetGlobalGCEpilogueCallback(GCCallback callback) { | 3209 void V8::SetGlobalGCEpilogueCallback(GCCallback callback) { |
| 3210 if (IsDeadCheck("v8::V8::SetGlobalGCEpilogueCallback()")) return; | 3210 if (IsDeadCheck("v8::V8::SetGlobalGCEpilogueCallback()")) return; |
| 3211 i::Heap::SetGlobalGCEpilogueCallback(callback); | 3211 i::Heap::SetGlobalGCEpilogueCallback(callback); |
| 3212 } | 3212 } |
| 3213 | 3213 |
| 3214 | 3214 |
| 3215 void V8::PauseProfiler() { | 3215 void V8::PauseProfiler() { |
| 3216 #ifdef ENABLE_LOGGING_AND_PROFILING | 3216 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 3217 i::Logger::PauseProfiler(); | 3217 i::Logger::PauseProfiler(PROFILER_MODULE_CPU); |
| 3218 #endif | 3218 #endif |
| 3219 } | 3219 } |
| 3220 | 3220 |
| 3221 | 3221 |
| 3222 void V8::ResumeProfiler() { | 3222 void V8::ResumeProfiler() { |
| 3223 #ifdef ENABLE_LOGGING_AND_PROFILING | 3223 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 3224 i::Logger::ResumeProfiler(); | 3224 i::Logger::ResumeProfiler(PROFILER_MODULE_CPU); |
| 3225 #endif | 3225 #endif |
| 3226 } | 3226 } |
| 3227 | 3227 |
| 3228 | 3228 |
| 3229 bool V8::IsProfilerPaused() { | 3229 bool V8::IsProfilerPaused() { |
| 3230 #ifdef ENABLE_LOGGING_AND_PROFILING | 3230 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 3231 return i::Logger::IsProfilerPaused(); | 3231 return i::Logger::GetActiveProfilerModules() & PROFILER_MODULE_CPU; |
| 3232 #else | 3232 #else |
| 3233 return true; | 3233 return true; |
| 3234 #endif | 3234 #endif |
| 3235 } | 3235 } |
| 3236 | 3236 |
| 3237 | 3237 |
| 3238 void V8::ResumeProfilerEx(int flags) { | 3238 void V8::ResumeProfilerEx(int flags) { |
| 3239 #ifdef ENABLE_LOGGING_AND_PROFILING | 3239 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 3240 if (flags & PROFILER_MODULE_CPU) { | 3240 if (flags & PROFILER_MODULE_HEAP_SNAPSHOT) { |
| 3241 i::Logger::ResumeProfiler(); | 3241 // Snapshot mode: resume modules, perform GC, then pause only |
| 3242 } | 3242 // those modules which haven't been started prior to making a |
| 3243 if (flags & (PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS)) { | 3243 // snapshot. |
| 3244 i::FLAG_log_gc = true; | 3244 |
| 3245 // Reset snapshot flag. | |
| 3246 flags &= ~PROFILER_MODULE_HEAP_SNAPSHOT; | |
|
Søren Thygesen Gjesse
2009/08/04 13:44:55
Should PROFILER_MODULE_CPU be masked out here as w
mnaganov (inactive)
2009/08/04 14:12:38
Combining CPU profiling with snapshot makes no sen
| |
| 3247 const int current_flags = i::Logger::GetActiveProfilerModules(); | |
| 3248 i::Logger::ResumeProfiler(flags); | |
| 3249 i::Heap::CollectAllGarbage(); | |
| 3250 i::Logger::PauseProfiler(~current_flags & flags); | |
| 3251 } else { | |
| 3252 i::Logger::ResumeProfiler(flags); | |
| 3245 } | 3253 } |
| 3246 #endif | 3254 #endif |
| 3247 } | 3255 } |
| 3248 | 3256 |
| 3249 | 3257 |
| 3250 void V8::PauseProfilerEx(int flags) { | 3258 void V8::PauseProfilerEx(int flags) { |
| 3251 #ifdef ENABLE_LOGGING_AND_PROFILING | 3259 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 3252 if (flags & PROFILER_MODULE_CPU) { | 3260 i::Logger::PauseProfiler(flags); |
| 3253 i::Logger::PauseProfiler(); | |
| 3254 } | |
| 3255 if (flags & (PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS)) { | |
| 3256 i::FLAG_log_gc = false; | |
| 3257 } | |
| 3258 #endif | 3261 #endif |
| 3259 } | 3262 } |
| 3260 | 3263 |
| 3261 | 3264 |
| 3262 int V8::GetActiveProfilerModules() { | 3265 int V8::GetActiveProfilerModules() { |
| 3263 #ifdef ENABLE_LOGGING_AND_PROFILING | 3266 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 3264 int result = PROFILER_MODULE_NONE; | 3267 return i::Logger::GetActiveProfilerModules(); |
| 3265 if (!i::Logger::IsProfilerPaused()) { | |
| 3266 result |= PROFILER_MODULE_CPU; | |
| 3267 } | |
| 3268 if (i::FLAG_log_gc) { | |
| 3269 result |= PROFILER_MODULE_HEAP_STATS | PROFILER_MODULE_JS_CONSTRUCTORS; | |
| 3270 } | |
| 3271 return result; | |
| 3272 #else | 3268 #else |
| 3273 return PROFILER_MODULE_NONE; | 3269 return PROFILER_MODULE_NONE; |
| 3274 #endif | 3270 #endif |
| 3275 } | 3271 } |
| 3276 | 3272 |
| 3277 | 3273 |
| 3278 int V8::GetLogLines(int from_pos, char* dest_buf, int max_size) { | 3274 int V8::GetLogLines(int from_pos, char* dest_buf, int max_size) { |
| 3279 #ifdef ENABLE_LOGGING_AND_PROFILING | 3275 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 3280 return i::Logger::GetLogLines(from_pos, dest_buf, max_size); | 3276 return i::Logger::GetLogLines(from_pos, dest_buf, max_size); |
| 3281 #endif | 3277 #endif |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3623 reinterpret_cast<HandleScopeImplementer*>(storage); | 3619 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 3624 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); | 3620 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); |
| 3625 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = | 3621 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = |
| 3626 &thread_local->handle_scope_data_; | 3622 &thread_local->handle_scope_data_; |
| 3627 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); | 3623 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); |
| 3628 | 3624 |
| 3629 return storage + ArchiveSpacePerThread(); | 3625 return storage + ArchiveSpacePerThread(); |
| 3630 } | 3626 } |
| 3631 | 3627 |
| 3632 } } // namespace v8::internal | 3628 } } // namespace v8::internal |
| OLD | NEW |