OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // Tests of sampler functionalities. | 4 // Tests of sampler functionalities. |
5 | 5 |
6 #include "src/libsampler/sampler.h" | 6 #include "src/libsampler/sampler.h" |
7 | 7 |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "test/cctest/cctest.h" | 9 #include "test/cctest/cctest.h" |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 private: | 34 private: |
35 Sampler* sampler_; | 35 Sampler* sampler_; |
36 }; | 36 }; |
37 | 37 |
38 | 38 |
39 class TestSampler : public Sampler { | 39 class TestSampler : public Sampler { |
40 public: | 40 public: |
41 explicit TestSampler(Isolate* isolate) : Sampler(isolate) {} | 41 explicit TestSampler(Isolate* isolate) : Sampler(isolate) {} |
42 | 42 |
43 void SampleStack(const v8::RegisterState& regs) override { | 43 void SampleStack(const v8::RegisterState& regs) override { |
44 void* frames[kMaxFramesCount]; | 44 void* frames[Sampler::kMaxFramesCount]; |
45 SampleInfo sample_info; | 45 SampleInfo sample_info; |
46 isolate()->GetStackSample(regs, frames, kMaxFramesCount, &sample_info); | 46 isolate()->GetStackSample(regs, reinterpret_cast<void**>(frames), |
| 47 Sampler::kMaxFramesCount, &sample_info); |
47 if (is_counting_samples_) { | 48 if (is_counting_samples_) { |
48 if (sample_info.vm_state == JS) ++js_sample_count_; | 49 if (sample_info.vm_state == JS) ++js_sample_count_; |
49 if (sample_info.vm_state == EXTERNAL) ++external_sample_count_; | 50 if (sample_info.vm_state == EXTERNAL) ++external_sample_count_; |
50 } | 51 } |
51 } | 52 } |
52 }; | 53 }; |
53 | 54 |
54 | 55 |
55 class TestApiCallbacks { | 56 class TestApiCallbacks { |
56 public: | 57 public: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 CompileRun(sampler_test_source); | 132 CompileRun(sampler_test_source); |
132 v8::Local<v8::Function> function = GetFunction(env.local(), "start"); | 133 v8::Local<v8::Function> function = GetFunction(env.local(), "start"); |
133 | 134 |
134 int32_t repeat_count = 100; | 135 int32_t repeat_count = 100; |
135 v8::Local<v8::Value> args[] = {v8::Integer::New(isolate, repeat_count)}; | 136 v8::Local<v8::Value> args[] = {v8::Integer::New(isolate, repeat_count)}; |
136 RunSampler(env.local(), function, args, arraysize(args), 100, 100); | 137 RunSampler(env.local(), function, args, arraysize(args), 100, 100); |
137 } | 138 } |
138 | 139 |
139 } // namespace sampler | 140 } // namespace sampler |
140 } // namespace v8 | 141 } // namespace v8 |
OLD | NEW |