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

Unified Diff: src/compiler.cc

Issue 2475203003: [compiler] Remove --ignition-preserve-bytecode flag. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins/x87/builtins-x87.cc ('k') | src/flag-definitions.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 bf7702be4f51558e920372fb4bd90d9942a36e33..8bd534a334aed5b1236fe4e0fb570edd0b92332f 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -20,7 +20,6 @@
#include "src/crankshaft/hydrogen.h"
#include "src/debug/debug.h"
#include "src/debug/liveedit.h"
-#include "src/deoptimizer.h"
#include "src/frames-inl.h"
#include "src/full-codegen/full-codegen.h"
#include "src/globals.h"
@@ -778,72 +777,6 @@ CompilationJob::Status FinalizeOptimizedCompilationJob(CompilationJob* job) {
return CompilationJob::FAILED;
}
-class InterpreterActivationsFinder : public ThreadVisitor,
- public OptimizedFunctionVisitor {
- public:
- explicit InterpreterActivationsFinder(SharedFunctionInfo* shared)
- : shared_(shared), has_activations_(false) {}
-
- void VisitThread(Isolate* isolate, ThreadLocalTop* top) {
- Address* activation_pc_address = nullptr;
- JavaScriptFrameIterator it(isolate, top);
- for (; !it.done(); it.Advance()) {
- JavaScriptFrame* frame = it.frame();
- if (FLAG_ignition_osr && frame->is_optimized() &&
- frame->function()->shared() == shared_) {
- // There might be optimized OSR code active on the stack that is not
- // reachable through a function. We count this as an activation.
- has_activations_ = true;
- }
- if (frame->is_interpreted() && frame->function()->shared() == shared_) {
- has_activations_ = true;
- activation_pc_address = frame->pc_address();
- }
- }
-
- if (activation_pc_address) {
- activation_pc_addresses_.push_back(activation_pc_address);
- }
- }
-
- void VisitFunction(JSFunction* function) {
- if (function->Inlines(shared_)) has_activations_ = true;
- }
-
- void EnterContext(Context* context) {}
- void LeaveContext(Context* context) {}
-
- bool MarkActivationsForBaselineOnReturn(Isolate* isolate) {
- if (activation_pc_addresses_.empty()) return false;
-
- for (Address* activation_pc_address : activation_pc_addresses_) {
- DCHECK(isolate->inner_pointer_to_code_cache()
- ->GetCacheEntry(*activation_pc_address)
- ->code->is_interpreter_trampoline_builtin());
- *activation_pc_address =
- isolate->builtins()->InterpreterMarkBaselineOnReturn()->entry();
- }
- return true;
- }
-
- bool has_activations() { return has_activations_; }
-
- private:
- SharedFunctionInfo* shared_;
- bool has_activations_;
- std::vector<Address*> activation_pc_addresses_;
-};
-
-bool HasInterpreterActivations(
- Isolate* isolate, InterpreterActivationsFinder* activations_finder) {
- activations_finder->VisitThread(isolate, isolate->thread_local_top());
- isolate->thread_manager()->IterateArchivedThreads(activations_finder);
- // There might be optimized functions that rely on bytecode being around. We
- // need to prevent switching the given function to baseline code.
- Deoptimizer::VisitAllOptimizedFunctions(isolate, activations_finder);
- return activations_finder->has_activations();
-}
-
MaybeHandle<Code> GetBaselineCode(Handle<JSFunction> function) {
Isolate* isolate = function->GetIsolate();
VMState<COMPILER> state(isolate);
@@ -879,31 +812,6 @@ MaybeHandle<Code> GetBaselineCode(Handle<JSFunction> function) {
return MaybeHandle<Code>();
}
- // TODO(4280): For now we disable switching to baseline code in the presence
- // of interpreter activations of the given function. The reasons is that the
- // underlying bytecode is cleared below. Note that this only applies in case
- // the --ignition-preserve-bytecode flag is not passed.
- if (!FLAG_ignition_preserve_bytecode) {
- InterpreterActivationsFinder activations_finder(function->shared());
- if (HasInterpreterActivations(isolate, &activations_finder)) {
- if (FLAG_trace_opt) {
- OFStream os(stdout);
- os << "[unable to switch " << Brief(*function) << " due to activations]"
- << std::endl;
- }
-
- if (activations_finder.MarkActivationsForBaselineOnReturn(isolate)) {
- if (FLAG_trace_opt) {
- OFStream os(stdout);
- os << "[marking " << Brief(function->shared())
- << " for baseline recompilation on return]" << std::endl;
- }
- }
-
- return MaybeHandle<Code>();
- }
- }
-
if (FLAG_trace_opt) {
OFStream os(stdout);
os << "[switching method " << Brief(*function) << " to baseline code]"
@@ -922,12 +830,6 @@ MaybeHandle<Code> GetBaselineCode(Handle<JSFunction> function) {
return MaybeHandle<Code>();
}
- // TODO(4280): For now we play it safe and remove the bytecode array when we
- // switch to baseline code. We might consider keeping around the bytecode so
- // that it can be used as the "source of truth" eventually. Note that this
- // only applies in case the --ignition-preserve-bytecode flag is not passed.
- if (!FLAG_ignition_preserve_bytecode) shared->ClearBytecodeArray();
-
// Update the shared function info with the scope info.
InstallSharedScopeInfo(&info, shared);
@@ -1312,19 +1214,6 @@ bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) {
// TurboFan in this case.
if (IsResumableFunction(shared->kind())) return false;
- // TODO(4280): For now we disable switching to baseline code in the presence
- // of interpreter activations of the given function. The reasons is that the
- // underlying bytecode is cleared below. The expensive check for activations
- // only needs to be done when the given function has bytecode, otherwise we
- // can be sure there are no activations. Note that this only applies in case
- // the --ignition-preserve-bytecode flag is not passed.
- if (!FLAG_ignition_preserve_bytecode && shared->HasBytecodeArray()) {
- InterpreterActivationsFinder activations_finder(*shared);
- if (HasInterpreterActivations(info->isolate(), &activations_finder)) {
- return false;
- }
- }
-
// When we call PrepareForSerializing below, we will change the shared
// ParseInfo. Make sure to reset it.
bool old_will_serialize_value = info->parse_info()->will_serialize();
@@ -1341,14 +1230,6 @@ bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) {
info->parse_info()->set_will_serialize(old_will_serialize_value);
- // TODO(4280): For now we play it safe and remove the bytecode array when we
- // switch to baseline code. We might consider keeping around the bytecode so
- // that it can be used as the "source of truth" eventually. Note that this
- // only applies in case the --ignition-preserve-bytecode flag is not passed.
- if (!FLAG_ignition_preserve_bytecode && shared->HasBytecodeArray()) {
- shared->ClearBytecodeArray();
- }
-
// The scope info might not have been set if a lazily compiled
// function is inlined before being called for the first time.
if (shared->scope_info() == ScopeInfo::Empty(info->isolate())) {
« no previous file with comments | « src/builtins/x87/builtins-x87.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698