Reviewers: Michael Starzinger,
Description:
Also deoptimize code on the stack, which is not linked from any function.
BUG=
Please review this at https://codereview.chromium.org/22397003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/deoptimizer.h
M src/deoptimizer.cc
Index: src/deoptimizer.cc
diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc
index
50d6f0b39956ea60626080da59402a5796cec9db..3b7e64c4417b78c7d81b6f92114286237ec2ba1b
100644
--- a/src/deoptimizer.cc
+++ b/src/deoptimizer.cc
@@ -387,6 +387,31 @@ static void SelectCodeToDeoptimize(Context* context,
}
+// Select optimized code on the stack that is not linked by a function, but
+// should be deoptimized.
+// TODO(titzer): this is a mess. We should just bite the bullet and have a
weak
+// list of (function, code) pairs hanging off the native context.
+static void SelectUnlinkedCodeOnStackToDeoptimize(
+ Isolate* isolate,
+ OptimizedFunctionFilter* filter,
+ ZoneList<Code*>* codes,
+ Zone* zone) {
+
+ for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) {
+ JavaScriptFrame* frame = it.frame();
+ Code *code = frame->LookupCode();
+ if (code->kind() != Code::OPTIMIZED_FUNCTION) continue;
+ if (code->marked_for_deoptimization()) continue;
+ JSFunction *function = frame->function();
+ if (function->code() != code && filter->TakeFunction(function)) {
+ // only select code that is not linked from the function.
+ code->set_marked_for_deoptimization(true);
+ codes->Add(code, zone);
+ }
+ }
+}
+
+
class DeoptimizeAllFilter : public OptimizedFunctionFilter {
public:
virtual bool TakeFunction(JSFunction* function) {
@@ -458,6 +483,7 @@ void Deoptimizer::DeoptimizeAllFunctionsForContext(
Zone zone(isolate);
ZoneList<Code*> codes(4, &zone);
SelectCodeToDeoptimize(context, filter, &codes, &zone, undefined);
+ SelectUnlinkedCodeOnStackToDeoptimize(isolate, filter, &codes, &zone);
for (int i = 0; i < codes.length(); i++) {
DeoptimizeCode(isolate, codes.at(i));
}
Index: src/deoptimizer.h
diff --git a/src/deoptimizer.h b/src/deoptimizer.h
index
7ad1ab0b2e7f40227d0c90beea19e4474c644c46..20159cb57c151778d4f1e836320cf5c6db49ccfc
100644
--- a/src/deoptimizer.h
+++ b/src/deoptimizer.h
@@ -199,12 +199,6 @@ class Deoptimizer : public Malloced {
static void DeoptimizeCodeList(Isolate* isolate, ZoneList<Code*>* codes);
- static void DeoptimizeAllFunctionsForContext(
- Context* context, OptimizedFunctionFilter* filter);
-
- static void VisitAllOptimizedFunctionsForContext(
- Context* context, OptimizedFunctionVisitor* visitor);
-
static void VisitAllOptimizedFunctions(Isolate* isolate,
OptimizedFunctionVisitor*
visitor);
@@ -419,6 +413,12 @@ class Deoptimizer : public Malloced {
// Patch the given code so that it will deoptimize itself.
static void PatchCodeForDeoptimization(Isolate* isolate, Code* code);
+ static void DeoptimizeAllFunctionsForContext(
+ Context* context, OptimizedFunctionFilter* filter);
+
+ static void VisitAllOptimizedFunctionsForContext(
+ Context* context, OptimizedFunctionVisitor* visitor);
+
// Fill the input from from a JavaScript frame. This is used when
// the debugger needs to inspect an optimized frame. For normal
// deoptimizations the input frame is filled in generated code.
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.