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

Unified Diff: src/deoptimizer.cc

Issue 2730323002: [deoptimizer] When deoptimizing code, unlink all functions referring to that code. (Closed)
Patch Set: Fix typo Created 3 years, 9 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/deoptimizer.h ('k') | src/log.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/deoptimizer.cc
diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc
index 4247e5535b0779c38f6a057c24c4e37564d358a1..430a40f17330c6d20aea69ea3f0e20fd69d8bd8b 100644
--- a/src/deoptimizer.cc
+++ b/src/deoptimizer.cc
@@ -145,8 +145,6 @@ void Deoptimizer::VisitAllOptimizedFunctionsForContext(
CHECK(context->IsNativeContext());
- visitor->EnterContext(context);
-
// Visit the list of optimized functions, removing elements that
// no longer refer to optimized code.
JSFunction* prev = NULL;
@@ -180,8 +178,29 @@ void Deoptimizer::VisitAllOptimizedFunctionsForContext(
}
element = next;
}
+}
+
+void Deoptimizer::UnlinkOptimizedCode(Code* code, Context* native_context) {
+ class CodeUnlinker : public OptimizedFunctionVisitor {
+ public:
+ explicit CodeUnlinker(Code* code) : code_(code) {}
+
+ virtual void VisitFunction(JSFunction* function) {
+ if (function->code() == code_) {
+ if (FLAG_trace_deopt) {
+ PrintF("[removing optimized code for: ");
+ function->ShortPrint();
+ PrintF("]\n");
+ }
+ function->set_code(function->shared()->code());
+ }
+ }
- visitor->LeaveContext(context);
+ private:
+ Code* code_;
+ };
+ CodeUnlinker unlinker(code);
+ VisitAllOptimizedFunctionsForContext(native_context, &unlinker);
}
@@ -209,8 +228,6 @@ void Deoptimizer::DeoptimizeMarkedCodeForContext(Context* context) {
// deoptimized from the functions that refer to it.
class SelectedCodeUnlinker: public OptimizedFunctionVisitor {
public:
- virtual void EnterContext(Context* context) { } // Don't care.
- virtual void LeaveContext(Context* context) { } // Don't care.
virtual void VisitFunction(JSFunction* function) {
Code* code = function->code();
if (!code->marked_for_deoptimization()) return;
« no previous file with comments | « src/deoptimizer.h ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698