Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 | 
| 11 // with the distribution. | 11 // with the distribution. | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 | 54 | 
| 55 void NotifyTick(); | 55 void NotifyTick(); | 
| 56 | 56 | 
| 57 void SetUp(); | 57 void SetUp(); | 
| 58 void Reset(); | 58 void Reset(); | 
| 59 void TearDown(); | 59 void TearDown(); | 
| 60 | 60 | 
| 61 Object** SamplerWindowAddress(); | 61 Object** SamplerWindowAddress(); | 
| 62 int SamplerWindowSize(); | 62 int SamplerWindowSize(); | 
| 63 | 63 | 
| 64 void NotifyICChanged() { | |
| 65 any_ic_changed_ = true; | |
| 66 } | |
| 
 
Erik Corry
2012/02/08 14:09:23
Missing blank line.
 
Jakob Kummerow
2012/02/08 15:24:08
Done.
 
 | |
| 67 void NotifyCodeGenerated(int generated_code_size) { | |
| 68 code_generated_ = true; | |
| 69 total_code_generated_ += generated_code_size; | |
| 70 } | |
| 71 | |
| 64 // Rate limiting support. | 72 // Rate limiting support. | 
| 65 | 73 | 
| 66 // VM thread interface. | 74 // VM thread interface. | 
| 67 // | 75 // | 
| 68 // Called by isolates when their states change. | 76 // Called by isolates when their states change. | 
| 69 static inline void IsolateEnteredJS(Isolate* isolate); | 77 static inline void IsolateEnteredJS(Isolate* isolate); | 
| 70 static inline void IsolateExitedJS(Isolate* isolate); | 78 static inline void IsolateExitedJS(Isolate* isolate); | 
| 71 | 79 | 
| 72 // Profiler thread interface. | 80 // Profiler thread interface. | 
| 73 // | 81 // | 
| (...skipping 16 matching lines...) Expand all Loading... | |
| 90 | 98 | 
| 91 void UpdateSamplesAfterScavenge(); | 99 void UpdateSamplesAfterScavenge(); | 
| 92 void RemoveDeadSamples(); | 100 void RemoveDeadSamples(); | 
| 93 void UpdateSamplesAfterCompact(ObjectVisitor* visitor); | 101 void UpdateSamplesAfterCompact(ObjectVisitor* visitor); | 
| 94 | 102 | 
| 95 private: | 103 private: | 
| 96 static const int kSamplerWindowSize = 16; | 104 static const int kSamplerWindowSize = 16; | 
| 97 | 105 | 
| 98 static void HandleWakeUp(Isolate* isolate); | 106 static void HandleWakeUp(Isolate* isolate); | 
| 99 | 107 | 
| 100 void Optimize(JSFunction* function); | 108 void Optimize(JSFunction* function, const char* reason); | 
| 101 | 109 | 
| 102 void AttemptOnStackReplacement(JSFunction* function); | 110 void AttemptOnStackReplacement(JSFunction* function); | 
| 103 | 111 | 
| 104 void ClearSampleBuffer(); | 112 void ClearSampleBuffer(); | 
| 105 | 113 | 
| 106 void ClearSampleBufferNewSpaceEntries(); | 114 void ClearSampleBufferNewSpaceEntries(); | 
| 107 | 115 | 
| 108 int LookupSample(JSFunction* function); | 116 int LookupSample(JSFunction* function); | 
| 109 | 117 | 
| 110 void AddSample(JSFunction* function, int weight); | 118 void AddSample(JSFunction* function, int weight); | 
| 111 | 119 | 
| 112 Isolate* isolate_; | 120 Isolate* isolate_; | 
| 113 | 121 | 
| 114 int sampler_threshold_; | 122 int sampler_threshold_; | 
| 115 int sampler_threshold_size_factor_; | 123 int sampler_threshold_size_factor_; | 
| 116 int sampler_ticks_until_threshold_adjustment_; | 124 int sampler_ticks_until_threshold_adjustment_; | 
| 117 | 125 | 
| 118 Object* sampler_window_[kSamplerWindowSize]; | 126 Object* sampler_window_[kSamplerWindowSize]; | 
| 119 int sampler_window_position_; | 127 int sampler_window_position_; | 
| 120 int sampler_window_weight_[kSamplerWindowSize]; | 128 int sampler_window_weight_[kSamplerWindowSize]; | 
| 121 | 129 | 
| 130 bool any_ic_changed_; | |
| 131 bool code_generated_; | |
| 132 int total_code_generated_; | |
| 133 | |
| 122 // Possible state values: | 134 // Possible state values: | 
| 123 // -1 => the profiler thread is waiting on the semaphore | 135 // -1 => the profiler thread is waiting on the semaphore | 
| 124 // 0 or positive => the number of isolates running JavaScript code. | 136 // 0 or positive => the number of isolates running JavaScript code. | 
| 125 static Atomic32 state_; | 137 static Atomic32 state_; | 
| 126 static Semaphore* semaphore_; | 138 static Semaphore* semaphore_; | 
| 127 | 139 | 
| 128 #ifdef DEBUG | 140 #ifdef DEBUG | 
| 129 static bool has_been_globally_set_up_; | 141 static bool has_been_globally_set_up_; | 
| 130 #endif | 142 #endif | 
| 131 static bool enabled_; | 143 static bool enabled_; | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 | 178 | 
| 167 void RuntimeProfiler::IsolateExitedJS(Isolate* isolate) { | 179 void RuntimeProfiler::IsolateExitedJS(Isolate* isolate) { | 
| 168 Atomic32 new_state = NoBarrier_AtomicIncrement(&state_, -1); | 180 Atomic32 new_state = NoBarrier_AtomicIncrement(&state_, -1); | 
| 169 ASSERT(new_state >= 0); | 181 ASSERT(new_state >= 0); | 
| 170 USE(new_state); | 182 USE(new_state); | 
| 171 } | 183 } | 
| 172 | 184 | 
| 173 } } // namespace v8::internal | 185 } } // namespace v8::internal | 
| 174 | 186 | 
| 175 #endif // V8_RUNTIME_PROFILER_H_ | 187 #endif // V8_RUNTIME_PROFILER_H_ | 
| OLD | NEW |