Revision: 4921
Author: [email protected]
Date: Wed Jun 23 00:16:09 2010
Log: Only flush code when there are no heap allocated locals in the
scopeinfo.
When flushing code we can potentially flush code with a scopeinfo that
we later need to resolve variables. This makes an explicit check that
there are heap allocated locals in the scopeinfo.
Review URL: http://codereview.chromium.org/2836021
http://code.google.com/p/v8/source/detail?r=4921
Modified:
/branches/bleeding_edge/src/heap.cc
/branches/bleeding_edge/src/scopeinfo.cc
/branches/bleeding_edge/src/scopeinfo.h
=======================================
--- /branches/bleeding_edge/src/heap.cc Thu Jun 17 09:19:28 2010
+++ /branches/bleeding_edge/src/heap.cc Wed Jun 23 00:16:09 2010
@@ -2264,6 +2264,12 @@
ThreadManager::IterateArchivedThreads(&threadvisitor);
if (threadvisitor.FoundCode()) return;
+ // Check that there are heap allocated locals in the scopeinfo. If
+ // there is, we are potentially using eval and need the scopeinfo
+ // for variable resolution.
+ if (ScopeInfo<>::HasHeapAllocatedLocals(function_info->code()))
+ return;
+
HandleScope scope;
// Compute the lazy compilable version of the code.
function_info->set_code(*ComputeLazyCompile(function_info->length()));
=======================================
--- /branches/bleeding_edge/src/scopeinfo.cc Mon Mar 8 05:01:24 2010
+++ /branches/bleeding_edge/src/scopeinfo.cc Wed Jun 23 00:16:09 2010
@@ -405,6 +405,18 @@
}
return 0;
}
+
+
+template<class Allocator>
+bool ScopeInfo<Allocator>::HasHeapAllocatedLocals(Code* code) {
+ if (code->sinfo_size() > 0) {
+ Object** p = ContextEntriesAddr(code);
+ int n; // number of context slots;
+ ReadInt(p, &n);
+ return n > 0;
+ }
+ return false;
+}
template<class Allocator>
=======================================
--- /branches/bleeding_edge/src/scopeinfo.h Mon Mar 8 22:38:33 2010
+++ /branches/bleeding_edge/src/scopeinfo.h Wed Jun 23 00:16:09 2010
@@ -112,6 +112,9 @@
// Return the number of context slots for code.
static int NumberOfContextSlots(Code* code);
+ // Return if this has context slots besides MIN_CONTEXT_SLOTS;
+ static bool HasHeapAllocatedLocals(Code* code);
+
// Lookup support for scope info embedded in Code objects. Returns
// the stack slot index for a given slot name if the slot is
// present; otherwise returns a value < 0. The name must be a symbol
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev