Title: [92643] trunk/Source
Revision
92643
Author
[email protected]
Date
2011-08-08 15:17:46 -0700 (Mon, 08 Aug 2011)

Log Message

Unreviewed, rolling out r92619.
http://trac.webkit.org/changeset/92619
https://bugs.webkit.org/show_bug.cgi?id=65881

This patch breaks chromium canary (Requested by jianli on
#webkit).

Patch by Sheriff Bot <[email protected]> on 2011-08-08

Source/WebCore:

* bindings/v8/V8Binding.h:
* bindings/v8/V8GCController.cpp:
(WebCore::globalHandleMap):
(WebCore::enumerateGlobalHandles):
(WebCore::V8GCController::registerGlobalHandle):
(WebCore::V8GCController::unregisterGlobalHandle):
* bindings/v8/V8HiddenPropertyName.cpp:
(WebCore::V8HiddenPropertyName::createString):
* bindings/v8/V8HiddenPropertyName.h:
* bindings/v8/V8LazyEventListener.cpp:
(WebCore::V8LazyEventListener::prepareListenerObject):
* bindings/v8/V8NPObject.cpp:
* bindings/v8/V8Proxy.cpp:
(WebCore::V8Proxy::checkNewLegal):
* bindings/v8/V8Utilities.h:
(WebCore::AllowAllocation::AllowAllocation):
(WebCore::AllowAllocation::~AllowAllocation):
(WebCore::SafeAllocation::newInstance):
* bindings/v8/WorkerContextExecutionProxy.cpp:
(WebCore::WorkerContextExecutionProxy::WorkerContextExecutionProxy):
(WebCore::WorkerContextExecutionProxy::initV8):
* bindings/v8/WorkerContextExecutionProxy.h:
* bindings/v8/WorkerScriptController.cpp:
(WebCore::WorkerScriptController::scheduleExecutionTermination):

Source/WebKit/chromium:

* src/BoundObject.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (92642 => 92643)


--- trunk/Source/WebCore/ChangeLog	2011-08-08 22:04:42 UTC (rev 92642)
+++ trunk/Source/WebCore/ChangeLog	2011-08-08 22:17:46 UTC (rev 92643)
@@ -1,3 +1,37 @@
+2011-08-08  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r92619.
+        http://trac.webkit.org/changeset/92619
+        https://bugs.webkit.org/show_bug.cgi?id=65881
+
+        This patch breaks chromium canary (Requested by jianli on
+        #webkit).
+
+        * bindings/v8/V8Binding.h:
+        * bindings/v8/V8GCController.cpp:
+        (WebCore::globalHandleMap):
+        (WebCore::enumerateGlobalHandles):
+        (WebCore::V8GCController::registerGlobalHandle):
+        (WebCore::V8GCController::unregisterGlobalHandle):
+        * bindings/v8/V8HiddenPropertyName.cpp:
+        (WebCore::V8HiddenPropertyName::createString):
+        * bindings/v8/V8HiddenPropertyName.h:
+        * bindings/v8/V8LazyEventListener.cpp:
+        (WebCore::V8LazyEventListener::prepareListenerObject):
+        * bindings/v8/V8NPObject.cpp:
+        * bindings/v8/V8Proxy.cpp:
+        (WebCore::V8Proxy::checkNewLegal):
+        * bindings/v8/V8Utilities.h:
+        (WebCore::AllowAllocation::AllowAllocation):
+        (WebCore::AllowAllocation::~AllowAllocation):
+        (WebCore::SafeAllocation::newInstance):
+        * bindings/v8/WorkerContextExecutionProxy.cpp:
+        (WebCore::WorkerContextExecutionProxy::WorkerContextExecutionProxy):
+        (WebCore::WorkerContextExecutionProxy::initV8):
+        * bindings/v8/WorkerContextExecutionProxy.h:
+        * bindings/v8/WorkerScriptController.cpp:
+        (WebCore::WorkerScriptController::scheduleExecutionTermination):
+
 2011-08-08  Scott Byer  <[email protected]>
 
         Scroll animator changes to nail the framerate

Modified: trunk/Source/WebCore/bindings/v8/V8Binding.h (92642 => 92643)


--- trunk/Source/WebCore/bindings/v8/V8Binding.h	2011-08-08 22:04:42 UTC (rev 92642)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.h	2011-08-08 22:17:46 UTC (rev 92643)
@@ -36,8 +36,6 @@
 #include "MathExtras.h"
 #include "PlatformString.h"
 #include "V8DOMWrapper.h"
-#include "V8GCController.h"
-#include "V8HiddenPropertyName.h"
 #include <wtf/text/AtomicString.h>
 
 #include <v8.h>
@@ -87,12 +85,6 @@
         RefPtr<StringImpl> m_lastStringImpl;
     };
 
-    class AllowAllocation;
-
-#ifndef NDEBUG
-    typedef HashMap<v8::Value*, GlobalHandleInfo*> GlobalHandleMap;
-#endif
-
     class V8BindingPerIsolateData {
     public:
         static V8BindingPerIsolateData* create(v8::Isolate*);
@@ -115,18 +107,10 @@
         TemplateMap& templateMap() { return m_templates; }
         v8::Persistent<v8::String>& toStringName() { return m_toStringName; }
         v8::Persistent<v8::FunctionTemplate>& toStringTemplate() { return m_toStringTemplate; }
-
-        v8::Persistent<v8::FunctionTemplate>& lazyEventListenerToStringTemplate()
-        {
-            return m_lazyEventListenerToStringTemplate;
-        }
-
         StringCache* stringCache() { return &m_stringCache; }
 
         DOMDataList& allStores() { return m_domDataList; }
 
-        V8HiddenPropertyName* hiddenPropertyName() { return &m_hiddenPropertyName; }
-
         void registerDOMDataStore(DOMDataStore* domDataStore) 
         {
             m_domDataList.append(domDataStore);
@@ -143,10 +127,6 @@
         // DOMDataStore is owned outside V8BindingPerIsolateData.
         void setDOMDataStore(DOMDataStore* store) { m_domDataStore = store; }
 
-#ifndef NDEBUG
-        GlobalHandleMap& globalHandleMap() { return m_globalHandleMap; }
-#endif
-
     private:
         explicit V8BindingPerIsolateData(v8::Isolate*);
         ~V8BindingPerIsolateData();
@@ -155,76 +135,13 @@
         TemplateMap m_templates;
         v8::Persistent<v8::String> m_toStringName;
         v8::Persistent<v8::FunctionTemplate> m_toStringTemplate;
-        v8::Persistent<v8::FunctionTemplate> m_lazyEventListenerToStringTemplate;
         StringCache m_stringCache;
 
         DOMDataList m_domDataList;
         DOMDataStore* m_domDataStore;
-
-        V8HiddenPropertyName m_hiddenPropertyName;
-
-        bool m_currentAllocationsAllowed;
-        friend class AllowAllocation;
-
-#ifndef NDEBUG
-        GlobalHandleMap m_globalHandleMap;
-#endif
     };
 
-    class AllowAllocation {
-    public:
-        AllowAllocation()
-        {
-            V8BindingPerIsolateData* data = ""
-            m_previous = data->m_currentAllocationsAllowed;
-            data->m_currentAllocationsAllowed = true;
-        }
 
-        ~AllowAllocation()
-        {
-            V8BindingPerIsolateData* data = ""
-            data->m_currentAllocationsAllowed = m_previous;
-        }
-
-        static bool current() { return V8BindingPerIsolateData::current()->m_currentAllocationsAllowed; }
-
-    private:
-        bool m_previous;
-    };
-
-    class SafeAllocation {
-    public:
-        static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::Function>);
-        static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::ObjectTemplate>);
-        static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]);
-    };
-
-    v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::Function> function)
-    {
-        if (function.IsEmpty())
-            return v8::Local<v8::Object>();
-        AllowAllocation allow;
-        return function->NewInstance();
-    }
-
-    v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::ObjectTemplate> objectTemplate)
-    {
-        if (objectTemplate.IsEmpty())
-            return v8::Local<v8::Object>();
-        AllowAllocation allow;
-        return objectTemplate->NewInstance();
-    }
-
-    v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::Function> function, int argc, v8::Handle<v8::Value> argv[])
-    {
-        if (function.IsEmpty())
-            return v8::Local<v8::Object>();
-        AllowAllocation allow;
-        return function->NewInstance(argc, argv);
-    }
-
-
-
     enum ExternalMode {
         Externalize,
         DoNotExternalize

Modified: trunk/Source/WebCore/bindings/v8/V8GCController.cpp (92642 => 92643)


--- trunk/Source/WebCore/bindings/v8/V8GCController.cpp	2011-08-08 22:04:42 UTC (rev 92642)
+++ trunk/Source/WebCore/bindings/v8/V8GCController.cpp	2011-08-08 22:17:46 UTC (rev 92643)
@@ -81,18 +81,19 @@
 //    V8GCController::unregisterGlobalHandle(type, host, handle);
 // #endif
 //
+typedef HashMap<v8::Value*, GlobalHandleInfo*> GlobalHandleMap;
 
-static GlobalHandleMap& currentGlobalHandleMap()
+static GlobalHandleMap& globalHandleMap()
 {
-    return V8BindingPerIsolateData::current()->globalHandleMap();
+    DEFINE_STATIC_LOCAL(GlobalHandleMap, staticGlobalHandleMap, ());
+    return staticGlobalHandleMap;
 }
 
 // The function is the place to set the break point to inspect
 // live global handles. Leaks are often come from leaked global handles.
 static void enumerateGlobalHandles()
 {
-    GlobalHandleMap& globalHandleMap = currentGlobalHandleMap();
-    for (GlobalHandleMap::iterator it = globalHandleMap.begin(), end = globalHandleMap.end(); it != end; ++it) {
+    for (GlobalHandleMap::iterator it = globalHandleMap().begin(), end = globalHandleMap().end(); it != end; ++it) {
         GlobalHandleInfo* info = it->second;
         UNUSED_PARAM(info);
         v8::Value* handle = it->first;
@@ -102,16 +103,14 @@
 
 void V8GCController::registerGlobalHandle(GlobalHandleType type, void* host, v8::Persistent<v8::Value> handle)
 {
-    GlobalHandleMap& globalHandleMap = currentGlobalHandleMap();
-    ASSERT(!globalHandleMap.contains(*handle));
-    globalHandleMap.set(*handle, new GlobalHandleInfo(host, type));
+    ASSERT(!globalHandleMap().contains(*handle));
+    globalHandleMap().set(*handle, new GlobalHandleInfo(host, type));
 }
 
 void V8GCController::unregisterGlobalHandle(void* host, v8::Persistent<v8::Value> handle)
 {
-    GlobalHandleMap& globalHandleMap = currentGlobalHandleMap();
-    ASSERT(globalHandleMap.contains(*handle));
-    GlobalHandleInfo* info = globalHandleMap.take(*handle);
+    ASSERT(globalHandleMap().contains(*handle));
+    GlobalHandleInfo* info = globalHandleMap().take(*handle);
     ASSERT(info->m_host == host);
     delete info;
 }

Modified: trunk/Source/WebCore/bindings/v8/V8HiddenPropertyName.cpp (92642 => 92643)


--- trunk/Source/WebCore/bindings/v8/V8HiddenPropertyName.cpp	2011-08-08 22:04:42 UTC (rev 92642)
+++ trunk/Source/WebCore/bindings/v8/V8HiddenPropertyName.cpp	2011-08-08 22:17:46 UTC (rev 92643)
@@ -31,7 +31,6 @@
 #include "config.h"
 #include "V8HiddenPropertyName.h"
 
-#include "V8Binding.h"
 #include <string.h>
 #include <wtf/Vector.h>
 
@@ -43,11 +42,8 @@
 #define V8_DEFINE_PROPERTY(name) \
 v8::Handle<v8::String> V8HiddenPropertyName::name() \
 { \
-    V8HiddenPropertyName* hiddenPropertyName = V8BindingPerIsolateData::current()->hiddenPropertyName(); \
-    if (hiddenPropertyName->m_##name.IsEmpty()) { \
-        hiddenPropertyName->m_##name = createString("WebCore::HiddenProperty::" V8_AS_STRING(name)); \
-    } \
-    return hiddenPropertyName->m_##name; \
+    static v8::Persistent<v8::String>* string = createString("WebCore::HiddenProperty::" V8_AS_STRING(name)); \
+    return *string; \
 }
 
 V8_HIDDEN_PROPERTIES(V8_DEFINE_PROPERTY);
@@ -63,10 +59,10 @@
     return v8::String::NewSymbol(prefixedName.data(), static_cast<int>(prefixedName.size()));
 }
 
-v8::Persistent<v8::String> V8HiddenPropertyName::createString(const char* key)
+v8::Persistent<v8::String>* V8HiddenPropertyName::createString(const char* key)
 {
     v8::HandleScope scope;
-    return v8::Persistent<v8::String>::New(v8::String::NewSymbol(key));
+    return new v8::Persistent<v8::String>(v8::Persistent<v8::String>::New(v8::String::NewSymbol(key)));
 }
 
 }  // namespace WebCore

Modified: trunk/Source/WebCore/bindings/v8/V8HiddenPropertyName.h (92642 => 92643)


--- trunk/Source/WebCore/bindings/v8/V8HiddenPropertyName.h	2011-08-08 22:04:42 UTC (rev 92642)
+++ trunk/Source/WebCore/bindings/v8/V8HiddenPropertyName.h	2011-08-08 22:17:46 UTC (rev 92643)
@@ -55,10 +55,7 @@
         static v8::Handle<v8::String> hiddenReferenceName(const char* name);
 
     private:
-        static v8::Persistent<v8::String> createString(const char* key);
-#define V8_DECLARE_FIELD(name) v8::Persistent<v8::String> m_##name;
-        V8_HIDDEN_PROPERTIES(V8_DECLARE_FIELD);
-#undef V8_DECLARE_FIELD
+        static v8::Persistent<v8::String>* createString(const char* key);
     };
 
 }

