43 100 * FullCodeGenerator::kCodeSizeMultiplier;
46 4 * FullCodeGenerator::kCodeSizeMultiplier;
51 5 * FullCodeGenerator::kCodeSizeMultiplier;
56 any_ic_changed_(
false) {
61 int* ic_generic_count,
int* ic_total_count,
62 int* type_info_percentage,
int* generic_percentage) {
64 *ic_generic_count = 0;
65 *ic_with_type_info_count = 0;
67 if (raw_info->IsTypeFeedbackInfo()) {
73 if (*ic_total_count > 0) {
74 *type_info_percentage = 100 * *ic_with_type_info_count / *ic_total_count;
75 *generic_percentage = 100 * *ic_generic_count / *ic_total_count;
77 *type_info_percentage = 100;
78 *generic_percentage = 0;
84 DCHECK(function->IsOptimizable());
86 if (FLAG_trace_opt && function->PassesFilter(FLAG_hydrogen_filter)) {
88 function->ShortPrint();
89 PrintF(
" for recompilation, reason: %s", reason);
90 if (FLAG_type_info_threshold > 0) {
91 int typeinfo,
generic, total, type_percentage, generic_percentage;
92 GetICCounts(function->shared()->code(), &typeinfo, &
generic, &total,
93 &type_percentage, &generic_percentage);
94 PrintF(
", ICs with typeinfo: %d/%d (%d%%)", typeinfo, total,
96 PrintF(
", generic ICs: %d/%d (%d%%)",
generic, total, generic_percentage);
112 DCHECK(!function->IsInOptimizationQueue());
113 function->MarkForConcurrentOptimization();
116 function->MarkForOptimization();
122 int loop_nesting_levels) {
128 function->IsBuiltin()) {
133 if (!shared->code()->optimizable())
return;
138 if (shared->uses_arguments())
return;
143 if (FLAG_trace_osr) {
144 PrintF(
"[OSR - patching back edges in ");
145 function->PrintName();
149 for (
int i = 0;
i < loop_nesting_levels;
i++) {
166 int frame_count_limit = FLAG_frame_count;
167 for (JavaScriptFrameIterator it(
isolate_);
168 frame_count++ < frame_count_limit && !it.done();
174 Code* shared_code = shared->code();
178 for (
int i = functions.length(); --
i >= 0; ) {
186 if (shared_code->
kind() != Code::FUNCTION)
continue;
187 if (function->IsInOptimizationQueue())
continue;
189 if (FLAG_always_osr) {
192 }
else if (!frame->is_optimized() &&
193 (function->IsMarkedForOptimization() ||
194 function->IsMarkedForConcurrentOptimization() ||
195 function->IsOptimized())) {
201 if (shared_code->
CodeSize() > allowance) {
212 const int kMaxToplevelSourceSize = 10 * 1024;
213 if (shared->is_toplevel() &&
214 (frame_count > 1 || shared->
SourceSize() > kMaxToplevelSourceSize)) {
219 if (shared->optimization_disabled()) {
233 if (!function->IsOptimizable())
continue;
238 int typeinfo,
generic, total, type_percentage, generic_percentage;
239 GetICCounts(shared_code, &typeinfo, &
generic, &total, &type_percentage,
240 &generic_percentage);
241 if (type_percentage >= FLAG_type_info_threshold &&
242 generic_percentage <= FLAG_generic_ic_threshold) {
245 Optimize(
function,
"hot and stable");
247 Optimize(
function,
"not much type info but very hot");
250 if (FLAG_trace_opt_verbose) {
251 PrintF(
"[not yet optimizing ");
252 function->PrintName();
253 PrintF(
", not enough type info: %d/%d (%d%%)]\n", typeinfo, total,
261 int typeinfo,
generic, total, type_percentage, generic_percentage;
262 GetICCounts(shared_code, &typeinfo, &
generic, &total, &type_percentage,
263 &generic_percentage);
264 if (type_percentage >= FLAG_type_info_threshold &&
265 generic_percentage <= FLAG_generic_ic_threshold) {
266 Optimize(
function,
"small function");
static void Patch(Isolate *isolate, Code *unoptimized_code)
void set_profiler_ticks(int ticks)
int instruction_size() const
Object * type_feedback_info()
static const int kMaxLoopNestingMarker
bool concurrent_osr_enabled() const
bool DebuggerHasBreakPoints()
OptimizingCompilerThread * optimizing_compiler_thread()
bool concurrent_recompilation_enabled()
Bootstrapper * bootstrapper()
virtual void GetFunctions(List< JSFunction * > *functions)
JSFunction * function() const
bool IsQueuedForOSR(Handle< JSFunction > function, BailoutId osr_ast_id)
RuntimeProfiler(Isolate *isolate)
void Optimize(JSFunction *function, const char *reason)
void AttemptOnStackReplacement(JSFunction *function, int nesting_levels=1)
int profiler_ticks() const
void TryReenableOptimization()
void set_profiler_ticks(int ticks)
static const int kMaxValue
int ic_with_type_info_count()
#define DCHECK(condition)
static void GetICCounts(Code *shared_code, int *ic_with_type_info_count, int *ic_generic_count, int *ic_total_count, int *type_info_percentage, int *generic_percentage)
static const int kTicksWhenNotEnoughTypeInfo
static const int kOSRCodeSizeAllowancePerTick
void PrintF(const char *format,...)
static const int kOSRCodeSizeAllowanceBase
STATIC_ASSERT(sizeof(CPURegister)==sizeof(Register))
static const int kProfilerTicksBeforeReenablingOptimization
static const int kProfilerTicksBeforeOptimization
static const int kMaxSizeEarlyOpt
Debugger support for the V8 JavaScript engine.