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 10namespace v8 { 11namespace internal { 12 13class Isolate; 14class JSFunction; 15 16class RuntimeProfiler { 17 public: 18 explicit RuntimeProfiler(Isolate* isolate); 19 20 void MarkCandidatesForOptimization(); 21 22 void NotifyICChanged() { any_ic_changed_ = true; } 23 24 void AttemptOnStackReplacement(JSFunction* function, int nesting_levels = 1); 25 26 private: 27 void MaybeOptimizeFullCodegen(JSFunction* function, int frame_count, 28 bool frame_optimized); 29 void MaybeOptimizeIgnition(JSFunction* function); 30 void Optimize(JSFunction* function, const char* reason); 31 void Baseline(JSFunction* function, const char* reason); 32 33 bool CodeSizeOKForOSR(Code* shared_code); 34 35 Isolate* isolate_; 36 37 bool any_ic_changed_; 38}; 39 40} // namespace internal 41} // namespace v8 42 43#endif // V8_RUNTIME_PROFILER_H_ 44