Diff
Modified: trunk/LayoutTests/ChangeLog (133077 => 133078)
--- trunk/LayoutTests/ChangeLog 2012-10-31 21:30:51 UTC (rev 133077)
+++ trunk/LayoutTests/ChangeLog 2012-10-31 21:36:09 UTC (rev 133078)
@@ -1,3 +1,14 @@
+2012-10-31 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r133044.
+ http://trac.webkit.org/changeset/133044
+ https://bugs.webkit.org/show_bug.cgi?id=100888
+
+ Hits an ASSERT in the isolatedWorlds tests (Requested by
+ abarth on #webkit).
+
+ * platform/chromium/fast/dom/gc-9-expected.txt:
+
2012-10-31 Stephen White <[email protected]>
[Chromium] Unreviewed gardening. Updating TestExpectations for
Modified: trunk/LayoutTests/platform/chromium/fast/dom/gc-9-expected.txt (133077 => 133078)
--- trunk/LayoutTests/platform/chromium/fast/dom/gc-9-expected.txt 2012-10-31 21:30:51 UTC (rev 133077)
+++ trunk/LayoutTests/platform/chromium/fast/dom/gc-9-expected.txt 2012-10-31 21:36:09 UTC (rev 133078)
@@ -69,8 +69,8 @@
FAIL: document.body.style.myCustomProperty should be 1 but instead is undefined.
FAIL: document.body.style.getPropertyCSSValue('color').myCustomProperty should be 1 but instead is undefined.
PASS: document.styleSheets.myCustomProperty should be 1 and is.
-PASS: document.styleSheets[0].myCustomProperty should be 1 and is.
-PASS: document.styleSheets[0].cssRules.myCustomProperty should be 1 and is.
+FAIL: document.styleSheets[0].myCustomProperty should be 1 but instead is undefined.
+FAIL: document.styleSheets[0].cssRules.myCustomProperty should be 1 but instead is undefined.
FAIL: document.styleSheets[0].cssRules[0].myCustomProperty should be 1 but instead is undefined.
PASS: new XPathEvaluator().myCustomProperty should be undefined and is.
PASS: new XPathEvaluator().evaluate('/', document, null, 0, null).myCustomProperty should be undefined and is.
Modified: trunk/Source/WebCore/ChangeLog (133077 => 133078)
--- trunk/Source/WebCore/ChangeLog 2012-10-31 21:30:51 UTC (rev 133077)
+++ trunk/Source/WebCore/ChangeLog 2012-10-31 21:36:09 UTC (rev 133078)
@@ -1,3 +1,44 @@
+2012-10-31 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r133044.
+ http://trac.webkit.org/changeset/133044
+ https://bugs.webkit.org/show_bug.cgi?id=100888
+
+ Hits an ASSERT in the isolatedWorlds tests (Requested by
+ abarth on #webkit).
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+ (NeedsToVisitDOMWrapper):
+ (GenerateVisitDOMWrapper):
+ (GenerateHeader):
+ (GenerateImplementation):
+ * bindings/v8/V8GCController.cpp:
+ (WebCore::ObjectVisitor::ObjectVisitor):
+ (WebCore::ObjectVisitor::visitDOMWrapper):
+ (ObjectVisitor):
+ (WebCore::rootForGC):
+ (ImplicitConnection):
+ (WebCore::ImplicitConnection::ImplicitConnection):
+ (WebCore::ImplicitConnection::root):
+ (WebCore::ImplicitConnection::wrapper):
+ (WebCore):
+ (WebCore::operator<):
+ (WebCore::NodeVisitor::NodeVisitor):
+ (WebCore::NodeVisitor::visitNodeWrapper):
+ (NodeVisitor):
+ (WebCore::NodeVisitor::applyGrouping):
+ (WebCore::V8GCController::majorGCPrologue):
+ * bindings/v8/V8GCController.h:
+ (V8GCController):
+ * bindings/v8/WrapperTypeInfo.h:
+ (WebCore):
+ (WebCore::WrapperTypeInfo::visitDOMWrapper):
+ (WrapperTypeInfo):
+ * bindings/v8/custom/V8NodeListCustom.cpp:
+ (WebCore::V8NodeList::visitDOMWrapper):
+ * bindings/v8/custom/V8SpeechRecognitionResultCustom.cpp:
+ (WebCore::V8SpeechRecognitionResult::visitDOMWrapper):
+
2012-10-31 Philip Rogers <[email protected]>
Cache animationMode() in SVG animations.
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (133077 => 133078)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-10-31 21:30:51 UTC (rev 133077)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-10-31 21:36:09 UTC (rev 133078)
@@ -181,7 +181,7 @@
}
}
-sub NeedsCustomOpaqueRootForGC
+sub NeedsToVisitDOMWrapper
{
my $dataNode = shift;
return GetGenerateIsReachable($dataNode) || GetCustomIsReachable($dataNode);
@@ -199,7 +199,7 @@
return $dataNode->extendedAttributes->{"CustomIsReachable"} || $dataNode->extendedAttributes->{"V8CustomIsReachable"};
}
-sub GenerateOpaqueRootForGC
+sub GenerateVisitDOMWrapper
{
my ($dataNode, $implClassName) = @_;
@@ -208,7 +208,7 @@
}
push(@implContent, <<END);
-void* V8${implClassName}::opaqueRootForGC(void* object, v8::Persistent<v8::Object> wrapper)
+void V8${implClassName}::visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper)
{
${implClassName}* impl = static_cast<${implClassName}*>(object);
END
@@ -218,8 +218,6 @@
GetGenerateIsReachable($dataNode) eq "ImplOwnerNodeRoot" ||
GetGenerateIsReachable($dataNode) eq "ImplBaseRoot") {
- $implIncludes{"V8GCController.h"} = 1;
-
my $methodName;
$methodName = "document" if (GetGenerateIsReachable($dataNode) eq "ImplDocument");
$methodName = "element" if (GetGenerateIsReachable($dataNode) eq "ImplElementRoot");
@@ -228,13 +226,17 @@
$methodName = "base" if (GetGenerateIsReachable($dataNode) eq "ImplBaseRoot");
push(@implContent, <<END);
- if (Node* owner = impl->${methodName}())
- return V8GCController::opaqueRootForGC(owner);
+ if (Node* owner = impl->${methodName}()) {
+ v8::Persistent<v8::Object> ownerWrapper = store->domNodeMap().get(owner);
+ if (!ownerWrapper.IsEmpty()) {
+ v8::Persistent<v8::Value> value = wrapper;
+ v8::V8::AddImplicitReferences(ownerWrapper, &value, 1);
+ }
+ }
END
}
push(@implContent, <<END);
- return object;
}
END
@@ -385,8 +387,8 @@
static WrapperTypeInfo info;
END
- if (NeedsCustomOpaqueRootForGC($dataNode)) {
- push(@headerContent, " static void* opaqueRootForGC(void*, v8::Persistent<v8::Object>);\n");
+ if (NeedsToVisitDOMWrapper($dataNode)) {
+ push(@headerContent, " static void visitDOMWrapper(DOMDataStore*, void*, v8::Persistent<v8::Object>);\n");
}
if ($dataNode->extendedAttributes->{"ActiveDOMObject"}) {
@@ -2592,7 +2594,7 @@
AddIncludesForType($interfaceName);
my $toActive = $dataNode->extendedAttributes->{"ActiveDOMObject"} ? "${className}::toActiveDOMObject" : "0";
- my $rootForGC = NeedsCustomOpaqueRootForGC($dataNode) ? "${className}::opaqueRootForGC" : "0";
+ my $domVisitor = NeedsToVisitDOMWrapper($dataNode) ? "${className}::visitDOMWrapper" : "0";
# Find the super descriptor.
my $parentClass = "";
@@ -2609,7 +2611,7 @@
my $WrapperTypePrototype = $dataNode->isException ? "WrapperTypeErrorPrototype" : "WrapperTypeObjectPrototype";
- push(@implContentDecls, "WrapperTypeInfo ${className}::info = { ${className}::GetTemplate, ${className}::derefObject, $toActive, $rootForGC, ${className}::installPerContextPrototypeProperties, $parentClassInfo, $WrapperTypePrototype };\n\n");
+ push(@implContentDecls, "WrapperTypeInfo ${className}::info = { ${className}::GetTemplate, ${className}::derefObject, $toActive, $domVisitor, ${className}::installPerContextPrototypeProperties, $parentClassInfo, $WrapperTypePrototype };\n\n");
push(@implContentDecls, "namespace ${interfaceName}V8Internal {\n\n");
push(@implContentDecls, "template <typename T> void V8_USE(T) { }\n\n");
@@ -2670,8 +2672,8 @@
GenerateReplaceableAttrSetter($dataNode, $implClassName);
}
- if (NeedsCustomOpaqueRootForGC($dataNode)) {
- GenerateOpaqueRootForGC($dataNode, $implClassName);
+ if (NeedsToVisitDOMWrapper($dataNode)) {
+ GenerateVisitDOMWrapper($dataNode, $implClassName);
}
if ($dataNode->extendedAttributes->{"TypedArray"}) {
Modified: trunk/Source/WebCore/bindings/v8/V8GCController.cpp (133077 => 133078)
--- trunk/Source/WebCore/bindings/v8/V8GCController.cpp 2012-10-31 21:30:51 UTC (rev 133077)
+++ trunk/Source/WebCore/bindings/v8/V8GCController.cpp 2012-10-31 21:36:09 UTC (rev 133078)
@@ -67,79 +67,14 @@
namespace WebCore {
-class ImplicitConnection {
-public:
- ImplicitConnection(void* root, v8::Persistent<v8::Value> wrapper)
- : m_root(root)
- , m_wrapper(wrapper)
- {
- }
-
- void* root() const { return m_root; }
- v8::Persistent<v8::Value> wrapper() const { return m_wrapper; }
-
-private:
- void* m_root;
- v8::Persistent<v8::Value> m_wrapper;
-};
-
-bool operator<(const ImplicitConnection& left, const ImplicitConnection& right)
-{
- return left.root() < right.root();
-}
-
-class WrapperGrouper {
-public:
- WrapperGrouper()
- {
- m_liveObjects.append(V8PerIsolateData::current()->ensureLiveRoot());
- }
-
- void addToGroup(void* root, v8::Persistent<v8::Value> wrapper)
- {
- m_connections.append(ImplicitConnection(root, wrapper));
- }
-
- void keepAlive(v8::Persistent<v8::Value> wrapper)
- {
- m_liveObjects.append(wrapper);
- }
-
- void apply()
- {
- if (m_liveObjects.size() > 1)
- v8::V8::AddObjectGroup(m_liveObjects.data(), m_liveObjects.size());
-
- std::sort(m_connections.begin(), m_connections.end());
- Vector<v8::Persistent<v8::Value> > group;
- size_t i = 0;
- while (i < m_connections.size()) {
- void* root = m_connections[i].root();
-
- do {
- group.append(m_connections[i++].wrapper());
- } while (i < m_connections.size() && root == m_connections[i].root());
-
- if (group.size() > 1)
- v8::V8::AddObjectGroup(group.data(), group.size(), 0);
-
- group.shrink(0);
- }
- }
-
-private:
- Vector<v8::Persistent<v8::Value> > m_liveObjects;
- Vector<ImplicitConnection> m_connections;
-};
-
class ObjectVisitor : public DOMWrapperVisitor<void> {
public:
- explicit ObjectVisitor(WrapperGrouper* grouper)
- : m_grouper(grouper)
+ explicit ObjectVisitor(Vector<v8::Persistent<v8::Value> >* liveObjects)
+ : m_liveObjects(liveObjects)
{
}
- void visitDOMWrapper(DOMDataStore*, void* object, v8::Persistent<v8::Object> wrapper)
+ void visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper)
{
WrapperTypeInfo* type = V8DOMWrapper::domWrapperType(wrapper);
@@ -149,21 +84,20 @@
// implementation can't tell the difference.
MessagePort* port = static_cast<MessagePort*>(object);
if (port->isEntangled() || port->hasPendingActivity())
- m_grouper->keepAlive(wrapper);
+ m_liveObjects->append(wrapper);
} else {
ActiveDOMObject* activeDOMObject = type->toActiveDOMObject(wrapper);
if (activeDOMObject && activeDOMObject->hasPendingActivity())
- m_grouper->keepAlive(wrapper);
+ m_liveObjects->append(wrapper);
}
- m_grouper->addToGroup(type->opaqueRootForGC(object, wrapper), wrapper);
+ type->visitDOMWrapper(store, object, wrapper);
}
private:
- WrapperGrouper* m_grouper;
+ Vector<v8::Persistent<v8::Value> >* m_liveObjects;
};
-// FIXME: This should use opaque GC roots.
static void addImplicitReferencesForNodeWithEventListeners(Node* node, v8::Persistent<v8::Object> wrapper)
{
ASSERT(node->hasEventListeners());
@@ -186,16 +120,15 @@
v8::V8::AddImplicitReferences(wrapper, listeners.data(), listeners.size());
}
-void* V8GCController::opaqueRootForGC(Node* node)
+static Node* rootForGC(Node* node)
{
if (node->inDocument() || (node->hasTagName(HTMLNames::imgTag) && static_cast<HTMLImageElement*>(node)->hasPendingActivity()))
return node->document();
if (node->isAttributeNode()) {
- Node* ownerElement = static_cast<Attr*>(node)->ownerElement();
- if (!ownerElement)
- return node;
- node = ownerElement;
+ node = static_cast<Attr*>(node)->ownerElement();
+ if (!node)
+ return 0;
}
while (Node* parent = node->parentOrHostNode())
@@ -204,10 +137,31 @@
return node;
}
+class ImplicitConnection {
+public:
+ ImplicitConnection(Node* root, v8::Persistent<v8::Value> wrapper)
+ : m_root(root)
+ , m_wrapper(wrapper)
+ {
+ }
+
+ Node* root() const { return m_root; }
+ v8::Persistent<v8::Value> wrapper() const { return m_wrapper; }
+
+public:
+ Node* m_root;
+ v8::Persistent<v8::Value> m_wrapper;
+};
+
+bool operator<(const ImplicitConnection& left, const ImplicitConnection& right)
+{
+ return left.root() < right.root();
+}
+
class NodeVisitor : public NodeWrapperVisitor {
public:
- explicit NodeVisitor(WrapperGrouper* grouper)
- : m_grouper(grouper)
+ explicit NodeVisitor(Vector<v8::Persistent<v8::Value> >* liveObjects)
+ : m_liveObjects(liveObjects)
{
}
@@ -220,13 +174,36 @@
ActiveDOMObject* activeDOMObject = type->toActiveDOMObject(wrapper);
if (activeDOMObject && activeDOMObject->hasPendingActivity())
- m_grouper->keepAlive(wrapper);
+ m_liveObjects->append(wrapper);
- m_grouper->addToGroup(V8GCController::opaqueRootForGC(node), wrapper);
+ Node* root = rootForGC(node);
+ if (!root)
+ return;
+ m_connections.append(ImplicitConnection(root, wrapper));
}
+ void applyGrouping()
+ {
+ std::sort(m_connections.begin(), m_connections.end());
+ Vector<v8::Persistent<v8::Value> > group;
+ size_t i = 0;
+ while (i < m_connections.size()) {
+ Node* root = m_connections[i].root();
+
+ do {
+ group.append(m_connections[i++].wrapper());
+ } while (i < m_connections.size() && root == m_connections[i].root());
+
+ if (group.size() > 1)
+ v8::V8::AddObjectGroup(group.data(), group.size(), new RetainedDOMInfo(root));
+
+ group.shrink(0);
+ }
+ }
+
private:
- WrapperGrouper* m_grouper;
+ Vector<v8::Persistent<v8::Value> >* m_liveObjects;
+ Vector<ImplicitConnection> m_connections;
};
void V8GCController::gcPrologue(v8::GCType type, v8::GCCallbackFlags flags)
@@ -247,14 +224,17 @@
v8::HandleScope scope;
- WrapperGrouper grouper;
+ Vector<v8::Persistent<v8::Value> > liveObjects;
+ liveObjects.append(V8PerIsolateData::current()->ensureLiveRoot());
- NodeVisitor nodeVisitor(&grouper);
- ObjectVisitor objectVisitor(&grouper);
+ NodeVisitor nodeVisitor(&liveObjects);
visitAllDOMNodes(&nodeVisitor);
+ nodeVisitor.applyGrouping();
+
+ ObjectVisitor objectVisitor(&liveObjects);
visitDOMObjects(&objectVisitor);
- grouper.apply();
+ v8::V8::AddObjectGroup(liveObjects.data(), liveObjects.size());
V8PerIsolateData* data = ""
data->stringCache()->clearOnGC();
Modified: trunk/Source/WebCore/bindings/v8/V8GCController.h (133077 => 133078)
--- trunk/Source/WebCore/bindings/v8/V8GCController.h 2012-10-31 21:30:51 UTC (rev 133077)
+++ trunk/Source/WebCore/bindings/v8/V8GCController.h 2012-10-31 21:36:09 UTC (rev 133078)
@@ -35,8 +35,6 @@
namespace WebCore {
-class Node;
-
class V8GCController {
public:
static void gcPrologue(v8::GCType, v8::GCCallbackFlags);
@@ -49,8 +47,6 @@
static void checkMemoryUsage();
static void hintForCollectGarbage();
static void collectGarbage();
-
- static void* opaqueRootForGC(Node*);
};
}
Modified: trunk/Source/WebCore/bindings/v8/WrapperTypeInfo.h (133077 => 133078)
--- trunk/Source/WebCore/bindings/v8/WrapperTypeInfo.h 2012-10-31 21:30:51 UTC (rev 133077)
+++ trunk/Source/WebCore/bindings/v8/WrapperTypeInfo.h 2012-10-31 21:36:09 UTC (rev 133078)
@@ -47,7 +47,7 @@
typedef v8::Persistent<v8::FunctionTemplate> (*GetTemplateFunction)();
typedef void (*DerefObjectFunction)(void*);
typedef ActiveDOMObject* (*ToActiveDOMObjectFunction)(v8::Handle<v8::Object>);
- typedef void* (*OpaqueRootForGC)(void*, v8::Persistent<v8::Object>);
+ typedef void (*DOMWrapperVisitorFunction)(DOMDataStore*, void*, v8::Persistent<v8::Object>);
typedef void (*InstallPerContextPrototypePropertiesFunction)(v8::Handle<v8::Object>);
enum WrapperTypePrototype {
@@ -102,17 +102,16 @@
return toActiveDOMObjectFunction(object);
}
- void* opaqueRootForGC(void* object, v8::Persistent<v8::Object> wrapper)
+ void visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper)
{
- if (!opaqueRootForGCFunction)
- return object;
- return opaqueRootForGCFunction(object, wrapper);
+ if (domWrapperVisitorFunction)
+ domWrapperVisitorFunction(store, object, wrapper);
}
const GetTemplateFunction getTemplateFunction;
const DerefObjectFunction derefObjectFunction;
const ToActiveDOMObjectFunction toActiveDOMObjectFunction;
- const OpaqueRootForGC opaqueRootForGCFunction;
+ const DOMWrapperVisitorFunction domWrapperVisitorFunction;
const InstallPerContextPrototypePropertiesFunction installPerContextPrototypePropertiesFunction;
const WrapperTypeInfo* parentClass;
const WrapperTypePrototype wrapperTypePrototype;
Modified: trunk/Source/WebCore/bindings/v8/custom/V8NodeListCustom.cpp (133077 => 133078)
--- trunk/Source/WebCore/bindings/v8/custom/V8NodeListCustom.cpp 2012-10-31 21:30:51 UTC (rev 133077)
+++ trunk/Source/WebCore/bindings/v8/custom/V8NodeListCustom.cpp 2012-10-31 21:36:09 UTC (rev 133078)
@@ -34,7 +34,6 @@
#include "DynamicNodeList.h"
#include "NodeList.h"
#include "V8Binding.h"
-#include "V8GCController.h"
#include "V8Node.h"
#include <wtf/RefPtr.h>
@@ -60,16 +59,19 @@
return toV8(result.release(), info.Holder(), info.GetIsolate());
}
-void* V8NodeList::opaqueRootForGC(void* object, v8::Persistent<v8::Object> wrapper)
+void V8NodeList::visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper)
{
- ASSERT(V8NodeList::HasInstance(wrapper));
NodeList* impl = static_cast<NodeList*>(object);
- if (!impl->isDynamicNodeList())
- return object;
- Node* owner = static_cast<DynamicNodeList*>(impl)->ownerNode();
- if (!owner)
- return object;
- return V8GCController::opaqueRootForGC(owner);
+ if (impl->isDynamicNodeList()) {
+ Node* owner = static_cast<DynamicNodeList*>(impl)->ownerNode();
+ if (owner) {
+ v8::Persistent<v8::Object> ownerWrapper = store->domNodeMap().get(owner);
+ if (!ownerWrapper.IsEmpty()) {
+ v8::Persistent<v8::Value> value = wrapper;
+ v8::V8::AddImplicitReferences(ownerWrapper, &value, 1);
+ }
+ }
+ }
}
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/v8/custom/V8SpeechRecognitionResultCustom.cpp (133077 => 133078)
--- trunk/Source/WebCore/bindings/v8/custom/V8SpeechRecognitionResultCustom.cpp 2012-10-31 21:30:51 UTC (rev 133077)
+++ trunk/Source/WebCore/bindings/v8/custom/V8SpeechRecognitionResultCustom.cpp 2012-10-31 21:36:09 UTC (rev 133078)
@@ -31,15 +31,16 @@
#include "SpeechRecognitionResult.h"
#include "V8Binding.h"
-#include "V8GCController.h"
namespace WebCore {
-void* V8SpeechRecognitionResult::opaqueRootForGC(void* object, v8::Persistent<v8::Object> wrapper)
+void V8SpeechRecognitionResult::visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper)
{
- ASSERT(V8SpeechRecognitionResult::HasInstance(wrapper));
SpeechRecognitionResult* impl = static_cast<SpeechRecognitionResult*>(object);
- return V8GCController::opaqueRootForGC(impl->emma());
+ Document* emma = impl->emma();
+ v8::Persistent<v8::Value> emmaWrapper = store->domNodeMap().get(emma);
+ if (!emmaWrapper.IsEmpty())
+ v8::V8::AddImplicitReferences(wrapper, &emmaWrapper, 1);
}
} // namespace WebCore