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

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: 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
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 67b8ab9aa0680324fcd41246aae0d934a44b6be8..90ef08c8a12f7748a2487add1c8a9c04cddadcee 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -441,35 +441,6 @@ void EnsureFeedbackMetadata(CompilationInfo* info) {
info->literal()->feedback_vector_spec()));
}
-bool UseIgnition(CompilationInfo* info) {
- DCHECK(info->has_shared_info());
-
- // When requesting debug code as a replacement for existing code, we provide
- // the same kind as the existing code (to prevent implicit tier-change).
- if (info->is_debug() && info->shared_info()->is_compiled()) {
- return info->shared_info()->HasBytecodeArray();
- }
-
- // For generator or async functions we might avoid Ignition wholesale.
- if (info->shared_info()->is_resumable() && !FLAG_ignition_generators) {
- return false;
- }
-
- // Since we can't OSR from Ignition, skip Ignition for asm.js functions.
- if (info->shared_info()->asm_function()) {
- return false;
- }
-
- // Checks whether top level functions should be passed by the filter.
- if (info->shared_info()->is_toplevel()) {
- Vector<const char> filter = CStrVector(FLAG_ignition_filter);
- return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*');
- }
-
- // Finally respect the filter.
- return info->shared_info()->PassesFilter(FLAG_ignition_filter);
-}
-
int CodeAndMetadataSize(CompilationInfo* info) {
if (info->has_bytecode_array()) {
return info->bytecode_array()->SizeIncludingMetadata();
@@ -489,7 +460,7 @@ bool GenerateUnoptimizedCode(CompilationInfo* info) {
return true;
}
}
- if (FLAG_ignition && UseIgnition(info)) {
+ if (FLAG_ignition && Compiler::ShouldUseIgnition(info)) {
success = interpreter::Interpreter::MakeBytecode(info);
} else {
success = FullCodeGenerator::MakeCode(info);
@@ -802,7 +773,8 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
// TurboFan can optimize directly from existing bytecode.
if (FLAG_turbo_from_bytecode && use_turbofan &&
- info->shared_info()->HasBytecodeArray()) {
+ Compiler::ShouldUseIgnition(info)) {
+ if (!Compiler::EnsureBytecode(info)) return MaybeHandle<Code>();
info->MarkAsOptimizeFromBytecode();
}
@@ -1344,6 +1316,16 @@ MaybeHandle<JSArray> Compiler::CompileForLiveEdit(Handle<Script> script) {
return infos;
}
+bool Compiler::EnsureBytecode(CompilationInfo* info) {
+ DCHECK(Compiler::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 +1387,50 @@ 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;
+ }
+}
+
+// static
+bool Compiler::ShouldUseIgnition(CompilationInfo* info) {
+ DCHECK(info->has_shared_info());
+
+ // When requesting debug code as a replacement for existing code, we provide
+ // the same kind as the existing code (to prevent implicit tier-change).
+ if (info->is_debug() && info->shared_info()->is_compiled()) {
+ return info->shared_info()->HasBytecodeArray();
+ }
+
+ // For generator or async functions we might avoid Ignition wholesale.
+ if (info->shared_info()->is_resumable() && !FLAG_ignition_generators) {
+ return false;
+ }
+
+ // Since we can't OSR from Ignition, skip Ignition for asm.js functions.
+ if (info->shared_info()->asm_function()) {
+ return false;
+ }
+
+ // Checks whether top level functions should be passed by the filter.
+ if (info->shared_info()->is_toplevel()) {
+ Vector<const char> filter = CStrVector(FLAG_ignition_filter);
+ return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*');
+ }
+
+ // Finally respect the filter.
+ return info->shared_info()->PassesFilter(FLAG_ignition_filter);
+}
+
MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
Handle<String> source, Handle<SharedFunctionInfo> outer_info,
Handle<Context> context, LanguageMode language_mode,
« src/compiler.h ('K') | « src/compiler.h ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698