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

Unified Diff: src/runtime-profiler.cc

Issue 2165223002: Revert of [Intepreter] Always use BytecodeGraphBuilder when --turbo-from-bytecode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime-profiler.h ('k') | test/cctest/cctest.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime-profiler.cc
diff --git a/src/runtime-profiler.cc b/src/runtime-profiler.cc
index 9da1ba00dd14e02b7de6de4c933cd80eb5a58ba6..6500b9acb83f06065a08ff6171b050c5c8973c9d 100644
--- a/src/runtime-profiler.cc
+++ b/src/runtime-profiler.cc
@@ -110,6 +110,11 @@
void RuntimeProfiler::Optimize(JSFunction* function, const char* reason) {
TraceRecompile(function, reason, "optimized");
+
+ // TODO(4280): Fix this to check function is compiled to baseline once we
+ // have a standard way to check that. For now, if baseline code doesn't have
+ // a bytecode array.
+ DCHECK(!function->shared()->HasBytecodeArray());
function->AttemptConcurrentOptimization();
}
@@ -248,7 +253,7 @@
}
}
-void RuntimeProfiler::MaybeBaselineIgnition(JSFunction* function) {
+void RuntimeProfiler::MaybeOptimizeIgnition(JSFunction* function) {
if (function->IsInOptimizationQueue()) return;
SharedFunctionInfo* shared = function->shared();
@@ -256,6 +261,8 @@
// TODO(rmcilroy): Also ensure we only OSR top-level code if it is smaller
// than kMaxToplevelSourceSize.
+ // TODO(rmcilroy): Consider whether we should optimize small functions when
+ // they are first seen on the stack (e.g., kMaxSizeEarlyOpt).
if (function->IsMarkedForBaseline() || function->IsMarkedForOptimization() ||
function->IsMarkedForConcurrentOptimization() ||
@@ -274,58 +281,6 @@
if (ticks >= kProfilerTicksBeforeBaseline) {
Baseline(function, "hot enough for baseline");
}
-}
-
-void RuntimeProfiler::MaybeOptimizeIgnition(JSFunction* function) {
- if (function->IsInOptimizationQueue()) return;
-
- SharedFunctionInfo* shared = function->shared();
- int ticks = shared->profiler_ticks();
-
- // TODO(rmcilroy): Also ensure we only OSR top-level code if it is smaller
- // than kMaxToplevelSourceSize.
- if (function->IsMarkedForBaseline() || function->IsMarkedForOptimization() ||
- function->IsMarkedForConcurrentOptimization() ||
- function->IsOptimized()) {
- // TODO(rmcilroy): Support OSR in these cases.
- return;
- }
-
- if (shared->optimization_disabled()) {
- if (shared->deopt_count() >= FLAG_max_opt_count) {
- // If optimization was disabled due to many deoptimizations,
- // then check if the function is hot and try to reenable optimization.
- if (ticks >= kProfilerTicksBeforeReenablingOptimization) {
- shared->set_profiler_ticks(0);
- shared->TryReenableOptimization();
- }
- }
- return;
- }
- if (function->IsOptimized()) return;
-
- if (ticks >= kProfilerTicksBeforeOptimization) {
- int typeinfo, generic, total, type_percentage, generic_percentage;
- GetICCounts(function, &typeinfo, &generic, &total, &type_percentage,
- &generic_percentage);
- if (type_percentage >= FLAG_type_info_threshold &&
- generic_percentage <= FLAG_generic_ic_threshold) {
- // If this particular function hasn't had any ICs patched for enough
- // ticks, optimize it now.
- Optimize(function, "hot and stable");
- } else if (ticks >= kTicksWhenNotEnoughTypeInfo) {
- Optimize(function, "not much type info but very hot");
- } else {
- if (FLAG_trace_opt_verbose) {
- PrintF("[not yet optimizing ");
- function->PrintName();
- PrintF(", not enough type info: %d/%d (%d%%)]\n", typeinfo, total,
- type_percentage);
- }
- }
- }
- // TODO(rmcilroy): Consider whether we should optimize small functions when
- // they are first seen on the stack (e.g., kMaxSizeEarlyOpt).
}
void RuntimeProfiler::MarkCandidatesForOptimization() {
@@ -356,18 +311,10 @@
}
}
- Compiler::CompilationTier next_tier =
- Compiler::NextCompilationTier(function);
if (frame->is_interpreted()) {
- if (next_tier == Compiler::BASELINE) {
- DCHECK(!frame->is_optimized());
- MaybeBaselineIgnition(function);
- } else {
- DCHECK_EQ(next_tier, Compiler::OPTIMIZED);
- MaybeOptimizeIgnition(function);
- }
+ DCHECK(!frame->is_optimized());
+ MaybeOptimizeIgnition(function);
} else {
- DCHECK_EQ(next_tier, Compiler::OPTIMIZED);
MaybeOptimizeFullCodegen(function, frame_count, frame->is_optimized());
}
}
« no previous file with comments | « src/runtime-profiler.h ('k') | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698