Title: [136819] trunk/Source/WebCore
Revision
136819
Author
[email protected]
Date
2012-12-06 00:57:44 -0800 (Thu, 06 Dec 2012)

Log Message

[V8] Implement deprecatedV8Integer(int i)
https://bugs.webkit.org/show_bug.cgi?id=104220

Reviewed by Adam Barth.

To make an Isolate mandatory in v8Integer(), we implement
deprecatedV8Integer(int i) for call sites that don't have
an Isolate. Eventually we want to kill deprecatedV8Integer(int i).

No new tests. No change in behavior.

* bindings/v8/Dictionary.cpp:
(WebCore::Dictionary::get):
* bindings/v8/NPV8Object.cpp:
(_NPN_Enumerate):
* bindings/v8/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::addListener):
* bindings/v8/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::setBreakpoint):
(WebCore::ScriptDebugServer::compileScript):
* bindings/v8/ScriptSourceCode.cpp:
(WebCore::ScriptSourceCode::compileScript):
* bindings/v8/V8Binding.h:
(WebCore):
(WebCore::deprecatedV8Integer):
* bindings/v8/V8DOMConfiguration.cpp:
(WebCore::V8DOMConfiguration::batchConfigureConstants):
* bindings/v8/V8NPUtils.cpp:
(WebCore::convertNPVariantToV8Object):
* bindings/v8/V8Utilities.cpp:
(WebCore::createHiddenDependency):
(WebCore::removeHiddenDependency):
* bindings/v8/V8WindowErrorHandler.cpp:
(WebCore::V8WindowErrorHandler::callListenerFunction):
* bindings/v8/V8WorkerContextErrorHandler.cpp:
(WebCore::V8WorkerContextErrorHandler::callListenerFunction):
* bindings/v8/WorkerScriptDebugServer.cpp:
(WebCore::WorkerScriptDebugServer::addListener):
* bindings/v8/custom/V8MutationCallbackCustom.cpp:
(WebCore::V8MutationCallback::handleEvent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136818 => 136819)


--- trunk/Source/WebCore/ChangeLog	2012-12-06 08:52:47 UTC (rev 136818)
+++ trunk/Source/WebCore/ChangeLog	2012-12-06 08:57:44 UTC (rev 136819)
@@ -1,3 +1,46 @@
+2012-12-05  Kentaro Hara  <[email protected]>
+
+        [V8] Implement deprecatedV8Integer(int i)
+        https://bugs.webkit.org/show_bug.cgi?id=104220
+
+        Reviewed by Adam Barth.
+
+        To make an Isolate mandatory in v8Integer(), we implement
+        deprecatedV8Integer(int i) for call sites that don't have
+        an Isolate. Eventually we want to kill deprecatedV8Integer(int i).
+
+        No new tests. No change in behavior.
+
+        * bindings/v8/Dictionary.cpp:
+        (WebCore::Dictionary::get):
+        * bindings/v8/NPV8Object.cpp:
+        (_NPN_Enumerate):
+        * bindings/v8/PageScriptDebugServer.cpp:
+        (WebCore::PageScriptDebugServer::addListener):
+        * bindings/v8/ScriptDebugServer.cpp:
+        (WebCore::ScriptDebugServer::setBreakpoint):
+        (WebCore::ScriptDebugServer::compileScript):
+        * bindings/v8/ScriptSourceCode.cpp:
+        (WebCore::ScriptSourceCode::compileScript):
+        * bindings/v8/V8Binding.h:
+        (WebCore):
+        (WebCore::deprecatedV8Integer):
+        * bindings/v8/V8DOMConfiguration.cpp:
+        (WebCore::V8DOMConfiguration::batchConfigureConstants):
+        * bindings/v8/V8NPUtils.cpp:
+        (WebCore::convertNPVariantToV8Object):
+        * bindings/v8/V8Utilities.cpp:
+        (WebCore::createHiddenDependency):
+        (WebCore::removeHiddenDependency):
+        * bindings/v8/V8WindowErrorHandler.cpp:
+        (WebCore::V8WindowErrorHandler::callListenerFunction):
+        * bindings/v8/V8WorkerContextErrorHandler.cpp:
+        (WebCore::V8WorkerContextErrorHandler::callListenerFunction):
+        * bindings/v8/WorkerScriptDebugServer.cpp:
+        (WebCore::WorkerScriptDebugServer::addListener):
+        * bindings/v8/custom/V8MutationCallbackCustom.cpp:
+        (WebCore::V8MutationCallback::handleEvent):
+
 2012-12-06  Hayato Ito  <[email protected]>
 
         Event's relatedTarget re-targeting does not occur for manually fired mouse events created by event.initMouseEvent().

