OLD | NEW |
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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 | 422 |
423 void CpuProfiler::StartProfiling(String* title, bool record_samples) { | 423 void CpuProfiler::StartProfiling(String* title, bool record_samples) { |
424 StartProfiling(profiles_->GetName(title), record_samples); | 424 StartProfiling(profiles_->GetName(title), record_samples); |
425 } | 425 } |
426 | 426 |
427 | 427 |
428 void CpuProfiler::StartProcessorIfNotStarted() { | 428 void CpuProfiler::StartProcessorIfNotStarted() { |
429 if (processor_ == NULL) { | 429 if (processor_ == NULL) { |
430 Logger* logger = isolate_->logger(); | 430 Logger* logger = isolate_->logger(); |
431 // Disable logging when using the new implementation. | 431 // Disable logging when using the new implementation. |
432 saved_logging_nesting_ = logger->logging_nesting_; | 432 saved_is_logging_ = logger->is_logging_; |
433 logger->logging_nesting_ = 0; | 433 logger->is_logging_ = false; |
434 generator_ = new ProfileGenerator(profiles_); | 434 generator_ = new ProfileGenerator(profiles_); |
435 Sampler* sampler = logger->sampler(); | 435 Sampler* sampler = logger->sampler(); |
436 processor_ = new ProfilerEventsProcessor( | 436 processor_ = new ProfilerEventsProcessor( |
437 generator_, sampler, FLAG_cpu_profiler_sampling_interval); | 437 generator_, sampler, FLAG_cpu_profiler_sampling_interval); |
438 is_profiling_ = true; | 438 is_profiling_ = true; |
439 // Enumerate stuff we already have in the heap. | 439 // Enumerate stuff we already have in the heap. |
440 ASSERT(isolate_->heap()->HasBeenSetUp()); | 440 ASSERT(isolate_->heap()->HasBeenSetUp()); |
441 if (!FLAG_prof_browser_mode) { | 441 if (!FLAG_prof_browser_mode) { |
442 logger->LogCodeObjects(); | 442 logger->LogCodeObjects(); |
443 } | 443 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 delete generator_; | 492 delete generator_; |
493 processor_ = NULL; | 493 processor_ = NULL; |
494 generator_ = NULL; | 494 generator_ = NULL; |
495 if (Sampler::CanSampleOnProfilerEventsProcessorThread()) { | 495 if (Sampler::CanSampleOnProfilerEventsProcessorThread()) { |
496 sampler->SetHasProcessingThread(false); | 496 sampler->SetHasProcessingThread(false); |
497 } | 497 } |
498 if (need_to_stop_sampler_) { | 498 if (need_to_stop_sampler_) { |
499 sampler->Stop(); | 499 sampler->Stop(); |
500 need_to_stop_sampler_ = false; | 500 need_to_stop_sampler_ = false; |
501 } | 501 } |
502 logger->logging_nesting_ = saved_logging_nesting_; | 502 logger->is_logging_ = saved_is_logging_; |
503 } | 503 } |
504 | 504 |
505 | 505 |
506 void CpuProfiler::LogBuiltins() { | 506 void CpuProfiler::LogBuiltins() { |
507 Builtins* builtins = isolate_->builtins(); | 507 Builtins* builtins = isolate_->builtins(); |
508 ASSERT(builtins->is_initialized()); | 508 ASSERT(builtins->is_initialized()); |
509 for (int i = 0; i < Builtins::builtin_count; i++) { | 509 for (int i = 0; i < Builtins::builtin_count; i++) { |
510 CodeEventsContainer evt_rec(CodeEventRecord::REPORT_BUILTIN); | 510 CodeEventsContainer evt_rec(CodeEventRecord::REPORT_BUILTIN); |
511 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; | 511 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; |
512 Builtins::Name id = static_cast<Builtins::Name>(i); | 512 Builtins::Name id = static_cast<Builtins::Name>(i); |
513 rec->start = builtins->builtin(id)->address(); | 513 rec->start = builtins->builtin(id)->address(); |
514 rec->builtin_id = id; | 514 rec->builtin_id = id; |
515 processor_->Enqueue(evt_rec); | 515 processor_->Enqueue(evt_rec); |
516 } | 516 } |
517 } | 517 } |
518 | 518 |
519 | 519 |
520 } } // namespace v8::internal | 520 } } // namespace v8::internal |
OLD | NEW |