Diff
Modified: trunk/Source/WebCore/ChangeLog (121537 => 121538)
--- trunk/Source/WebCore/ChangeLog 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/ChangeLog 2012-06-29 09:35:11 UTC (rev 121538)
@@ -1,3 +1,56 @@
+2012-06-29 Kentaro Hara <[email protected]>
+
+ [V8] Replace v8::Integer::New() with v8Integer() in bindings/v8/*.{h,cpp}
+ https://bugs.webkit.org/show_bug.cgi?id=90238
+
+ Reviewed by Yury Semikhatsky.
+
+ v8Integer() is a fast wrapper of v8::Integer::New().
+ We can replace v8::Integer::New() with v8Integer()
+ in bindings/v8/*.{h,cpp}. In addition, we pass isolate
+ to v8Integer() where possible.
+
+ No tests. No change in behavior.
+
+ * bindings/v8/Dictionary.cpp:
+ (WebCore::Dictionary::get):
+ * bindings/v8/NPV8Object.cpp:
+ (_NPN_Enumerate): Changed v8::None to 0, for consistency with other code.
+ * bindings/v8/PageScriptDebugServer.cpp:
+ (WebCore::PageScriptDebugServer::addListener):
+ * bindings/v8/ScriptDebugServer.cpp:
+ (WebCore::ScriptDebugServer::setBreakpoint):
+ (WebCore::ScriptDebugServer::compileScript):
+ * bindings/v8/SerializedScriptValue.cpp:
+ * bindings/v8/V8Binding.cpp:
+ (WebCore::v8Array):
+ (WebCore::v8ValueToWebCoreDOMStringList):
+ * bindings/v8/V8Binding.h:
+ (WebCore::v8Array):
+ (WebCore::v8NumberArrayToVector):
+ * bindings/v8/V8Collection.h:
+ (WebCore::nodeCollectionIndexedPropertyEnumerator):
+ (WebCore::collectionIndexedPropertyEnumerator):
+ * bindings/v8/V8LazyEventListener.cpp:
+ (WebCore::V8LazyEventListener::prepareListenerObject):
+ * bindings/v8/V8NPObject.cpp:
+ (WebCore::npObjectQueryProperty):
+ (WebCore::npObjectPropertyEnumerator):
+ * bindings/v8/V8NPUtils.cpp:
+ (WebCore::convertNPVariantToV8Object):
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::batchConfigureConstants):
+ (WebCore::V8Proxy::compileScript):
+ * 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):
+
2012-06-28 Vsevolod Vlasov <[email protected]>
Web Inspector: Resource content is not loaded if Resource.requestContent method is called before network request is finished.
Modified: trunk/Source/WebCore/bindings/v8/Dictionary.cpp (121537 => 121538)
--- trunk/Source/WebCore/bindings/v8/Dictionary.cpp 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/bindings/v8/Dictionary.cpp 2012-06-29 09:35:11 UTC (rev 121538)
@@ -277,7 +277,7 @@
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(v8::Integer::New(i));
+ v8::Local<v8::Value> indexedValue = v8Array->Get(v8Integer(i));
value.add(v8ValueToWebCoreString(indexedValue));
}
Modified: trunk/Source/WebCore/bindings/v8/NPV8Object.cpp (121537 => 121538)
--- trunk/Source/WebCore/bindings/v8/NPV8Object.cpp 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/bindings/v8/NPV8Object.cpp 2012-06-29 09:35:11 UTC (rev 121538)
@@ -36,6 +36,7 @@
#include "PlatformString.h"
#include "ScriptSourceCode.h"
#include "UserGestureIndicator.h"
+#include "V8Binding.h"
#include "V8GCController.h"
#include "V8Helpers.h"
#include "V8NPUtils.h"
@@ -537,7 +538,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(v8::Integer::New(i));
+ v8::Local<v8::Value> name = props->Get(v8Integer(i));
(*identifier)[i] = getStringIdentifier(v8::Local<v8::String>::Cast(name));
}
return true;
Modified: trunk/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp (121537 => 121538)
--- trunk/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp 2012-06-29 09:35:11 UTC (rev 121538)
@@ -112,7 +112,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(v8::Integer::New(i))));
+ dispatchDidParseSource(listener, v8::Handle<v8::Object>::Cast(scriptsArray->Get(v8Integer(i))));
}
void PageScriptDebugServer::removeListener(ScriptDebugListener* listener, Page* page)
Modified: trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp (121537 => 121538)
--- trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp 2012-06-29 09:35:11 UTC (rev 121538)
@@ -79,8 +79,8 @@
v8::Local<v8::Object> args = v8::Object::New();
args->Set(v8::String::New("sourceID"), v8String(sourceID));
- args->Set(v8::String::New("lineNumber"), v8::Integer::New(scriptBreakpoint.lineNumber));
- args->Set(v8::String::New("columnNumber"), v8::Integer::New(scriptBreakpoint.columnNumber));
+ args->Set(v8::String::New("lineNumber"), v8Integer(scriptBreakpoint.lineNumber));
+ args->Set(v8::String::New("columnNumber"), v8Integer(scriptBreakpoint.columnNumber));
args->Set(v8::String::New("condition"), v8String(scriptBreakpoint.condition));
v8::Handle<v8::Function> setBreakpointFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("setBreakpoint")));
@@ -428,7 +428,7 @@
v8::Local<v8::String> code = v8ExternalString(_expression_);
v8::TryCatch tryCatch;
- v8::ScriptOrigin origin(v8ExternalString(sourceURL), v8::Integer::New(0), v8::Integer::New(0));
+ v8::ScriptOrigin origin(v8ExternalString(sourceURL), v8Integer(0), v8Integer(0));
v8::Handle<v8::Script> script = v8::Script::New(code, &origin);
if (tryCatch.HasCaught()) {
Modified: trunk/Source/WebCore/bindings/v8/SerializedScriptValue.cpp (121537 => 121538)
--- trunk/Source/WebCore/bindings/v8/SerializedScriptValue.cpp 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/bindings/v8/SerializedScriptValue.cpp 2012-06-29 09:35:11 UTC (rev 121538)
@@ -1574,7 +1574,7 @@
uint32_t rawValue;
if (!doReadUint32(&rawValue))
return false;
- *value = v8::Integer::New(static_cast<int32_t>(ZigZag::decode(rawValue)));
+ *value = v8Integer(static_cast<int32_t>(ZigZag::decode(rawValue)), m_isolate);
return true;
}
@@ -1583,7 +1583,7 @@
uint32_t rawValue;
if (!doReadUint32(&rawValue))
return false;
- *value = v8::Integer::NewFromUnsigned(rawValue);
+ *value = v8UnsignedInteger(rawValue, m_isolate);
return true;
}
Modified: trunk/Source/WebCore/bindings/v8/V8Binding.cpp (121537 => 121538)
--- trunk/Source/WebCore/bindings/v8/V8Binding.cpp 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.cpp 2012-06-29 09:35:11 UTC (rev 121538)
@@ -218,7 +218,7 @@
return v8::Array::New();
v8::Local<v8::Array> result = v8::Array::New(stringList->length());
for (unsigned i = 0; i < stringList->length(); ++i)
- result->Set(v8::Integer::New(i), v8String(stringList->item(i), isolate));
+ result->Set(v8Integer(i, isolate), v8String(stringList->item(i), isolate));
return result;
}
@@ -592,7 +592,7 @@
RefPtr<DOMStringList> ret = DOMStringList::create();
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(v8::Integer::New(i));
+ v8::Local<v8::Value> indexedValue = v8Array->Get(v8Integer(i));
ret->append(v8ValueToWebCoreString(indexedValue));
}
return ret.release();
Modified: trunk/Source/WebCore/bindings/v8/V8Binding.h (121537 => 121538)
--- trunk/Source/WebCore/bindings/v8/V8Binding.h 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.h 2012-06-29 09:35:11 UTC (rev 121538)
@@ -344,7 +344,7 @@
int index = 0;
typename Vector<T>::const_iterator end = iterator.end();
for (typename Vector<T>::const_iterator iter = iterator.begin(); iter != end; ++iter)
- result->Set(v8::Integer::New(index++), toV8(WTF::getPtr(*iter), isolate));
+ result->Set(v8Integer(index++, isolate), toV8(WTF::getPtr(*iter), isolate));
return result;
}
@@ -355,7 +355,7 @@
Vector<String>::const_iterator end = iterator.end();
int index = 0;
for (Vector<String>::const_iterator iter = iterator.begin(); iter != end; ++iter)
- array->Set(v8::Integer::New(index++), v8String(*iter, isolate));
+ array->Set(v8Integer(index++, isolate), v8String(*iter, isolate));
return array;
}
@@ -551,7 +551,7 @@
v8::Local<v8::Array> v8Array = v8::Local<v8::Array>::Cast(v8Value);
size_t length = v8Array->Length();
for (size_t i = 0; i < length; ++i) {
- v8::Local<v8::Value> indexedValue = v8Array->Get(v8::Integer::New(i));
+ v8::Local<v8::Value> indexedValue = v8Array->Get(v8Integer(i));
result.append(static_cast<T>(indexedValue->NumberValue()));
}
return result;
Modified: trunk/Source/WebCore/bindings/v8/V8Collection.h (121537 => 121538)
--- trunk/Source/WebCore/bindings/v8/V8Collection.h 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/bindings/v8/V8Collection.h 2012-06-29 09:35:11 UTC (rev 121538)
@@ -106,7 +106,7 @@
v8::Handle<v8::Array> properties = v8::Array::New(length);
for (int i = 0; i < length; ++i) {
// FIXME: Do we need to check that the item function returns a non-null value for this index?
- v8::Handle<v8::Integer> integer = v8::Integer::New(i);
+ v8::Handle<v8::Integer> integer = v8Integer(i, info.GetIsolate());
properties->Set(integer, integer);
}
return properties;
@@ -121,7 +121,7 @@
v8::Handle<v8::Array> properties = v8::Array::New(length);
for (int i = 0; i < length; ++i) {
// FIXME: Do we need to check that the item function returns a non-null value for this index?
- v8::Handle<v8::Integer> integer = v8::Integer::New(i);
+ v8::Handle<v8::Integer> integer = v8Integer(i, info.GetIsolate());
properties->Set(integer, integer);
}
return properties;
Modified: trunk/Source/WebCore/bindings/v8/V8LazyEventListener.cpp (121537 => 121538)
--- trunk/Source/WebCore/bindings/v8/V8LazyEventListener.cpp 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/bindings/v8/V8LazyEventListener.cpp 2012-06-29 09:35:11 UTC (rev 121538)
@@ -180,11 +180,11 @@
v8::Local<v8::Object> thisObject = v8::Object::New();
if (thisObject.IsEmpty())
return;
- if (!thisObject->ForceSet(v8::Integer::NewFromUnsigned(0), nodeWrapper))
+ if (!thisObject->ForceSet(v8UnsignedInteger(0), nodeWrapper))
return;
- if (!thisObject->ForceSet(v8::Integer::NewFromUnsigned(1), formWrapper))
+ if (!thisObject->ForceSet(v8UnsignedInteger(1), formWrapper))
return;
- if (!thisObject->ForceSet(v8::Integer::NewFromUnsigned(2), documentWrapper))
+ if (!thisObject->ForceSet(v8UnsignedInteger(2), documentWrapper))
return;
// FIXME: Remove this code when we stop doing the 'with' hack above.
Modified: trunk/Source/WebCore/bindings/v8/V8NPObject.cpp (121537 => 121538)
--- trunk/Source/WebCore/bindings/v8/V8NPObject.cpp 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/bindings/v8/V8NPObject.cpp 2012-06-29 09:35:11 UTC (rev 121538)
@@ -264,7 +264,7 @@
v8::Handle<v8::Integer> npObjectQueryProperty(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
NPIdentifier identifier = getStringIdentifier(name);
- return npObjectGetProperty(info.Holder(), identifier, name, info.GetIsolate()).IsEmpty() ? v8::Handle<v8::Integer>() : v8::Integer::New(v8::None);
+ return npObjectGetProperty(info.Holder(), identifier, name, info.GetIsolate()).IsEmpty() ? v8::Handle<v8::Integer>() : v8Integer(0, info.GetIsolate());
}
static v8::Handle<v8::Value> npObjectSetProperty(v8::Local<v8::Object> self, NPIdentifier identifier, v8::Local<v8::Value> value, v8::Isolate* isolate)
@@ -335,9 +335,9 @@
for (uint32_t i = 0; i < count; ++i) {
IdentifierRep* identifier = static_cast<IdentifierRep*>(identifiers[i]);
if (namedProperty)
- properties->Set(v8::Integer::New(i), v8::String::New(identifier->string()));
+ properties->Set(v8Integer(i, info.GetIsolate()), v8::String::New(identifier->string()));
else
- properties->Set(v8::Integer::New(i), v8::Integer::New(identifier->number()));
+ properties->Set(v8Integer(i, info.GetIsolate()), v8Integer(identifier->number(), info.GetIsolate()));
}
return properties;
Modified: trunk/Source/WebCore/bindings/v8/V8NPUtils.cpp (121537 => 121538)
--- trunk/Source/WebCore/bindings/v8/V8NPUtils.cpp 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/bindings/v8/V8NPUtils.cpp 2012-06-29 09:35:11 UTC (rev 121538)
@@ -83,7 +83,7 @@
switch (type) {
case NPVariantType_Int32:
- return v8::Integer::New(NPVARIANT_TO_INT32(*variant));
+ return v8Integer(NPVARIANT_TO_INT32(*variant));
case NPVariantType_Double:
return v8::Number::New(NPVARIANT_TO_DOUBLE(*variant));
case NPVariantType_Bool:
Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (121537 => 121538)
--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp 2012-06-29 09:35:11 UTC (rev 121538)
@@ -115,8 +115,8 @@
{
for (size_t i = 0; i < constantCount; ++i) {
const BatchedConstant* constant = &constants[i];
- functionDescriptor->Set(v8::String::New(constant->name), v8::Integer::New(constant->value), v8::ReadOnly);
- proto->Set(v8::String::New(constant->name), v8::Integer::New(constant->value), v8::ReadOnly);
+ functionDescriptor->Set(v8::String::New(constant->name), v8Integer(constant->value), v8::ReadOnly);
+ proto->Set(v8::String::New(constant->name), v8Integer(constant->value), v8::ReadOnly);
}
}
@@ -181,8 +181,8 @@
{
const uint16_t* fileNameString = fromWebCoreString(fileName);
v8::Handle<v8::String> name = v8::String::New(fileNameString, fileName.length());
- v8::Handle<v8::Integer> line = v8::Integer::New(scriptStartPosition.m_line.zeroBasedInt());
- v8::Handle<v8::Integer> column = v8::Integer::New(scriptStartPosition.m_column.zeroBasedInt());
+ v8::Handle<v8::Integer> line = v8Integer(scriptStartPosition.m_line.zeroBasedInt());
+ v8::Handle<v8::Integer> column = v8Integer(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/V8Utilities.cpp (121537 => 121538)
--- trunk/Source/WebCore/bindings/v8/V8Utilities.cpp 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/bindings/v8/V8Utilities.cpp 2012-06-29 09:35:11 UTC (rev 121538)
@@ -81,7 +81,7 @@
}
v8::Local<v8::Array> cacheArray = v8::Local<v8::Array>::Cast(cache);
- cacheArray->Set(v8::Integer::New(cacheArray->Length()), value);
+ cacheArray->Set(v8Integer(cacheArray->Length()), value);
}
bool extractTransferables(v8::Local<v8::Value> value, MessagePortArray& ports, ArrayBufferArray& arrayBuffers)
@@ -153,7 +153,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(v8::Integer::New(i));
+ v8::Local<v8::Value> cached = cacheArray->Get(v8Integer(i));
if (cached->StrictEquals(value)) {
cacheArray->Delete(i);
return;
Modified: trunk/Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp (121537 => 121538)
--- trunk/Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp 2012-06-29 09:35:11 UTC (rev 121538)
@@ -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()), v8::Integer::New(errorEvent->lineno()) };
+ v8::Handle<v8::Value> parameters[3] = { v8String(errorEvent->message()), v8String(errorEvent->filename()), v8Integer(errorEvent->lineno()) };
v8::TryCatch tryCatch;
tryCatch.SetVerbose(true);
returnValue = V8Proxy::instrumentedCallFunction(0 /* frame */, callFunction, thisValue, 3, parameters);
Modified: trunk/Source/WebCore/bindings/v8/V8WorkerContextErrorHandler.cpp (121537 => 121538)
--- trunk/Source/WebCore/bindings/v8/V8WorkerContextErrorHandler.cpp 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/bindings/v8/V8WorkerContextErrorHandler.cpp 2012-06-29 09:35:11 UTC (rev 121538)
@@ -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()), v8::Integer::New(errorEvent->lineno()) };
+ v8::Handle<v8::Value> parameters[3] = { v8String(errorEvent->message()), v8String(errorEvent->filename()), v8Integer(errorEvent->lineno()) };
V8RecursionScope recursionScope(context);
returnValue = callFunction->Call(thisValue, 3, parameters);
}
Modified: trunk/Source/WebCore/bindings/v8/WorkerScriptDebugServer.cpp (121537 => 121538)
--- trunk/Source/WebCore/bindings/v8/WorkerScriptDebugServer.cpp 2012-06-29 09:32:59 UTC (rev 121537)
+++ trunk/Source/WebCore/bindings/v8/WorkerScriptDebugServer.cpp 2012-06-29 09:35:11 UTC (rev 121538)
@@ -79,7 +79,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(v8::Integer::New(i))));
+ dispatchDidParseSource(listener, v8::Handle<v8::Object>::Cast(scriptsArray->Get(v8Integer(i))));
}
void WorkerScriptDebugServer::removeListener(ScriptDebugListener* listener)