Modified: trunk/Source/WebCore/bindings/v8/V8LazyEventListener.cpp (92642 => 92643)


--- trunk/Source/WebCore/bindings/v8/V8LazyEventListener.cpp	2011-08-08 22:04:42 UTC (rev 92642)
+++ trunk/Source/WebCore/bindings/v8/V8LazyEventListener.cpp	2011-08-08 22:17:46 UTC (rev 92643)
@@ -137,8 +137,7 @@
             // source returned (sometimes a RegExp is applied as well) for some
             // other use. That fails miserably if the actual wrapper source is
             // returned.
-            v8::Persistent<v8::FunctionTemplate>& toStringTemplate =
-                V8BindingPerIsolateData::current()->lazyEventListenerToStringTemplate();
+            DEFINE_STATIC_LOCAL(v8::Persistent<v8::FunctionTemplate>, toStringTemplate, ());
             if (toStringTemplate.IsEmpty())
                 toStringTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8LazyEventListenerToString));
             v8::Local<v8::Function> toStringFunction;

Modified: trunk/Source/WebCore/bindings/v8/V8NPObject.cpp (92642 => 92643)


--- trunk/Source/WebCore/bindings/v8/V8NPObject.cpp	2011-08-08 22:04:42 UTC (rev 92642)
+++ trunk/Source/WebCore/bindings/v8/V8NPObject.cpp	2011-08-08 22:17:46 UTC (rev 92643)
@@ -34,7 +34,6 @@
 
 #include "HTMLPlugInElement.h"
 #include "NPV8Object.h"
-#include "V8Binding.h"
 #include "V8DOMMap.h"
 #include "V8HTMLAppletElement.h"
 #include "V8HTMLEmbedElement.h"

Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (92642 => 92643)


--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2011-08-08 22:04:42 UTC (rev 92642)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2011-08-08 22:17:46 UTC (rev 92643)
@@ -132,6 +132,8 @@
 typedef HashMap<void*, v8::Object*> DOMObjectMap;
 typedef HashMap<int, v8::FunctionTemplate*> FunctionTemplateMap;
 
+bool AllowAllocation::m_current = false;
+
 static void addMessageToConsole(Page* page, const String& message, const String& sourceID, unsigned lineNumber)
 {
     ASSERT(page);
@@ -781,7 +783,7 @@
 
 v8::Handle<v8::Value> V8Proxy::checkNewLegal(const v8::Arguments& args)
 {
-    if (!AllowAllocation::current())
+    if (!AllowAllocation::m_current)
         return throwError(TypeError, "Illegal constructor");
 
     return args.This();

Modified: trunk/Source/WebCore/bindings/v8/V8Utilities.h (92642 => 92643)


--- trunk/Source/WebCore/bindings/v8/V8Utilities.h	2011-08-08 22:04:42 UTC (rev 92642)
+++ trunk/Source/WebCore/bindings/v8/V8Utilities.h	2011-08-08 22:17:46 UTC (rev 92643)
@@ -95,6 +95,56 @@
         return V8CallbackType::create(value, getScriptExecutionContext());
     }
 
+    class AllowAllocation {
+    public:
+        inline AllowAllocation()
+        {
+            m_previous = m_current;
+            m_current = true;
+        }
+
+        inline ~AllowAllocation()
+        {
+            m_current = m_previous;
+        }
+
+        static bool m_current;
+
+    private:
+        bool m_previous;
+    };
+
+    class SafeAllocation {
+     public:
+      static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::Function>);
+      static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::ObjectTemplate>);
+      static inline v8::Local<v8::Object> newInstance(v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]);
+    };
+
+    v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::Function> function)
+    {
+        if (function.IsEmpty())
+            return v8::Local<v8::Object>();
+        AllowAllocation allow;
+        return function->NewInstance();
+    }
+
+    v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::ObjectTemplate> objectTemplate)
+    {
+        if (objectTemplate.IsEmpty())
+            return v8::Local<v8::Object>();
+        AllowAllocation allow;
+        return objectTemplate->NewInstance();
+    }
+
+    v8::Local<v8::Object> SafeAllocation::newInstance(v8::Handle<v8::Function> function, int argc, v8::Handle<v8::Value> argv[])
+    {
+        if (function.IsEmpty())
+            return v8::Local<v8::Object>();
+        AllowAllocation allow;
+        return function->NewInstance(argc, argv);
+    }
+
 } // namespace WebCore
 
 #endif // V8Utilities_h

