| 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 rec->size = 1; | 366 rec->size = 1; |
| 367 rec->shared = NULL; | 367 rec->shared = NULL; |
| 368 processor_->Enqueue(evt_rec); | 368 processor_->Enqueue(evt_rec); |
| 369 } | 369 } |
| 370 | 370 |
| 371 | 371 |
| 372 CpuProfiler::CpuProfiler(Isolate* isolate) | 372 CpuProfiler::CpuProfiler(Isolate* isolate) |
| 373 : isolate_(isolate), | 373 : isolate_(isolate), |
| 374 sampling_interval_(TimeDelta::FromMicroseconds( | 374 sampling_interval_(TimeDelta::FromMicroseconds( |
| 375 FLAG_cpu_profiler_sampling_interval)), | 375 FLAG_cpu_profiler_sampling_interval)), |
| 376 profiles_(new CpuProfilesCollection()), | 376 profiles_(new CpuProfilesCollection(isolate->heap())), |
| 377 next_profile_uid_(1), | 377 next_profile_uid_(1), |
| 378 generator_(NULL), | 378 generator_(NULL), |
| 379 processor_(NULL), | 379 processor_(NULL), |
| 380 is_profiling_(false) { | 380 is_profiling_(false) { |
| 381 } | 381 } |
| 382 | 382 |
| 383 | 383 |
| 384 CpuProfiler::CpuProfiler(Isolate* isolate, | 384 CpuProfiler::CpuProfiler(Isolate* isolate, |
| 385 CpuProfilesCollection* test_profiles, | 385 CpuProfilesCollection* test_profiles, |
| 386 ProfileGenerator* test_generator, | 386 ProfileGenerator* test_generator, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 403 | 403 |
| 404 | 404 |
| 405 void CpuProfiler::set_sampling_interval(TimeDelta value) { | 405 void CpuProfiler::set_sampling_interval(TimeDelta value) { |
| 406 ASSERT(!is_profiling_); | 406 ASSERT(!is_profiling_); |
| 407 sampling_interval_ = value; | 407 sampling_interval_ = value; |
| 408 } | 408 } |
| 409 | 409 |
| 410 | 410 |
| 411 void CpuProfiler::ResetProfiles() { | 411 void CpuProfiler::ResetProfiles() { |
| 412 delete profiles_; | 412 delete profiles_; |
| 413 profiles_ = new CpuProfilesCollection(); | 413 profiles_ = new CpuProfilesCollection(isolate()->heap()); |
| 414 } | 414 } |
| 415 | 415 |
| 416 | 416 |
| 417 void CpuProfiler::StartProfiling(const char* title, bool record_samples) { | 417 void CpuProfiler::StartProfiling(const char* title, bool record_samples) { |
| 418 if (profiles_->StartProfiling(title, next_profile_uid_++, record_samples)) { | 418 if (profiles_->StartProfiling(title, next_profile_uid_++, record_samples)) { |
| 419 StartProcessorIfNotStarted(); | 419 StartProcessorIfNotStarted(); |
| 420 } | 420 } |
| 421 processor_->AddCurrentStack(isolate_); | 421 processor_->AddCurrentStack(isolate_); |
| 422 } | 422 } |
| 423 | 423 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; | 501 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; |
| 502 Builtins::Name id = static_cast<Builtins::Name>(i); | 502 Builtins::Name id = static_cast<Builtins::Name>(i); |
| 503 rec->start = builtins->builtin(id)->address(); | 503 rec->start = builtins->builtin(id)->address(); |
| 504 rec->builtin_id = id; | 504 rec->builtin_id = id; |
| 505 processor_->Enqueue(evt_rec); | 505 processor_->Enqueue(evt_rec); |
| 506 } | 506 } |
| 507 } | 507 } |
| 508 | 508 |
| 509 | 509 |
| 510 } } // namespace v8::internal | 510 } } // namespace v8::internal |
| OLD | NEW |