Title: [136188] trunk/Source/WebCore
- Revision
- 136188
- Author
- [email protected]
- Date
- 2012-11-29 17:13:33 -0800 (Thu, 29 Nov 2012)
Log Message
Unreviewed, rolling out r135862.
http://trac.webkit.org/changeset/135862
https://bugs.webkit.org/show_bug.cgi?id=103367
We've been observing 'Fatal error in
v8::V8::AddMessageListener()' in bots
* bindings/v8/V8Binding.cpp:
(WebCore::v8NonStringValueToWebCoreString):
* bindings/v8/V8StringResource.cpp:
(WebCore::int32ToWebCoreStringFast):
(WebCore::int32ToWebCoreString):
* bindings/v8/V8StringResource.h:
(WebCore::V8StringResource::V8StringResource):
(WebCore::V8StringResource::prepareBase):
(WebCore::V8StringResource::setString):
(V8StringResource):
(WebCore::V8StringResource::toString):
(WebCore::::prepare):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (136187 => 136188)
--- trunk/Source/WebCore/ChangeLog 2012-11-30 01:06:47 UTC (rev 136187)
+++ trunk/Source/WebCore/ChangeLog 2012-11-30 01:13:33 UTC (rev 136188)
@@ -1,3 +1,25 @@
+2012-11-29 Kentaro Hara <[email protected]>
+
+ Unreviewed, rolling out r135862.
+ http://trac.webkit.org/changeset/135862
+ https://bugs.webkit.org/show_bug.cgi?id=103367
+
+ We've been observing 'Fatal error in
+ v8::V8::AddMessageListener()' in bots
+
+ * bindings/v8/V8Binding.cpp:
+ (WebCore::v8NonStringValueToWebCoreString):
+ * bindings/v8/V8StringResource.cpp:
+ (WebCore::int32ToWebCoreStringFast):
+ (WebCore::int32ToWebCoreString):
+ * bindings/v8/V8StringResource.h:
+ (WebCore::V8StringResource::V8StringResource):
+ (WebCore::V8StringResource::prepareBase):
+ (WebCore::V8StringResource::setString):
+ (V8StringResource):
+ (WebCore::V8StringResource::toString):
+ (WebCore::::prepare):
+
2012-11-29 Pavel Feldman <[email protected]>
Web Inspector: optimize repaint regions upon text editing
Modified: trunk/Source/WebCore/bindings/v8/V8Binding.cpp (136187 => 136188)
--- trunk/Source/WebCore/bindings/v8/V8Binding.cpp 2012-11-30 01:06:47 UTC (rev 136187)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.cpp 2012-11-30 01:13:33 UTC (rev 136188)
@@ -100,7 +100,7 @@
{
ASSERT(!object->IsString());
if (object->IsInt32())
- return int32ToWebCoreString<String>(object->Int32Value());
+ return int32ToWebCoreString(object->Int32Value());
v8::TryCatch block;
v8::Handle<v8::String> v8String = object->ToString();
Modified: trunk/Source/WebCore/bindings/v8/V8StringResource.cpp (136187 => 136188)
--- trunk/Source/WebCore/bindings/v8/V8StringResource.cpp 2012-11-30 01:06:47 UTC (rev 136187)
+++ trunk/Source/WebCore/bindings/v8/V8StringResource.cpp 2012-11-30 01:13:33 UTC (rev 136188)
@@ -190,8 +190,6 @@
// Most numbers used are <= 100. Even if they aren't used there's very little cost in using the space.
const int kLowNumbers = 100;
-
- // FIXME: Store lowNumbers in V8PerIsolateData so that workers can also use them.
DEFINE_STATIC_LOCAL(Vector<AtomicString>, lowNumbers, (kLowNumbers + 1));
String webCoreString;
if (0 <= value && value <= kLowNumbers) {
@@ -206,7 +204,7 @@
return webCoreString;
}
-template<> String int32ToWebCoreString<String>(int value)
+String int32ToWebCoreString(int value)
{
// If we are on the main thread (this should always true for non-workers), call the faster one.
if (isMainThread())
@@ -214,9 +212,4 @@
return String::number(value);
}
-template<> AtomicString int32ToWebCoreString<AtomicString>(int value)
-{
- return AtomicString(int32ToWebCoreString<String>(value));
-}
-
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/v8/V8StringResource.h (136187 => 136188)
--- trunk/Source/WebCore/bindings/v8/V8StringResource.h 2012-11-30 01:06:47 UTC (rev 136187)
+++ trunk/Source/WebCore/bindings/v8/V8StringResource.h 2012-11-30 01:13:33 UTC (rev 136188)
@@ -142,8 +142,7 @@
template <typename StringType>
StringType v8StringToWebCoreString(v8::Handle<v8::String>, ExternalMode);
-template <typename StringType>
-StringType int32ToWebCoreString(int value);
+String int32ToWebCoreString(int value);
// V8StringResource is an adapter class that converts V8 values to Strings
// or AtomicStrings as appropriate, using multiple typecast operators.
@@ -159,6 +158,7 @@
V8StringResource(v8::Local<v8::Value> object)
: m_v8Object(object)
, m_mode(Externalize)
+ , m_string()
{
}
@@ -169,10 +169,17 @@
private:
bool prepareBase()
{
- ASSERT(!m_v8Object.IsEmpty());
- if (LIKELY(m_v8Object->IsString() || m_v8Object->IsInt32()))
+ if (m_v8Object.IsEmpty())
return true;
+ if (LIKELY(m_v8Object->IsString()))
+ return true;
+
+ if (LIKELY(m_v8Object->IsInt32())) {
+ setString(int32ToWebCoreString(m_v8Object->Int32Value()));
+ return true;
+ }
+
m_mode = DoNotExternalize;
v8::TryCatch block;
m_v8Object = m_v8Object->ToString();
@@ -184,32 +191,35 @@
return true;
}
+ void setString(const String& string)
+ {
+ m_string = string;
+ m_v8Object.Clear(); // To signal that String is ready.
+ }
+
template <class StringType>
StringType toString()
{
- if (m_v8Object.IsEmpty())
- return StringType();
- if (m_v8Object->IsInt32())
- return int32ToWebCoreString<StringType>(m_v8Object->Int32Value());
- ASSERT(m_v8Object->IsString());
- return v8StringToWebCoreString<StringType>(m_v8Object.As<v8::String>(), m_mode);
+ if (LIKELY(!m_v8Object.IsEmpty()))
+ return v8StringToWebCoreString<StringType>(m_v8Object.As<v8::String>(), m_mode);
+
+ return StringType(m_string);
}
v8::Local<v8::Value> m_v8Object;
ExternalMode m_mode;
+ String m_string;
};
template<> inline bool V8StringResource<DefaultMode>::prepare()
{
- if (m_v8Object.IsEmpty())
- return true;
return prepareBase();
}
template<> inline bool V8StringResource<WithNullCheck>::prepare()
{
if (m_v8Object.IsEmpty() || m_v8Object->IsNull()) {
- m_v8Object.Clear();
+ setString(String());
return true;
}
return prepareBase();
@@ -218,7 +228,7 @@
template<> inline bool V8StringResource<WithUndefinedOrNullCheck>::prepare()
{
if (m_v8Object.IsEmpty() || m_v8Object->IsNull() || m_v8Object->IsUndefined()) {
- m_v8Object.Clear();
+ setString(String());
return true;
}
return prepareBase();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes