Revision: 4199
Author: [email protected]
Date: Sat Mar 20 15:37:15 2010
Log: Explicitly declare temporary cooked frames state
Review URL: http://codereview.chromium.org/995006
http://code.google.com/p/v8/source/detail?r=4199
Modified:
/branches/bleeding_edge/src/frames.cc
/branches/bleeding_edge/src/liveedit.cc
/branches/bleeding_edge/src/top.cc
/branches/bleeding_edge/src/top.h
/branches/bleeding_edge/src/v8threads.cc
/branches/bleeding_edge/src/v8threads.h
=======================================
--- /branches/bleeding_edge/src/frames.cc Thu Mar 18 15:15:54 2010
+++ /branches/bleeding_edge/src/frames.cc Sat Mar 20 15:37:15 2010
@@ -329,9 +329,6 @@
void StackFrame::CookFramesForThread(ThreadLocalTop* thread) {
- // Only cooking frames when the collector is compacting and thus moving
code
- // around.
- ASSERT(MarkCompactCollector::IsCompacting());
ASSERT(!thread->stack_is_cooked());
for (StackFrameIterator it(thread); !it.done(); it.Advance()) {
it.frame()->Cook();
@@ -341,9 +338,6 @@
void StackFrame::UncookFramesForThread(ThreadLocalTop* thread) {
- // Only uncooking frames when the collector is compacting and thus
moving code
- // around.
- ASSERT(MarkCompactCollector::HasCompacted());
ASSERT(thread->stack_is_cooked());
for (StackFrameIterator it(thread); !it.done(); it.Advance()) {
it.frame()->Uncook();
=======================================
--- /branches/bleeding_edge/src/liveedit.cc Mon Mar 15 14:06:51 2010
+++ /branches/bleeding_edge/src/liveedit.cc Sat Mar 20 15:37:15 2010
@@ -390,6 +390,26 @@
ZoneList<Object**> rvalues_;
ZoneList<RelocInfo> reloc_infos_;
};
+
+
+class FrameCookingThreadVisitor : public ThreadVisitor {
+ public:
+ void VisitThread(ThreadLocalTop* top) {
+ StackFrame::CookFramesForThread(top);
+ }
+};
+
+class FrameUncookingThreadVisitor : public ThreadVisitor {
+ public:
+ void VisitThread(ThreadLocalTop* top) {
+ StackFrame::UncookFramesForThread(top);
+ }
+};
+
+static void IterateAllThreads(ThreadVisitor* visitor) {
+ Top::IterateThread(visitor);
+ ThreadManager::IterateThreads(visitor);
+}
// Finds all references to original and replaces them with substitution.
static void ReplaceCodeObject(Code* original, Code* substitution) {
@@ -405,9 +425,15 @@
// Iterate over all roots. Stack frames may have pointer into original
code,
// so temporary replace the pointers with offset numbers
// in prologue/epilogue.
- ThreadManager::MarkCompactPrologue(true);
- Heap::IterateStrongRoots(&visitor, VISIT_ALL);
- ThreadManager::MarkCompactEpilogue(true);
+ {
+ FrameCookingThreadVisitor cooking_visitor;
+ IterateAllThreads(&cooking_visitor);
+
+ Heap::IterateStrongRoots(&visitor, VISIT_ALL);
+
+ FrameUncookingThreadVisitor uncooking_visitor;
+ IterateAllThreads(&uncooking_visitor);
+ }
// Now iterate over all pointers of all objects, including code_target
// implicit pointers.
=======================================
--- /branches/bleeding_edge/src/top.cc Fri Mar 12 02:20:01 2010
+++ /branches/bleeding_edge/src/top.cc Sat Mar 20 15:37:15 2010
@@ -86,6 +86,17 @@
Iterate(v, thread);
return thread_storage + sizeof(ThreadLocalTop);
}
+
+
+void Top::IterateThread(ThreadVisitor* v) {
+ v->VisitThread(&thread_local_);
+}
+
+
+void Top::IterateThread(ThreadVisitor* v, char* t) {
+ ThreadLocalTop* thread = reinterpret_cast<ThreadLocalTop*>(t);
+ v->VisitThread(thread);
+}
void Top::Iterate(ObjectVisitor* v, ThreadLocalTop* thread) {
=======================================
--- /branches/bleeding_edge/src/top.h Thu Mar 11 05:13:21 2010
+++ /branches/bleeding_edge/src/top.h Sat Mar 20 15:37:15 2010
@@ -40,6 +40,7 @@
// Top has static variables used for JavaScript execution.
class SaveContext; // Forward declaration.
+class ThreadVisitor; // Defined in v8threads.h
class ThreadLocalTop BASE_EMBEDDED {
public:
@@ -319,6 +320,8 @@
static void Iterate(ObjectVisitor* v);
static void Iterate(ObjectVisitor* v, ThreadLocalTop* t);
static char* Iterate(ObjectVisitor* v, char* t);
+ static void IterateThread(ThreadVisitor* v);
+ static void IterateThread(ThreadVisitor* v, char* t);
// Returns the global object of the current context. It could be
// a builtin object, or a js global object.
=======================================
--- /branches/bleeding_edge/src/v8threads.cc Fri Oct 2 04:39:56 2009
+++ /branches/bleeding_edge/src/v8threads.cc Sat Mar 20 15:37:15 2010
@@ -329,6 +329,17 @@
data = Relocatable::Iterate(v, data);
}
}
+
+
+void ThreadManager::IterateThreads(ThreadVisitor* v) {
+ for (ThreadState* state = ThreadState::FirstInUse();
+ state != NULL;
+ state = state->Next()) {
+ char* data = state->data();
+ data += HandleScopeImplementer::ArchiveSpacePerThread();
+ Top::IterateThread(v, data);
+ }
+}
void ThreadManager::MarkCompactPrologue(bool is_compacting) {
=======================================
--- /branches/bleeding_edge/src/v8threads.h Mon Sep 28 05:25:21 2009
+++ /branches/bleeding_edge/src/v8threads.h Sat Mar 20 15:37:15 2010
@@ -79,6 +79,20 @@
};
+// Defined in top.h
+class ThreadLocalTop;
+
+
+class ThreadVisitor {
+ public:
+ // ThreadLocalTop may be only available during this call.
+ virtual void VisitThread(ThreadLocalTop* top) = 0;
+
+ protected:
+ virtual ~ThreadVisitor() {}
+};
+
+
class ThreadManager : public AllStatic {
public:
static void Lock();
@@ -90,6 +104,7 @@
static bool IsArchived();
static void Iterate(ObjectVisitor* v);
+ static void IterateThreads(ThreadVisitor* v);
static void MarkCompactPrologue(bool is_compacting);
static void MarkCompactEpilogue(bool is_compacting);
static bool IsLockedByCurrentThread() { return mutex_owner_.IsSelf(); }
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
To unsubscribe from this group, send email to v8-dev+unsubscribegooglegroups.com or reply
to this email with the words "REMOVE ME" as the subject.