Modified: trunk/Source/WebCore/bindings/v8/Dictionary.cpp (136818 => 136819)


--- trunk/Source/WebCore/bindings/v8/Dictionary.cpp	2012-12-06 08:52:47 UTC (rev 136818)
+++ trunk/Source/WebCore/bindings/v8/Dictionary.cpp	2012-12-06 08:57:44 UTC (rev 136819)
@@ -295,9 +295,11 @@
     if (!v8Value->IsArray())
         return false;
 
+    ASSERT(m_isolate);
+    ASSERT(m_isolate == v8::Isolate::GetCurrent());
     v8::Local<v8::Array> v8Array = v8::Local<v8::Array>::Cast(v8Value);
     for (size_t i = 0; i < v8Array->Length(); ++i) {
-        v8::Local<v8::Value> indexedValue = v8Array->Get(v8Integer(i));
+        v8::Local<v8::Value> indexedValue = v8Array->Get(v8Integer(i, m_isolate));
         value.add(toWebCoreString(indexedValue));
     }
 

Modified: trunk/Source/WebCore/bindings/v8/NPV8Object.cpp (136818 => 136819)


--- trunk/Source/WebCore/bindings/v8/NPV8Object.cpp	2012-12-06 08:52:47 UTC (rev 136818)
+++ trunk/Source/WebCore/bindings/v8/NPV8Object.cpp	2012-12-06 08:57:44 UTC (rev 136819)
@@ -537,7 +537,7 @@
         *count = props->Length();
         *identifier = static_cast<NPIdentifier*>(malloc(sizeof(NPIdentifier*) * *count));
         for (uint32_t i = 0; i < *count; ++i) {
-            v8::Local<v8::Value> name = props->Get(v8Integer(i));
+            v8::Local<v8::Value> name = props->Get(deprecatedV8Integer(i));
             (*identifier)[i] = getStringIdentifier(v8::Local<v8::String>::Cast(name));
         }
         return true;

Modified: trunk/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp (136818 => 136819)


--- trunk/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp	2012-12-06 08:52:47 UTC (rev 136818)
+++ trunk/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp	2012-12-06 08:57:44 UTC (rev 136819)
@@ -108,7 +108,7 @@
     ASSERT(!value->IsUndefined() && value->IsArray());
     v8::Handle<v8::Array> scriptsArray = v8::Handle<v8::Array>::Cast(value);
     for (unsigned i = 0; i < scriptsArray->Length(); ++i)
-        dispatchDidParseSource(listener, v8::Handle<v8::Object>::Cast(scriptsArray->Get(v8Integer(i))));
+        dispatchDidParseSource(listener, v8::Handle<v8::Object>::Cast(scriptsArray->Get(deprecatedV8Integer(i))));
 }
 
 void PageScriptDebugServer::removeListener(ScriptDebugListener* listener, Page* page)

Modified: trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp (136818 => 136819)


--- trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp	2012-12-06 08:52:47 UTC (rev 136818)
+++ trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp	2012-12-06 08:57:44 UTC (rev 136819)
@@ -79,8 +79,8 @@
 
     v8::Local<v8::Object> args = v8::Object::New();
     args->Set(v8::String::NewSymbol("sourceID"), v8String(sourceID));
-    args->Set(v8::String::NewSymbol("lineNumber"), v8Integer(scriptBreakpoint.lineNumber));
-    args->Set(v8::String::NewSymbol("columnNumber"), v8Integer(scriptBreakpoint.columnNumber));
+    args->Set(v8::String::NewSymbol("lineNumber"), deprecatedV8Integer(scriptBreakpoint.lineNumber));
+    args->Set(v8::String::NewSymbol("columnNumber"), deprecatedV8Integer(scriptBreakpoint.columnNumber));
     args->Set(v8::String::NewSymbol("condition"), v8String(scriptBreakpoint.condition));
 
     v8::Handle<v8::Function> setBreakpointFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::NewSymbol("setBreakpoint")));
@@ -438,7 +438,7 @@
     v8::Handle<v8::String> code = v8String(_expression_);
     v8::TryCatch tryCatch;
 
