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

Unified Diff: src/compiler.cc

Issue 2156753002: [Intepreter] Always use BytecodeGraphBuilder when --turbo-from-bytecode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review comments 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/compiler.h ('k') | src/runtime-profiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 426752e4bffdab40c0bef8a0df58be1f20184a68..0d85844760ce766de43e4c409bb656c31eb991d5 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -441,7 +441,7 @@ void EnsureFeedbackMetadata(CompilationInfo* info) {
info->literal()->feedback_vector_spec()));
}
-bool UseIgnition(CompilationInfo* info) {
+bool ShouldUseIgnition(CompilationInfo* info) {
DCHECK(info->has_shared_info());
// When requesting debug code as a replacement for existing code, we provide
@@ -489,7 +489,7 @@ bool GenerateUnoptimizedCode(CompilationInfo* info) {
return true;
}
}
- if (FLAG_ignition && UseIgnition(info)) {
+ if (FLAG_ignition && ShouldUseIgnition(info)) {
success = interpreter::Interpreter::MakeBytecode(info);
} else {
success = FullCodeGenerator::MakeCode(info);
@@ -801,8 +801,11 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.OptimizeCode");
// TurboFan can optimize directly from existing bytecode.
- if (FLAG_turbo_from_bytecode && use_turbofan &&
- info->shared_info()->HasBytecodeArray()) {
+ if (FLAG_turbo_from_bytecode && use_turbofan && ShouldUseIgnition(info)) {
+ if (!Compiler::EnsureBytecode(info)) {
+ if (isolate->has_pending_exception()) isolate->clear_pending_exception();
+ return MaybeHandle<Code>();
+ }
info->MarkAsOptimizeFromBytecode();
}
@@ -1344,6 +1347,16 @@ MaybeHandle<JSArray> Compiler::CompileForLiveEdit(Handle<Script> script) {
return infos;
}
+bool Compiler::EnsureBytecode(CompilationInfo* info) {
+ DCHECK(ShouldUseIgnition(info));
+ if (!info->shared_info()->HasBytecodeArray()) {
+ DCHECK(!info->shared_info()->is_compiled());
+ if (GetUnoptimizedCode(info).is_null()) return false;
+ }
+ DCHECK(info->shared_info()->HasBytecodeArray());
+ return true;
+}
+
// TODO(turbofan): In the future, unoptimized code with deopt support could
// be generated lazily once deopt is triggered.
bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) {
@@ -1405,6 +1418,20 @@ bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) {
return true;
}
+// static
+Compiler::CompilationTier Compiler::NextCompilationTier(JSFunction* function) {
+ Handle<SharedFunctionInfo> shared(function->shared(), function->GetIsolate());
+ if (shared->code()->is_interpreter_trampoline_builtin()) {
+ if (FLAG_turbo_from_bytecode && UseTurboFan(shared)) {
+ return OPTIMIZED;
+ } else {
+ return BASELINE;
+ }
+ } else {
+ return OPTIMIZED;
+ }
+}
+
MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
Handle<String> source, Handle<SharedFunctionInfo> outer_info,
Handle<Context> context, LanguageMode language_mode,
« no previous file with comments | « src/compiler.h ('k') | src/runtime-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698