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

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: Rebase 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
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/cctest.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 TypeFeedbackInfo* info = TypeFeedbackInfo::cast(raw_info); 103 TypeFeedbackInfo* info = TypeFeedbackInfo::cast(raw_info);
104 *ic_with_type_info_count = info->ic_with_type_info_count(); 104 *ic_with_type_info_count = info->ic_with_type_info_count();
105 *ic_generic_count = info->ic_generic_count(); 105 *ic_generic_count = info->ic_generic_count();
106 *ic_total_count = info->ic_total_count(); 106 *ic_total_count = info->ic_total_count();
107 } 107 }
108 } 108 }
109 109
110 // Harvest vector-ics as well 110 // Harvest vector-ics as well
111 TypeFeedbackVector* vector = function->feedback_vector(); 111 TypeFeedbackVector* vector = function->feedback_vector();
112 int with = 0, gen = 0, type_vector_ic_count = 0; 112 int with = 0, gen = 0, type_vector_ic_count = 0;
113 const bool is_interpreted = 113 const bool is_interpreted = function->shared()->IsInterpreted();
114 function->shared()->code()->is_interpreter_trampoline_builtin();
115 114
116 vector->ComputeCounts(&with, &gen, &type_vector_ic_count, is_interpreted); 115 vector->ComputeCounts(&with, &gen, &type_vector_ic_count, is_interpreted);
117 *ic_total_count += type_vector_ic_count; 116 *ic_total_count += type_vector_ic_count;
118 *ic_with_type_info_count += with; 117 *ic_with_type_info_count += with;
119 *ic_generic_count += gen; 118 *ic_generic_count += gen;
120 119
121 if (*ic_total_count > 0) { 120 if (*ic_total_count > 0) {
122 *type_info_percentage = 100 * *ic_with_type_info_count / *ic_total_count; 121 *type_info_percentage = 100 * *ic_with_type_info_count / *ic_total_count;
123 *generic_percentage = 100 * *ic_generic_count / *ic_total_count; 122 *generic_percentage = 100 * *ic_generic_count / *ic_total_count;
124 } else { 123 } else {
(...skipping 25 matching lines...) Expand all
150 OptimizationReason reason) { 149 OptimizationReason reason) {
151 DCHECK_NE(reason, OptimizationReason::kDoNotOptimize); 150 DCHECK_NE(reason, OptimizationReason::kDoNotOptimize);
152 TraceRecompile(function, OptimizationReasonToString(reason), "optimized"); 151 TraceRecompile(function, OptimizationReasonToString(reason), "optimized");
153 function->AttemptConcurrentOptimization(); 152 function->AttemptConcurrentOptimization();
154 } 153 }
155 154
156 void RuntimeProfiler::Baseline(JSFunction* function, 155 void RuntimeProfiler::Baseline(JSFunction* function,
157 OptimizationReason reason) { 156 OptimizationReason reason) {
158 DCHECK_NE(reason, OptimizationReason::kDoNotOptimize); 157 DCHECK_NE(reason, OptimizationReason::kDoNotOptimize);
159 TraceRecompile(function, OptimizationReasonToString(reason), "baseline"); 158 TraceRecompile(function, OptimizationReasonToString(reason), "baseline");
160 159 DCHECK(function->shared()->IsInterpreted());
161 // TODO(4280): Fix this to check function is compiled for the interpreter
162 // once we have a standard way to check that. For now function will only
163 // have a bytecode array if compiled for the interpreter.
164 DCHECK(function->shared()->HasBytecodeArray());
165 function->MarkForBaseline(); 160 function->MarkForBaseline();
166 } 161 }
167 162
168 void RuntimeProfiler::AttemptOnStackReplacement(JavaScriptFrame* frame, 163 void RuntimeProfiler::AttemptOnStackReplacement(JavaScriptFrame* frame,
169 int loop_nesting_levels) { 164 int loop_nesting_levels) {
170 JSFunction* function = frame->function(); 165 JSFunction* function = frame->function();
171 SharedFunctionInfo* shared = function->shared(); 166 SharedFunctionInfo* shared = function->shared();
172 if (!FLAG_use_osr || function->shared()->IsBuiltin()) { 167 if (!FLAG_use_osr || function->shared()->IsBuiltin()) {
173 return; 168 return;
174 } 169 }
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 for (int i = functions.length(); --i >= 0; ) { 452 for (int i = functions.length(); --i >= 0; ) {
458 SharedFunctionInfo* shared_function_info = functions[i]->shared(); 453 SharedFunctionInfo* shared_function_info = functions[i]->shared();
459 int ticks = shared_function_info->profiler_ticks(); 454 int ticks = shared_function_info->profiler_ticks();
460 if (ticks < Smi::kMaxValue) { 455 if (ticks < Smi::kMaxValue) {
461 shared_function_info->set_profiler_ticks(ticks + 1); 456 shared_function_info->set_profiler_ticks(ticks + 1);
462 } 457 }
463 } 458 }
464 459
465 Compiler::CompilationTier next_tier = 460 Compiler::CompilationTier next_tier =
466 Compiler::NextCompilationTier(function); 461 Compiler::NextCompilationTier(function);
467 if (function->shared()->code()->is_interpreter_trampoline_builtin()) { 462 if (function->shared()->IsInterpreted()) {
468 if (next_tier == Compiler::BASELINE) { 463 if (next_tier == Compiler::BASELINE) {
469 MaybeBaselineIgnition(function, frame); 464 MaybeBaselineIgnition(function, frame);
470 } else { 465 } else {
471 DCHECK_EQ(next_tier, Compiler::OPTIMIZED); 466 DCHECK_EQ(next_tier, Compiler::OPTIMIZED);
472 MaybeOptimizeIgnition(function, frame); 467 MaybeOptimizeIgnition(function, frame);
473 } 468 }
474 } else { 469 } else {
475 DCHECK_EQ(next_tier, Compiler::OPTIMIZED); 470 DCHECK_EQ(next_tier, Compiler::OPTIMIZED);
476 MaybeOptimizeFullCodegen(function, frame, frame_count); 471 MaybeOptimizeFullCodegen(function, frame, frame_count);
477 } 472 }
478 } 473 }
479 any_ic_changed_ = false; 474 any_ic_changed_ = false;
480 } 475 }
481 476
482 } // namespace internal 477 } // namespace internal
483 } // namespace v8 478 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698