-    v8::ScriptOrigin origin(v8String(sourceURL), v8Integer(0), v8Integer(0));
+    v8::ScriptOrigin origin(v8String(sourceURL), deprecatedV8Integer(0), deprecatedV8Integer(0));
     v8::Handle<v8::Script> script = v8::Script::New(code, &origin);
 
     if (tryCatch.HasCaught()) {

Modified: trunk/Source/WebCore/bindings/v8/ScriptSourceCode.cpp (136818 => 136819)


--- trunk/Source/WebCore/bindings/v8/ScriptSourceCode.cpp	2012-12-06 08:52:47 UTC (rev 136818)
+++ trunk/Source/WebCore/bindings/v8/ScriptSourceCode.cpp	2012-12-06 08:57:44 UTC (rev 136819)
@@ -60,8 +60,8 @@
 v8::Handle<v8::Script> ScriptSourceCode::compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition& scriptStartPosition, v8::ScriptData* scriptData)
 {
     v8::Handle<v8::String> name = v8String(fileName);
-    v8::Handle<v8::Integer> line = v8Integer(scriptStartPosition.m_line.zeroBasedInt());
-    v8::Handle<v8::Integer> column = v8Integer(scriptStartPosition.m_column.zeroBasedInt());
+    v8::Handle<v8::Integer> line = deprecatedV8Integer(scriptStartPosition.m_line.zeroBasedInt());
+    v8::Handle<v8::Integer> column = deprecatedV8Integer(scriptStartPosition.m_column.zeroBasedInt());
     v8::ScriptOrigin origin(name, line, column);
     v8::Handle<v8::Script> script = v8::Script::Compile(code, &origin, scriptData);
     return script;

Modified: trunk/Source/WebCore/bindings/v8/V8Binding.h (136818 => 136819)


--- trunk/Source/WebCore/bindings/v8/V8Binding.h	2012-12-06 08:52:47 UTC (rev 136818)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.h	2012-12-06 08:57:44 UTC (rev 136819)
@@ -179,6 +179,12 @@
         return V8PerIsolateData::from(isolate)->integerCache()->v8Integer(value, isolate);
     }
 
+    // FIXME: All call sites of this method should use v8Integer().
+    inline v8::Handle<v8::Integer> deprecatedV8Integer(int value)
+    {
+        return v8Integer(value, v8::Isolate::GetCurrent());
+    }
+
     inline v8::Handle<v8::Integer> v8UnsignedInteger(unsigned value, v8::Isolate* isolate = 0)
     {
         if (UNLIKELY(!isolate))

Modified: trunk/Source/WebCore/bindings/v8/V8DOMConfiguration.cpp (136818 => 136819)


--- trunk/Source/WebCore/bindings/v8/V8DOMConfiguration.cpp	2012-12-06 08:52:47 UTC (rev 136818)
+++ trunk/Source/WebCore/bindings/v8/V8DOMConfiguration.cpp	2012-12-06 08:57:44 UTC (rev 136819)
@@ -49,8 +49,8 @@
 {
     for (size_t i = 0; i < constantCount; ++i) {
         const BatchedConstant* constant = &constants[i];
-        functionDescriptor->Set(v8::String::NewSymbol(constant->name), v8Integer(constant->value), v8::ReadOnly);
-        prototype->Set(v8::String::NewSymbol(constant->name), v8Integer(constant->value), v8::ReadOnly);
+        functionDescriptor->Set(v8::String::NewSymbol(constant->name), deprecatedV8Integer(constant->value), v8::ReadOnly);
+        prototype->Set(v8::String::NewSymbol(constant->name), deprecatedV8Integer(constant->value), v8::ReadOnly);
     }
 }
 

Modified: trunk/Source/WebCore/bindings/v8/V8NPUtils.cpp (136818 => 136819)


--- trunk/Source/WebCore/bindings/v8/V8NPUtils.cpp	2012-12-06 08:52:47 UTC (rev 136818)
+++ trunk/Source/WebCore/bindings/v8/V8NPUtils.cpp	2012-12-06 08:57:44 UTC (rev 136819)
@@ -82,7 +82,7 @@
 
     switch (type) {
     case NPVariantType_Int32:
-        return v8Integer(NPVARIANT_TO_INT32(*variant));
+        return deprecatedV8Integer(NPVARIANT_TO_INT32(*variant));
     case NPVariantType_Double:
         return v8::Number::New(NPVARIANT_TO_DOUBLE(*variant));
     case NPVariantType_Bool:

Modified: trunk/Source/WebCore/bindings/v8/V8Utilities.cpp (136818 => 136819)


--- trunk/Source/WebCore/bindings/v8/V8Utilities.cpp	2012-12-06 08:52:47 UTC (rev 136818)
+++ trunk/Source/WebCore/bindings/v8/V8Utilities.cpp	2012-12-06 08:57:44 UTC (rev 136819)
@@ -59,7 +59,7 @@
     }
 
     v8::Local<v8::Array> cacheArray = v8::Local<v8::Array>::Cast(cache);
-    cacheArray->Set(v8Integer(cacheArray->Length()), value);
+    cacheArray->Set(deprecatedV8Integer(cacheArray->Length()), value);
 }
 
 bool extractTransferables(v8::Local<v8::Value> value, MessagePortArray& ports, ArrayBufferArray& arrayBuffers, v8::Isolate* isolate)
