Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 | 4 |
| 5 #ifndef V8_SAMPLER_H_ | 5 #ifndef V8_SAMPLER_H_ |
| 6 #define V8_SAMPLER_H_ | 6 #define V8_SAMPLER_H_ |
| 7 | 7 |
| 8 #include "src/base/atomicops.h" | 8 #include "src/base/atomicops.h" |
| 9 #include "src/frames.h" | 9 #include "src/frames.h" |
| 10 #include "src/globals.h" | 10 #include "src/globals.h" |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 frames_count(0), | 37 frames_count(0), |
| 38 has_external_callback(false), | 38 has_external_callback(false), |
| 39 top_frame_type(StackFrame::NONE) {} | 39 top_frame_type(StackFrame::NONE) {} |
| 40 void Init(Isolate* isolate, const RegisterState& state); | 40 void Init(Isolate* isolate, const RegisterState& state); |
| 41 StateTag state; // The state of the VM. | 41 StateTag state; // The state of the VM. |
| 42 Address pc; // Instruction pointer. | 42 Address pc; // Instruction pointer. |
| 43 union { | 43 union { |
| 44 Address tos; // Top stack value (*sp). | 44 Address tos; // Top stack value (*sp). |
| 45 Address external_callback; | 45 Address external_callback; |
| 46 }; | 46 }; |
| 47 static const int kMaxFramesCount = 64; | 47 static const unsigned kMaxFramesCountLog2 = 8; |
| 48 static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1; | |
|
loislo
2014/06/24 13:09:21
why do you have -1 here?
alph
2014/06/24 13:21:54
the max value that can be stored in frames_count i
| |
| 48 Address stack[kMaxFramesCount]; // Call stack. | 49 Address stack[kMaxFramesCount]; // Call stack. |
| 49 TimeTicks timestamp; | 50 TimeTicks timestamp; |
| 50 int frames_count : 8; // Number of captured frames. | 51 unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames. |
|
Jakob Kummerow
2014/06/24 13:54:37
I'm not sure this will work. IIRC we've had an iss
alph
2014/06/24 14:10:23
MSVC is noisy about implicit signed/unsigned conve
| |
| 51 bool has_external_callback : 1; | 52 bool has_external_callback : 1; |
| 52 StackFrame::Type top_frame_type : 4; | 53 StackFrame::Type top_frame_type : 4; |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 class Sampler { | 56 class Sampler { |
| 56 public: | 57 public: |
| 57 // Initializes the Sampler support. Called once at VM startup. | 58 // Initializes the Sampler support. Called once at VM startup. |
| 58 static void SetUp(); | 59 static void SetUp(); |
| 59 static void TearDown(); | 60 static void TearDown(); |
| 60 | 61 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 bool is_counting_samples_; | 120 bool is_counting_samples_; |
| 120 // Counts stack samples taken in JS VM state. | 121 // Counts stack samples taken in JS VM state. |
| 121 unsigned js_and_external_sample_count_; | 122 unsigned js_and_external_sample_count_; |
| 122 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 123 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
| 123 }; | 124 }; |
| 124 | 125 |
| 125 | 126 |
| 126 } } // namespace v8::internal | 127 } } // namespace v8::internal |
| 127 | 128 |
| 128 #endif // V8_SAMPLER_H_ | 129 #endif // V8_SAMPLER_H_ |
| OLD | NEW |