Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: src/runtime-profiler.h

Issue 9361026: Count-based profiling for primitive functions (hidden behind a flag) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: more comments Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.cc ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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() { any_ic_changed_ = true; }
65
66 void NotifyCodeGenerated(int generated_code_size) {
67 if (FLAG_counting_profiler) {
68 code_generated_ = true;
69 total_code_generated_ += generated_code_size;
70 }
71 }
72
64 // Rate limiting support. 73 // Rate limiting support.
65 74
66 // VM thread interface. 75 // VM thread interface.
67 // 76 //
68 // Called by isolates when their states change. 77 // Called by isolates when their states change.
69 static inline void IsolateEnteredJS(Isolate* isolate); 78 static inline void IsolateEnteredJS(Isolate* isolate);
70 static inline void IsolateExitedJS(Isolate* isolate); 79 static inline void IsolateExitedJS(Isolate* isolate);
71 80
72 // Profiler thread interface. 81 // Profiler thread interface.
73 // 82 //
(...skipping 16 matching lines...) Expand all
90 99
91 void UpdateSamplesAfterScavenge(); 100 void UpdateSamplesAfterScavenge();
92 void RemoveDeadSamples(); 101 void RemoveDeadSamples();
93 void UpdateSamplesAfterCompact(ObjectVisitor* visitor); 102 void UpdateSamplesAfterCompact(ObjectVisitor* visitor);
94 103
95 private: 104 private:
96 static const int kSamplerWindowSize = 16; 105 static const int kSamplerWindowSize = 16;
97 106
98 static void HandleWakeUp(Isolate* isolate); 107 static void HandleWakeUp(Isolate* isolate);
99 108
100 void Optimize(JSFunction* function); 109 void Optimize(JSFunction* function, const char* reason);
101 110
102 void AttemptOnStackReplacement(JSFunction* function); 111 void AttemptOnStackReplacement(JSFunction* function);
103 112
104 void ClearSampleBuffer(); 113 void ClearSampleBuffer();
105 114
106 void ClearSampleBufferNewSpaceEntries(); 115 void ClearSampleBufferNewSpaceEntries();
107 116
108 int LookupSample(JSFunction* function); 117 int LookupSample(JSFunction* function);
109 118
110 void AddSample(JSFunction* function, int weight); 119 void AddSample(JSFunction* function, int weight);
111 120
112 Isolate* isolate_; 121 Isolate* isolate_;
113 122
114 int sampler_threshold_; 123 int sampler_threshold_;
115 int sampler_threshold_size_factor_; 124 int sampler_threshold_size_factor_;
116 int sampler_ticks_until_threshold_adjustment_; 125 int sampler_ticks_until_threshold_adjustment_;
117 126
118 Object* sampler_window_[kSamplerWindowSize]; 127 Object* sampler_window_[kSamplerWindowSize];
119 int sampler_window_position_; 128 int sampler_window_position_;
120 int sampler_window_weight_[kSamplerWindowSize]; 129 int sampler_window_weight_[kSamplerWindowSize];
121 130
131 bool any_ic_changed_;
132 bool code_generated_;
133 int total_code_generated_;
134
122 // Possible state values: 135 // Possible state values:
123 // -1 => the profiler thread is waiting on the semaphore 136 // -1 => the profiler thread is waiting on the semaphore
124 // 0 or positive => the number of isolates running JavaScript code. 137 // 0 or positive => the number of isolates running JavaScript code.
125 static Atomic32 state_; 138 static Atomic32 state_;
126 static Semaphore* semaphore_; 139 static Semaphore* semaphore_;
127 140
128 #ifdef DEBUG 141 #ifdef DEBUG
129 static bool has_been_globally_set_up_; 142 static bool has_been_globally_set_up_;
130 #endif 143 #endif
131 static bool enabled_; 144 static bool enabled_;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 179
167 void RuntimeProfiler::IsolateExitedJS(Isolate* isolate) { 180 void RuntimeProfiler::IsolateExitedJS(Isolate* isolate) {
168 Atomic32 new_state = NoBarrier_AtomicIncrement(&state_, -1); 181 Atomic32 new_state = NoBarrier_AtomicIncrement(&state_, -1);
169 ASSERT(new_state >= 0); 182 ASSERT(new_state >= 0);
170 USE(new_state); 183 USE(new_state);
171 } 184 }
172 185
173 } } // namespace v8::internal 186 } } // namespace v8::internal
174 187
175 #endif // V8_RUNTIME_PROFILER_H_ 188 #endif // V8_RUNTIME_PROFILER_H_
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698