| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 samples_taken_(0) { | 661 samples_taken_(0) { |
| 662 data_ = new PlatformData; | 662 data_ = new PlatformData; |
| 663 } | 663 } |
| 664 | 664 |
| 665 | 665 |
| 666 Sampler::~Sampler() { | 666 Sampler::~Sampler() { |
| 667 ASSERT(!IsActive()); | 667 ASSERT(!IsActive()); |
| 668 delete data_; | 668 delete data_; |
| 669 } | 669 } |
| 670 | 670 |
| 671 |
| 671 void Sampler::Start() { | 672 void Sampler::Start() { |
| 672 ASSERT(!IsActive()); | 673 ASSERT(!IsActive()); |
| 673 SetActive(true); | 674 SetActive(true); |
| 674 SamplerThread::AddActiveSampler(this); | 675 SamplerThread::AddActiveSampler(this); |
| 675 } | 676 } |
| 676 | 677 |
| 677 | 678 |
| 678 void Sampler::Stop() { | 679 void Sampler::Stop() { |
| 679 ASSERT(IsActive()); | 680 ASSERT(IsActive()); |
| 680 SamplerThread::RemoveActiveSampler(this); | 681 SamplerThread::RemoveActiveSampler(this); |
| 681 SetActive(false); | 682 SetActive(false); |
| 682 } | 683 } |
| 683 | 684 |
| 685 |
| 684 void Sampler::SampleStack(const RegisterState& state) { | 686 void Sampler::SampleStack(const RegisterState& state) { |
| 685 TickSample* sample = isolate_->cpu_profiler()->TickSampleEvent(); | 687 TickSample* sample = isolate_->cpu_profiler()->TickSampleEvent(); |
| 686 TickSample sample_obj; | 688 TickSample sample_obj; |
| 687 if (sample == NULL) sample = &sample_obj; | 689 if (sample == NULL) sample = &sample_obj; |
| 688 sample->Init(isolate_, state); | 690 sample->Init(isolate_, state); |
| 689 if (++samples_taken_ < 0) samples_taken_ = 0; | 691 if (++samples_taken_ < 0) samples_taken_ = 0; |
| 690 Tick(sample); | 692 Tick(sample); |
| 691 } | 693 } |
| 692 | 694 |
| 693 } } // namespace v8::internal | 695 } } // namespace v8::internal |
| OLD | NEW |