| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 has_external_callback(false), |
| 56 top_frame_type(StackFrame::NONE) {} |
| 56 void Trace(Isolate* isolate); | 57 void Trace(Isolate* isolate); |
| 57 StateTag state; // The state of the VM. | 58 StateTag state; // The state of the VM. |
| 58 Address pc; // Instruction pointer. | 59 Address pc; // Instruction pointer. |
| 59 Address sp; // Stack pointer. | 60 Address sp; // Stack pointer. |
| 60 Address fp; // Frame pointer. | 61 Address fp; // Frame pointer. |
| 61 union { | 62 union { |
| 62 Address tos; // Top stack value (*sp). | 63 Address tos; // Top stack value (*sp). |
| 63 Address external_callback; | 64 Address external_callback; |
| 64 }; | 65 }; |
| 65 static const int kMaxFramesCount = 64; | 66 static const int kMaxFramesCount = 64; |
| 66 Address stack[kMaxFramesCount]; // Call stack. | 67 Address stack[kMaxFramesCount]; // Call stack. |
| 67 int frames_count : 8; // Number of captured frames. | 68 int frames_count : 8; // Number of captured frames. |
| 68 bool has_external_callback : 1; | 69 bool has_external_callback : 1; |
| 70 StackFrame::Type top_frame_type : 4; |
| 69 }; | 71 }; |
| 70 | 72 |
| 71 class Sampler { | 73 class Sampler { |
| 72 public: | 74 public: |
| 73 // Initializes the Sampler support. Called once at VM startup. | 75 // Initializes the Sampler support. Called once at VM startup. |
| 74 static void SetUp(); | 76 static void SetUp(); |
| 75 static void TearDown(); | 77 static void TearDown(); |
| 76 | 78 |
| 77 // Initialize sampler. | 79 // Initialize sampler. |
| 78 Sampler(Isolate* isolate, int interval); | 80 Sampler(Isolate* isolate, int interval); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 Atomic32 active_; | 118 Atomic32 active_; |
| 117 PlatformData* data_; // Platform specific data. | 119 PlatformData* data_; // Platform specific data. |
| 118 int samples_taken_; // Counts stack samples taken. | 120 int samples_taken_; // Counts stack samples taken. |
| 119 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 121 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
| 120 }; | 122 }; |
| 121 | 123 |
| 122 | 124 |
| 123 } } // namespace v8::internal | 125 } } // namespace v8::internal |
| 124 | 126 |
| 125 #endif // V8_SAMPLER_H_ | 127 #endif // V8_SAMPLER_H_ |
| OLD | NEW |