OLD | NEW |
---|---|
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_RUNTIME_PROFILER_H_ | 5 #ifndef V8_RUNTIME_PROFILER_H_ |
6 #define V8_RUNTIME_PROFILER_H_ | 6 #define V8_RUNTIME_PROFILER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
13 class Isolate; | 13 class Isolate; |
14 class JavaScriptFrame; | 14 class JavaScriptFrame; |
15 class JSFunction; | 15 class JSFunction; |
16 enum class OptimizationReason : uint8_t; | |
16 | 17 |
17 class RuntimeProfiler { | 18 class RuntimeProfiler { |
18 public: | 19 public: |
19 explicit RuntimeProfiler(Isolate* isolate); | 20 explicit RuntimeProfiler(Isolate* isolate); |
20 | 21 |
21 void MarkCandidatesForOptimization(); | 22 void MarkCandidatesForOptimization(); |
22 | 23 |
23 void NotifyICChanged() { any_ic_changed_ = true; } | 24 void NotifyICChanged() { any_ic_changed_ = true; } |
24 | 25 |
25 void AttemptOnStackReplacement(JavaScriptFrame* frame, | 26 void AttemptOnStackReplacement(JavaScriptFrame* frame, |
26 int nesting_levels = 1); | 27 int nesting_levels = 1); |
27 | 28 |
28 private: | 29 private: |
29 void MaybeOptimizeFullCodegen(JSFunction* function, JavaScriptFrame* frame, | 30 void MaybeOptimizeFullCodegen(JSFunction* function, JavaScriptFrame* frame, |
30 int frame_count); | 31 int frame_count); |
31 void MaybeBaselineIgnition(JSFunction* function, JavaScriptFrame* frame); | 32 void MaybeBaselineIgnition(JSFunction* function, JavaScriptFrame* frame); |
32 void MaybeOptimizeIgnition(JSFunction* function, JavaScriptFrame* frame); | 33 void MaybeOptimizeIgnition(JSFunction* function, JavaScriptFrame* frame); |
33 void Optimize(JSFunction* function, const char* reason); | 34 // Potentially attempts OSR from ignition and returns whether no other |
34 void Baseline(JSFunction* function, const char* reason); | 35 // optimization attempts should be made |
rmcilroy
2016/09/23 08:10:34
fullstops on comments, and newline before the comm
klaasb
2016/09/23 08:31:40
The comment is mostly about the intended semantics
| |
36 bool MaybeOSRIgnition(JSFunction* function, JavaScriptFrame* frame); | |
37 void Optimize(JSFunction* function, OptimizationReason reason); | |
38 // Decides whether to optimize the function from Ignition and for what reason | |
39 OptimizationReason OptimizationHeuristicIgnition(JSFunction* function, | |
rmcilroy
2016/09/23 08:10:34
nit - ShouldOptimizeIgnition(...) and move either
klaasb
2016/09/23 08:31:40
Done.
| |
40 JavaScriptFrame* frame); | |
41 void Baseline(JSFunction* function, OptimizationReason reason); | |
35 | 42 |
36 Isolate* isolate_; | 43 Isolate* isolate_; |
37 bool any_ic_changed_; | 44 bool any_ic_changed_; |
38 }; | 45 }; |
39 | 46 |
40 } // namespace internal | 47 } // namespace internal |
41 } // namespace v8 | 48 } // namespace v8 |
42 | 49 |
43 #endif // V8_RUNTIME_PROFILER_H_ | 50 #endif // V8_RUNTIME_PROFILER_H_ |
OLD | NEW |