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 BytecodeArray;
14 : class Isolate;
15 : class InterpretedFrame;
16 : class JSFunction;
17 : enum class OptimizationReason : uint8_t;
18 :
19 : class RuntimeProfiler {
20 : public:
21 : explicit RuntimeProfiler(Isolate* isolate);
22 :
23 : void MarkCandidatesForOptimization();
24 :
25 2979938 : void NotifyICChanged() { any_ic_changed_ = true; }
26 :
27 : void AttemptOnStackReplacement(InterpretedFrame* frame,
28 : int nesting_levels = 1);
29 :
30 : private:
31 : void MaybeOptimize(JSFunction function, InterpretedFrame* frame);
32 : // Potentially attempts OSR from and returns whether no other
33 : // optimization attempts should be made.
34 : bool MaybeOSR(JSFunction function, InterpretedFrame* frame);
35 : OptimizationReason ShouldOptimize(JSFunction function,
36 : BytecodeArray bytecode_array);
37 : void Optimize(JSFunction function, OptimizationReason reason);
38 : void Baseline(JSFunction function, OptimizationReason reason);
39 :
40 : Isolate* isolate_;
41 : bool any_ic_changed_;
42 : };
43 :
44 : } // namespace internal
45 : } // namespace v8
46 :
47 : #endif // V8_RUNTIME_PROFILER_H_
|