@@ -128,7 +128,7 @@
         return;
     v8::Local<v8::Array> cacheArray = v8::Local<v8::Array>::Cast(cache);
     for (int i = cacheArray->Length() - 1; i >= 0; --i) {
-        v8::Local<v8::Value> cached = cacheArray->Get(v8Integer(i));
+        v8::Local<v8::Value> cached = cacheArray->Get(deprecatedV8Integer(i));
         if (cached->StrictEquals(value)) {
             cacheArray->Delete(i);
             return;

Modified: trunk/Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp (136818 => 136819)


--- trunk/Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp	2012-12-06 08:52:47 UTC (rev 136818)
+++ trunk/Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp	2012-12-06 08:57:44 UTC (rev 136819)
@@ -55,7 +55,7 @@
     if (!listener.IsEmpty() && listener->IsFunction()) {
         v8::Local<v8::Function> callFunction = v8::Local<v8::Function>::Cast(listener);
         v8::Local<v8::Object> thisValue = v8::Context::GetCurrent()->Global();
-        v8::Handle<v8::Value> parameters[3] = { v8String(errorEvent->message()), v8String(errorEvent->filename()), v8Integer(errorEvent->lineno()) };
+        v8::Handle<v8::Value> parameters[3] = { v8String(errorEvent->message()), v8String(errorEvent->filename()), deprecatedV8Integer(errorEvent->lineno()) };
         v8::TryCatch tryCatch;
         tryCatch.SetVerbose(true);
         returnValue = ScriptController::callFunctionWithInstrumentation(0, callFunction, thisValue, 3, parameters);

Modified: trunk/Source/WebCore/bindings/v8/V8WorkerContextErrorHandler.cpp (136818 => 136819)


--- trunk/Source/WebCore/bindings/v8/V8WorkerContextErrorHandler.cpp	2012-12-06 08:52:47 UTC (rev 136818)
+++ trunk/Source/WebCore/bindings/v8/V8WorkerContextErrorHandler.cpp	2012-12-06 08:57:44 UTC (rev 136819)
@@ -55,7 +55,7 @@
         ErrorEvent* errorEvent = static_cast<ErrorEvent*>(event);
         v8::Local<v8::Function> callFunction = v8::Local<v8::Function>::Cast(listener);
         v8::Local<v8::Object> thisValue = v8::Context::GetCurrent()->Global();
-        v8::Handle<v8::Value> parameters[3] = { v8String(errorEvent->message()), v8String(errorEvent->filename()), v8Integer(errorEvent->lineno()) };
+        v8::Handle<v8::Value> parameters[3] = { v8String(errorEvent->message()), v8String(errorEvent->filename()), deprecatedV8Integer(errorEvent->lineno()) };
         V8RecursionScope recursionScope(context);
         returnValue = callFunction->Call(thisValue, 3, parameters);
     }

Modified: trunk/Source/WebCore/bindings/v8/WorkerScriptDebugServer.cpp (136818 => 136819)


--- trunk/Source/WebCore/bindings/v8/WorkerScriptDebugServer.cpp	2012-12-06 08:52:47 UTC (rev 136818)
+++ trunk/Source/WebCore/bindings/v8/WorkerScriptDebugServer.cpp	2012-12-06 08:57:44 UTC (rev 136819)
@@ -73,7 +73,7 @@
     ASSERT(!value->IsUndefined() && value->IsArray());
     v8::Handle<v8::Array> scriptsArray = v8::Handle<v8::Array>::Cast(value);
     for (unsigned i = 0; i < scriptsArray->Length(); ++i)
-        dispatchDidParseSource(listener, v8::Handle<v8::Object>::Cast(scriptsArray->Get(v8Integer(i))));
+        dispatchDidParseSource(listener, v8::Handle<v8::Object>::Cast(scriptsArray->Get(deprecatedV8Integer(i))));
 }
 
 void WorkerScriptDebugServer::removeListener(ScriptDebugListener* listener)

Modified: trunk/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp (136818 => 136819)


--- trunk/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp	2012-12-06 08:52:47 UTC (rev 136818)
+++ trunk/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp	2012-12-06 08:57:44 UTC (rev 136819)
@@ -65,7 +65,7 @@
 
     v8::Local<v8::Array> mutationsArray = v8::Array::New(mutations->size());
     for (size_t i = 0; i < mutations->size(); ++i)
-        mutationsArray->Set(v8Integer(i), toV8(mutations->at(i).get()));
+        mutationsArray->Set(deprecatedV8Integer(i), toV8(mutations->at(i).get()));
 
     v8::Handle<v8::Value> observerHandle = toV8(observer);
     if (observerHandle.IsEmpty()) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to