Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: src/runtime-profiler.cc

Issue 2481433002: [Interpreter] Add IsInterpreted() to JSFunction and use to fix test-heap tests. (Closed)
Patch Set: Fix always-opt Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/runtime-profiler.h" 5 #include "src/runtime-profiler.h"
6 6
7 #include "src/assembler.h" 7 #include "src/assembler.h"
8 #include "src/base/platform/platform.h" 8 #include "src/base/platform/platform.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 TypeFeedbackInfo* info = TypeFeedbackInfo::cast(raw_info); 107 TypeFeedbackInfo* info = TypeFeedbackInfo::cast(raw_info);
108 *ic_with_type_info_count = info->ic_with_type_info_count(); 108 *ic_with_type_info_count = info->ic_with_type_info_count();
109 *ic_generic_count = info->ic_generic_count(); 109 *ic_generic_count = info->ic_generic_count();
110 *ic_total_count = info->ic_total_count(); 110 *ic_total_count = info->ic_total_count();
111 } 111 }
112 } 112 }
113 113
114 // Harvest vector-ics as well 114 // Harvest vector-ics as well
115 TypeFeedbackVector* vector = function->feedback_vector(); 115 TypeFeedbackVector* vector = function->feedback_vector();
116 int with = 0, gen = 0, type_vector_ic_count = 0; 116 int with = 0, gen = 0, type_vector_ic_count = 0;
117 const bool is_interpreted = 117 const bool is_interpreted = function->shared()->IsInterpreted();
118 function->shared()->code()->is_interpreter_trampoline_builtin();
119 118
120 vector->ComputeCounts(&with, &gen, &type_vector_ic_count, is_interpreted); 119 vector->ComputeCounts(&with, &gen, &type_vector_ic_count, is_interpreted);
121 *ic_total_count += type_vector_ic_count; 120 *ic_total_count += type_vector_ic_count;
122 *ic_with_type_info_count += with; 121 *ic_with_type_info_count += with;
123 *ic_generic_count += gen; 122 *ic_generic_count += gen;
124 123
125 if (*ic_total_count > 0) { 124 if (*ic_total_count > 0) {
126 *type_info_percentage = 100 * *ic_with_type_info_count / *ic_total_count; 125 *type_info_percentage = 100 * *ic_with_type_info_count / *ic_total_count;
127 *generic_percentage = 100 * *ic_generic_count / *ic_total_count; 126 *generic_percentage = 100 * *ic_generic_count / *ic_total_count;
128 } else { 127 } else {
(...skipping 25 matching lines...) Expand all
154 OptimizationReason reason) { 153 OptimizationReason reason) {
155 DCHECK_NE(reason, OptimizationReason::kDoNotOptimize); 154 DCHECK_NE(reason, OptimizationReason::kDoNotOptimize);
156 TraceRecompile(function, OptimizationReasonToString(reason), "optimized"); 155 TraceRecompile(function, OptimizationReasonToString(reason), "optimized");
157 function->AttemptConcurrentOptimization(); 156 function->AttemptConcurrentOptimization();
158 } 157 }
159 158
160 void RuntimeProfiler::Baseline(JSFunction* function, 159 void RuntimeProfiler::Baseline(JSFunction* function,
161 OptimizationReason reason) { 160 OptimizationReason reason) {
162 DCHECK_NE(reason, OptimizationReason::kDoNotOptimize); 161 DCHECK_NE(reason, OptimizationReason::kDoNotOptimize);
163 TraceRecompile(function, OptimizationReasonToString(reason), "baseline"); 162 TraceRecompile(function, OptimizationReasonToString(reason), "baseline");
164 163 DCHECK(function->shared()->IsInterpreted());
165 // TODO(4280): Fix this to check function is compiled for the interpreter
166 // once we have a standard way to check that. For now function will only
167 // have a bytecode array if compiled for the interpreter.
168 DCHECK(function->shared()->HasBytecodeArray());
169 function->MarkForBaseline(); 164 function->MarkForBaseline();
170 } 165 }
171 166
172 void RuntimeProfiler::AttemptOnStackReplacement(JavaScriptFrame* frame, 167 void RuntimeProfiler::AttemptOnStackReplacement(JavaScriptFrame* frame,
173 int loop_nesting_levels) { 168 int loop_nesting_levels) {
174 JSFunction* function = frame->function(); 169 JSFunction* function = frame->function();
175 SharedFunctionInfo* shared = function->shared(); 170 SharedFunctionInfo* shared = function->shared();
176 if (!FLAG_use_osr || function->shared()->IsBuiltin()) { 171 if (!FLAG_use_osr || function->shared()->IsBuiltin()) {
177 return; 172 return;
178 } 173 }
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 for (int i = functions.length(); --i >= 0; ) { 458 for (int i = functions.length(); --i >= 0; ) {
464 SharedFunctionInfo* shared_function_info = functions[i]->shared(); 459 SharedFunctionInfo* shared_function_info = functions[i]->shared();
465 int ticks = shared_function_info->profiler_ticks(); 460 int ticks = shared_function_info->profiler_ticks();
466 if (ticks < Smi::kMaxValue) { 461 if (ticks < Smi::kMaxValue) {
467 shared_function_info->set_profiler_ticks(ticks + 1); 462 shared_function_info->set_profiler_ticks(ticks + 1);
468 } 463 }
469 } 464 }
470 465
471 Compiler::CompilationTier next_tier = 466 Compiler::CompilationTier next_tier =
472 Compiler::NextCompilationTier(function); 467 Compiler::NextCompilationTier(function);
473 if (function->shared()->code()->is_interpreter_trampoline_builtin()) { 468 if (function->shared()->IsInterpreted()) {
474 if (next_tier == Compiler::BASELINE) { 469 if (next_tier == Compiler::BASELINE) {
475 MaybeBaselineIgnition(function, frame); 470 MaybeBaselineIgnition(function, frame);
476 } else { 471 } else {
477 DCHECK_EQ(next_tier, Compiler::OPTIMIZED); 472 DCHECK_EQ(next_tier, Compiler::OPTIMIZED);
478 MaybeOptimizeIgnition(function, frame); 473 MaybeOptimizeIgnition(function, frame);
479 } 474 }
480 } else { 475 } else {
481 DCHECK_EQ(next_tier, Compiler::OPTIMIZED); 476 DCHECK_EQ(next_tier, Compiler::OPTIMIZED);
482 MaybeOptimizeFullCodegen(function, frame, frame_count); 477 MaybeOptimizeFullCodegen(function, frame, frame_count);
483 } 478 }
484 } 479 }
485 any_ic_changed_ = false; 480 any_ic_changed_ = false;
486 } 481 }
487 482
488 } // namespace internal 483 } // namespace internal
489 } // namespace v8 484 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698