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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // the thread that created it. | 44 // the thread that created it. |
45 | 45 |
46 // TickSample captures the information collected for each sample. | 46 // TickSample captures the information collected for each sample. |
47 struct TickSample { | 47 struct TickSample { |
48 TickSample() | 48 TickSample() |
49 : state(OTHER), | 49 : state(OTHER), |
50 pc(NULL), | 50 pc(NULL), |
51 sp(NULL), | 51 sp(NULL), |
52 fp(NULL), | 52 fp(NULL), |
53 external_callback(NULL), | 53 external_callback(NULL), |
54 frames_count(0) {} | 54 frames_count(0), |
| 55 has_external_callback(false) {} |
55 void Trace(Isolate* isolate); | 56 void Trace(Isolate* isolate); |
56 StateTag state; // The state of the VM. | 57 StateTag state; // The state of the VM. |
57 Address pc; // Instruction pointer. | 58 Address pc; // Instruction pointer. |
58 Address sp; // Stack pointer. | 59 Address sp; // Stack pointer. |
59 Address fp; // Frame pointer. | 60 Address fp; // Frame pointer. |
60 Address external_callback; | 61 union { |
| 62 Address tos; // Top stack value (*sp). |
| 63 Address external_callback; |
| 64 }; |
61 static const int kMaxFramesCount = 64; | 65 static const int kMaxFramesCount = 64; |
62 Address stack[kMaxFramesCount]; // Call stack. | 66 Address stack[kMaxFramesCount]; // Call stack. |
63 int frames_count : 8; // Number of captured frames. | 67 int frames_count : 8; // Number of captured frames. |
| 68 bool has_external_callback : 1; |
64 }; | 69 }; |
65 | 70 |
66 class Sampler { | 71 class Sampler { |
67 public: | 72 public: |
68 // Initializes the Sampler support. Called once at VM startup. | 73 // Initializes the Sampler support. Called once at VM startup. |
69 static void SetUp(); | 74 static void SetUp(); |
70 static void TearDown(); | 75 static void TearDown(); |
71 | 76 |
72 // Initialize sampler. | 77 // Initialize sampler. |
73 Sampler(Isolate* isolate, int interval); | 78 Sampler(Isolate* isolate, int interval); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 Atomic32 active_; | 116 Atomic32 active_; |
112 PlatformData* data_; // Platform specific data. | 117 PlatformData* data_; // Platform specific data. |
113 int samples_taken_; // Counts stack samples taken. | 118 int samples_taken_; // Counts stack samples taken. |
114 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 119 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
115 }; | 120 }; |
116 | 121 |
117 | 122 |
118 } } // namespace v8::internal | 123 } } // namespace v8::internal |
119 | 124 |
120 #endif // V8_SAMPLER_H_ | 125 #endif // V8_SAMPLER_H_ |
OLD | NEW |