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

Side by Side Diff: src/compiler.h

Issue 2577263002: [Compiler] Track Ignition background compilation separately in RuntimeStats. (Closed)
Patch Set: Fix crash on accessing compilationinfo in constructor Created 3 years, 11 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
« no previous file with comments | « no previous file | src/compiler.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_COMPILER_H_ 5 #ifndef V8_COMPILER_H_
6 #define V8_COMPILER_H_ 6 #define V8_COMPILER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 enum class State { 156 enum class State {
157 kReadyToPrepare, 157 kReadyToPrepare,
158 kReadyToExecute, 158 kReadyToExecute,
159 kReadyToFinalize, 159 kReadyToFinalize,
160 kSucceeded, 160 kSucceeded,
161 kFailed, 161 kFailed,
162 }; 162 };
163 163
164 CompilationJob(Isolate* isolate, CompilationInfo* info, 164 CompilationJob(Isolate* isolate, CompilationInfo* info,
165 const char* compiler_name, 165 const char* compiler_name,
166 State initial_state = State::kReadyToPrepare) 166 State initial_state = State::kReadyToPrepare);
167 : info_(info),
168 compiler_name_(compiler_name),
169 state_(initial_state),
170 stack_limit_(isolate->stack_guard()->real_climit()) {}
171 virtual ~CompilationJob() {} 167 virtual ~CompilationJob() {}
172 168
173 // Prepare the compile job. Must be called on the main thread. 169 // Prepare the compile job. Must be called on the main thread.
174 MUST_USE_RESULT Status PrepareJob(); 170 MUST_USE_RESULT Status PrepareJob();
175 171
176 // Executes the compile job. Can be called on a background thread if 172 // Executes the compile job. Can be called on a background thread if
177 // can_execute_on_background_thread() returns true. 173 // can_execute_on_background_thread() returns true.
178 MUST_USE_RESULT Status ExecuteJob(); 174 MUST_USE_RESULT Status ExecuteJob();
179 175
180 // Finalizes the compile job. Must be called on the main thread. 176 // Finalizes the compile job. Must be called on the main thread.
181 MUST_USE_RESULT Status FinalizeJob(); 177 MUST_USE_RESULT Status FinalizeJob();
182 178
183 // Report a transient failure, try again next time. Should only be called on 179 // Report a transient failure, try again next time. Should only be called on
184 // optimization compilation jobs. 180 // optimization compilation jobs.
185 Status RetryOptimization(BailoutReason reason); 181 Status RetryOptimization(BailoutReason reason);
186 182
187 // Report a persistent failure, disable future optimization on the function. 183 // Report a persistent failure, disable future optimization on the function.
188 // Should only be called on optimization compilation jobs. 184 // Should only be called on optimization compilation jobs.
189 Status AbortOptimization(BailoutReason reason); 185 Status AbortOptimization(BailoutReason reason);
190 186
191 void RecordOptimizedCompilationStats() const; 187 void RecordOptimizedCompilationStats() const;
192 void RecordUnoptimizedCompilationStats() const; 188 void RecordUnoptimizedCompilationStats() const;
193 189
194 virtual bool can_execute_on_background_thread() const { return true; } 190 virtual bool can_execute_on_background_thread() const { return true; }
195 191
196 void set_stack_limit(uintptr_t stack_limit) { stack_limit_ = stack_limit; } 192 void set_stack_limit(uintptr_t stack_limit) { stack_limit_ = stack_limit; }
197 uintptr_t stack_limit() const { return stack_limit_; } 193 uintptr_t stack_limit() const { return stack_limit_; }
198 194
195 bool executed_on_background_thread() const {
196 DCHECK_IMPLIES(!can_execute_on_background_thread(),
197 !executed_on_background_thread_);
198 return executed_on_background_thread_;
199 }
199 State state() const { return state_; } 200 State state() const { return state_; }
200 CompilationInfo* info() const { return info_; } 201 CompilationInfo* info() const { return info_; }
201 Isolate* isolate() const; 202 Isolate* isolate() const;
202 203
203 protected: 204 protected:
204 // Overridden by the actual implementation. 205 // Overridden by the actual implementation.
205 virtual Status PrepareJobImpl() = 0; 206 virtual Status PrepareJobImpl() = 0;
206 virtual Status ExecuteJobImpl() = 0; 207 virtual Status ExecuteJobImpl() = 0;
207 virtual Status FinalizeJobImpl() = 0; 208 virtual Status FinalizeJobImpl() = 0;
208 209
209 // Registers weak object to optimized code dependencies. 210 // Registers weak object to optimized code dependencies.
210 // TODO(turbofan): Move this to pipeline.cc once Crankshaft dies. 211 // TODO(turbofan): Move this to pipeline.cc once Crankshaft dies.
211 void RegisterWeakObjectsInOptimizedCode(Handle<Code> code); 212 void RegisterWeakObjectsInOptimizedCode(Handle<Code> code);
212 213
213 private: 214 private:
214 CompilationInfo* info_; 215 CompilationInfo* info_;
216 ThreadId isolate_thread_id_;
215 base::TimeDelta time_taken_to_prepare_; 217 base::TimeDelta time_taken_to_prepare_;
216 base::TimeDelta time_taken_to_execute_; 218 base::TimeDelta time_taken_to_execute_;
217 base::TimeDelta time_taken_to_finalize_; 219 base::TimeDelta time_taken_to_finalize_;
218 const char* compiler_name_; 220 const char* compiler_name_;
219 State state_; 221 State state_;
220 uintptr_t stack_limit_; 222 uintptr_t stack_limit_;
223 bool executed_on_background_thread_;
221 224
222 MUST_USE_RESULT Status UpdateState(Status status, State next_state) { 225 MUST_USE_RESULT Status UpdateState(Status status, State next_state) {
223 if (status == SUCCEEDED) { 226 if (status == SUCCEEDED) {
224 state_ = next_state; 227 state_ = next_state;
225 } else { 228 } else {
226 state_ = State::kFailed; 229 state_ = State::kFailed;
227 } 230 }
228 return status; 231 return status;
229 } 232 }
230 }; 233 };
231 234
232 } // namespace internal 235 } // namespace internal
233 } // namespace v8 236 } // namespace v8
234 237
235 #endif // V8_COMPILER_H_ 238 #endif // V8_COMPILER_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698