Line data Source code
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
3 : // found in the LICENSE file.
4 :
5 : #ifndef V8_RUNTIME_PROFILER_H_
6 : #define V8_RUNTIME_PROFILER_H_
7 :
8 : #include "src/allocation.h"
9 :
10 : namespace v8 {
11 : namespace internal {
12 :
13 : class Isolate;
14 : class JavaScriptFrame;
15 : class JSFunction;
16 : enum class OptimizationReason : uint8_t;
17 :
18 : class RuntimeProfiler {
19 : public:
20 : explicit RuntimeProfiler(Isolate* isolate);
21 :
22 : void MarkCandidatesForOptimization();
23 :
24 5738584 : void NotifyICChanged() { any_ic_changed_ = true; }
25 :
26 : void AttemptOnStackReplacement(JavaScriptFrame* frame,
27 : int nesting_levels = 1);
28 :
29 : private:
30 : void MaybeOptimize(JSFunction* function, JavaScriptFrame* frame);
31 : // Potentially attempts OSR from and returns whether no other
32 : // optimization attempts should be made.
33 : bool MaybeOSR(JSFunction* function, JavaScriptFrame* frame);
34 : OptimizationReason ShouldOptimize(JSFunction* function,
35 : JavaScriptFrame* frame);
36 : void Optimize(JSFunction* function, OptimizationReason reason);
37 : void Baseline(JSFunction* function, OptimizationReason reason);
38 :
39 : Isolate* isolate_;
40 : bool any_ic_changed_;
41 : };
42 :
43 : } // namespace internal
44 : } // namespace v8
45 :
46 : #endif // V8_RUNTIME_PROFILER_H_
|