blob: 499f0be4c259ec4e71cfa10344ba3d77ff65c2e9 [file] [log] [blame]
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001// Copyright 2012 the V8 project authors. All rights reserved.
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Ben Murdochb0fe1622011-05-05 13:52:32 +01004
5#ifndef V8_RUNTIME_PROFILER_H_
6#define V8_RUNTIME_PROFILER_H_
7
Ben Murdochb8a8cc12014-11-26 15:28:44 +00008#include "src/allocation.h"
Ben Murdochb0fe1622011-05-05 13:52:32 +01009
10namespace v8 {
11namespace internal {
12
Steve Block44f0eee2011-05-26 01:26:41 +010013class Isolate;
14class JSFunction;
Steve Block44f0eee2011-05-26 01:26:41 +010015
Steve Block44f0eee2011-05-26 01:26:41 +010016class RuntimeProfiler {
Ben Murdochb0fe1622011-05-05 13:52:32 +010017 public:
Steve Block44f0eee2011-05-26 01:26:41 +010018 explicit RuntimeProfiler(Isolate* isolate);
Ben Murdochb0fe1622011-05-05 13:52:32 +010019
Ben Murdoch097c5b22016-05-18 11:27:45 +010020 void MarkCandidatesForOptimization();
Ben Murdochb0fe1622011-05-05 13:52:32 +010021
Ben Murdoch3ef787d2012-04-12 10:51:47 +010022 void NotifyICChanged() { any_ic_changed_ = true; }
23
Ben Murdochb8a8cc12014-11-26 15:28:44 +000024 void AttemptOnStackReplacement(JSFunction* function, int nesting_levels = 1);
Ben Murdoch3ef787d2012-04-12 10:51:47 +010025
Steve Block44f0eee2011-05-26 01:26:41 +010026 private:
Ben Murdoch097c5b22016-05-18 11:27:45 +010027 void MaybeOptimizeFullCodegen(JSFunction* function, int frame_count,
28 bool frame_optimized);
Ben Murdochc5610432016-08-08 18:44:38 +010029 void MaybeOptimizeIgnition(JSFunction* function);
Ben Murdoch3ef787d2012-04-12 10:51:47 +010030 void Optimize(JSFunction* function, const char* reason);
Ben Murdochc5610432016-08-08 18:44:38 +010031 void Baseline(JSFunction* function, const char* reason);
Steve Block44f0eee2011-05-26 01:26:41 +010032
Ben Murdochb8a8cc12014-11-26 15:28:44 +000033 bool CodeSizeOKForOSR(Code* shared_code);
Steve Block44f0eee2011-05-26 01:26:41 +010034
Steve Block44f0eee2011-05-26 01:26:41 +010035 Isolate* isolate_;
36
Ben Murdoch3ef787d2012-04-12 10:51:47 +010037 bool any_ic_changed_;
Ben Murdochb0fe1622011-05-05 13:52:32 +010038};
39
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000040} // namespace internal
41} // namespace v8
Ben Murdochb0fe1622011-05-05 13:52:32 +010042
43#endif // V8_RUNTIME_PROFILER_H_