[V8] Replace SetGlobalGCPrologueCallback() with AddGCPrologueCallback()
authorharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Oct 2012 17:57:10 +0000 (17:57 +0000)
committerharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Oct 2012 17:57:10 +0000 (17:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=100140

Reviewed by Adam Barth.

SetGlobalGCPrologueCallback() and SetGlobalGCEpilogueCallback()
are deprecated (See http://code.google.com/codesearch#OAMlx_jo-ck/src/v8/include/v8.h&exact_package=chromium&q=v8.h&type=cs&l=3149)
Instead we should use AddGCPrologueCallback()
and AddGCEpilogueCallback().

No tests. No change in behavior.

* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::initializeV8IfNeeded):
* bindings/v8/V8GCController.cpp:
(WebCore::V8GCController::gcPrologue):
(WebCore):
(WebCore::V8GCController::minorGCPrologue):
(WebCore::V8GCController::majorGCPrologue):
(WebCore::V8GCController::gcEpilogue):
(WebCore::V8GCController::minorGCEpilogue):
(WebCore::V8GCController::majorGCEpilogue):
* bindings/v8/V8GCController.h:
(V8GCController):
* bindings/v8/WorkerContextExecutionProxy.cpp:
(WebCore::WorkerContextExecutionProxy::initIsolate):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@132243 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
Source/WebCore/bindings/v8/V8GCController.cpp
Source/WebCore/bindings/v8/V8GCController.h
Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp

index ab080ee..c3afb65 100644 (file)
@@ -1,3 +1,32 @@
+2012-10-23  Kentaro Hara  <haraken@chromium.org>
+
+        [V8] Replace SetGlobalGCPrologueCallback() with AddGCPrologueCallback()
+        https://bugs.webkit.org/show_bug.cgi?id=100140
+
+        Reviewed by Adam Barth.
+
+        SetGlobalGCPrologueCallback() and SetGlobalGCEpilogueCallback()
+        are deprecated (See http://code.google.com/codesearch#OAMlx_jo-ck/src/v8/include/v8.h&exact_package=chromium&q=v8.h&type=cs&l=3149)
+        Instead we should use AddGCPrologueCallback()
+        and AddGCEpilogueCallback().
+
+        No tests. No change in behavior.
+
+        * bindings/v8/V8DOMWindowShell.cpp:
+        (WebCore::initializeV8IfNeeded):
+        * bindings/v8/V8GCController.cpp:
+        (WebCore::V8GCController::gcPrologue):
+        (WebCore):
+        (WebCore::V8GCController::minorGCPrologue):
+        (WebCore::V8GCController::majorGCPrologue):
+        (WebCore::V8GCController::gcEpilogue):
+        (WebCore::V8GCController::minorGCEpilogue):
+        (WebCore::V8GCController::majorGCEpilogue):
+        * bindings/v8/V8GCController.h:
+        (V8GCController):
+        * bindings/v8/WorkerContextExecutionProxy.cpp:
+        (WebCore::WorkerContextExecutionProxy::initIsolate):
+
 2012-10-23  Adam Barth  <abarth@webkit.org>
 
         [V8] Enumerate Nodes via the V8 heap rather than via a list in WebCore
index de65721..4d37fc9 100644 (file)
@@ -150,8 +150,8 @@ static void initializeV8IfNeeded()
 
     v8::V8::IgnoreOutOfMemoryException();
     v8::V8::SetFatalErrorHandler(reportFatalError);
-    v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue);
-    v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue);
+    v8::V8::AddGCPrologueCallback(&V8GCController::gcPrologue);
+    v8::V8::AddGCEpilogueCallback(&V8GCController::gcEpilogue);
     v8::V8::AddMessageListener(&reportUncaughtException);
     v8::V8::SetFailedAccessCheckCallbackFunction(reportUnsafeJavaScriptAccess);
 #if ENABLE(JAVASCRIPT_DEBUGGER)
index 3a4d486..55767ee 100644 (file)
@@ -205,8 +205,20 @@ private:
     Vector<ImplicitConnection> m_connections;
 };
 
+void V8GCController::gcPrologue(v8::GCType type, v8::GCCallbackFlags flags)
+{
+    if (type == v8::kGCTypeScavenge)
+        minorGCPrologue();
+    else if (type == v8::kGCTypeMarkSweepCompact)
+        majorGCPrologue();
+}
+
+void V8GCController::minorGCPrologue()
+{
+}
+
 // Create object groups for DOM tree nodes.
-void V8GCController::gcPrologue()
+void V8GCController::majorGCPrologue()
 {
     TRACE_EVENT_BEGIN0("v8", "GC");
 
@@ -287,7 +299,19 @@ static Mutex& workingSetEstimateMBMutex()
 }
 #endif
 
-void V8GCController::gcEpilogue()
+void V8GCController::gcEpilogue(v8::GCType type, v8::GCCallbackFlags flags)
+{
+    if (type == v8::kGCTypeScavenge)
+        minorGCEpilogue();
+    else if (type == v8::kGCTypeMarkSweepCompact)
+        majorGCEpilogue();
+}
+
+void V8GCController::minorGCEpilogue()
+{
+}
+
+void V8GCController::majorGCEpilogue()
 {
     v8::HandleScope scope;
 
index e2d4d74..544d39f 100644 (file)
@@ -37,8 +37,12 @@ namespace WebCore {
 
 class V8GCController {
 public:
-    static void gcPrologue();
-    static void gcEpilogue();
+    static void gcPrologue(v8::GCType, v8::GCCallbackFlags);
+    static void gcEpilogue(v8::GCType, v8::GCCallbackFlags);
+    static void minorGCPrologue();
+    static void minorGCEpilogue();
+    static void majorGCPrologue();
+    static void majorGCEpilogue();
 
     static void checkMemoryUsage();
     static void hintForCollectGarbage();
index ee27ebf..9354bb3 100644 (file)
@@ -122,8 +122,8 @@ void WorkerContextExecutionProxy::initIsolate()
     v8::V8::IgnoreOutOfMemoryException();
     v8::V8::SetFatalErrorHandler(reportFatalErrorInV8);
 
-    v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue);
-    v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue);
+    v8::V8::AddGCPrologueCallback(&V8GCController::gcPrologue);
+    v8::V8::AddGCEpilogueCallback(&V8GCController::gcEpilogue);
 
     // FIXME: Remove the following 2 lines when V8 default has changed.
     const char es5ReadonlyFlag[] = "--es5_readonly";