blob: eff443d926a883561d05c3833e9b22b7720ac6b4 [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 {
Ben Murdochb8a8cc12014-11-26 15:28:44 +000011
12namespace base {
13class Semaphore;
14}
15
Ben Murdochb0fe1622011-05-05 13:52:32 +010016namespace internal {
17
Steve Block44f0eee2011-05-26 01:26:41 +010018class Isolate;
19class JSFunction;
20class Object;
Steve Block44f0eee2011-05-26 01:26:41 +010021
Steve Block44f0eee2011-05-26 01:26:41 +010022class RuntimeProfiler {
Ben Murdochb0fe1622011-05-05 13:52:32 +010023 public:
Steve Block44f0eee2011-05-26 01:26:41 +010024 explicit RuntimeProfiler(Isolate* isolate);
Ben Murdochb0fe1622011-05-05 13:52:32 +010025
Steve Block44f0eee2011-05-26 01:26:41 +010026 void OptimizeNow();
Ben Murdochb0fe1622011-05-05 13:52:32 +010027
Ben Murdoch3ef787d2012-04-12 10:51:47 +010028 void NotifyICChanged() { any_ic_changed_ = true; }
29
Ben Murdochb8a8cc12014-11-26 15:28:44 +000030 void AttemptOnStackReplacement(JSFunction* function, int nesting_levels = 1);
Ben Murdoch3ef787d2012-04-12 10:51:47 +010031
Steve Block44f0eee2011-05-26 01:26:41 +010032 private:
Ben Murdoch3ef787d2012-04-12 10:51:47 +010033 void Optimize(JSFunction* function, const char* reason);
Steve Block44f0eee2011-05-26 01:26:41 +010034
Ben Murdochb8a8cc12014-11-26 15:28:44 +000035 bool CodeSizeOKForOSR(Code* shared_code);
Steve Block44f0eee2011-05-26 01:26:41 +010036
Steve Block44f0eee2011-05-26 01:26:41 +010037 Isolate* isolate_;
38
Ben Murdoch3ef787d2012-04-12 10:51:47 +010039 bool any_ic_changed_;
Ben Murdochb0fe1622011-05-05 13:52:32 +010040};
41
Ben Murdochb0fe1622011-05-05 13:52:32 +010042} } // namespace v8::internal
43
44#endif // V8_RUNTIME_PROFILER_H_