Modified: trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp (92642 => 92643)


--- trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp	2011-08-08 22:04:42 UTC (rev 92642)
+++ trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp	2011-08-08 22:17:46 UTC (rev 92643)
@@ -83,7 +83,7 @@
     : m_workerContext(workerContext)
     , m_recursion(0)
 {
-    initIsolate();
+    initV8();
 }
 
 WorkerContextExecutionProxy::~WorkerContextExecutionProxy()
@@ -108,15 +108,12 @@
     }
 }
 
-void WorkerContextExecutionProxy::initIsolate()
+void WorkerContextExecutionProxy::initV8()
 {
     // Tell V8 not to call the default OOM handler, binding code will handle it.
     v8::V8::IgnoreOutOfMemoryException();
     v8::V8::SetFatalErrorHandler(reportFatalErrorInV8);
 
-    v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue);
-    v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue);
-
     v8::ResourceConstraints resource_constraints;
     uint32_t here;
     resource_constraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uint32_t*));

Modified: trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.h (92642 => 92643)


--- trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.h	2011-08-08 22:04:42 UTC (rev 92642)
+++ trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.h	2011-08-08 22:17:46 UTC (rev 92643)
@@ -73,7 +73,7 @@
         v8::Local<v8::Context> context() { return v8::Local<v8::Context>::New(m_context); }
 
     private:
-        void initIsolate();
+        void initV8();
         bool initContextIfNeeded();
         void dispose();
 

Modified: trunk/Source/WebCore/bindings/v8/WorkerScriptController.cpp (92642 => 92643)


--- trunk/Source/WebCore/bindings/v8/WorkerScriptController.cpp	2011-08-08 22:04:42 UTC (rev 92642)
+++ trunk/Source/WebCore/bindings/v8/WorkerScriptController.cpp	2011-08-08 22:17:46 UTC (rev 92643)
@@ -94,7 +94,7 @@
 
 void WorkerScriptController::scheduleExecutionTermination()
 {
-    v8::V8::TerminateExecution(m_isolate);
+    v8::V8::TerminateExecution();
 }
 
 void WorkerScriptController::forbidExecution()

Modified: trunk/Source/WebKit/chromium/ChangeLog (92642 => 92643)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-08-08 22:04:42 UTC (rev 92642)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-08-08 22:17:46 UTC (rev 92643)
@@ -1,3 +1,14 @@
+2011-08-08  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r92619.
+        http://trac.webkit.org/changeset/92619
+        https://bugs.webkit.org/show_bug.cgi?id=65881
+
+        This patch breaks chromium canary (Requested by jianli on
+        #webkit).
+
+        * src/BoundObject.cpp:
+
 2011-08-08  Scott Byer  <[email protected]>
 
         Scroll animator changes to nail the framerate

Modified: trunk/Source/WebKit/chromium/src/BoundObject.cpp (92642 => 92643)


--- trunk/Source/WebKit/chromium/src/BoundObject.cpp	2011-08-08 22:04:42 UTC (rev 92642)
+++ trunk/Source/WebKit/chromium/src/BoundObject.cpp	2011-08-08 22:17:46 UTC (rev 92643)
@@ -31,7 +31,6 @@
 #include "config.h"
 #include "BoundObject.h"
 
-#include "V8Binding.h"
 #include "V8Proxy.h"
 
 namespace WebKit {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to