- Revision
- 136813
- Author
- hara...@chromium.org
- Date
- 2012-12-06 00:31:55 -0800 (Thu, 06 Dec 2012)
Log Message
[V8] Replace v8String("symbol") with v8::String::NewSymbol("symbol")
https://bugs.webkit.org/show_bug.cgi?id=104209
Reviewed by Adam Barth.
V8 can look up symbols faster than strings.
No tests. No change in behavior.
* bindings/v8/_javascript_CallFrame.cpp:
(WebCore::_javascript_CallFrame::caller):
(WebCore::_javascript_CallFrame::sourceID):
(WebCore::_javascript_CallFrame::line):
(WebCore::_javascript_CallFrame::column):
(WebCore::_javascript_CallFrame::functionName):
(WebCore::_javascript_CallFrame::scopeChain):
(WebCore::_javascript_CallFrame::scopeType):
(WebCore::_javascript_CallFrame::thisObject):
(WebCore::_javascript_CallFrame::evaluate):
(WebCore::_javascript_CallFrame::restart):
* bindings/v8/V8ThrowException.cpp:
(WebCore::domExceptionStackGetter):
(WebCore::domExceptionStackSetter):
(WebCore::V8ThrowException::setDOMException):
* bindings/v8/custom/V8InspectorFrontendHostCustom.cpp:
(WebCore::V8InspectorFrontendHost::platformCallback):
* bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp:
(WebCore::V8JavaScriptCallFrame::typeAccessorGetter):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (136812 => 136813)
--- trunk/Source/WebCore/ChangeLog 2012-12-06 08:20:59 UTC (rev 136812)
+++ trunk/Source/WebCore/ChangeLog 2012-12-06 08:31:55 UTC (rev 136813)
@@ -1,3 +1,34 @@
+2012-12-06 Kentaro Hara <hara...@chromium.org>
+
+ [V8] Replace v8String("symbol") with v8::String::NewSymbol("symbol")
+ https://bugs.webkit.org/show_bug.cgi?id=104209
+
+ Reviewed by Adam Barth.
+
+ V8 can look up symbols faster than strings.
+
+ No tests. No change in behavior.
+
+ * bindings/v8/_javascript_CallFrame.cpp:
+ (WebCore::_javascript_CallFrame::caller):
+ (WebCore::_javascript_CallFrame::sourceID):
+ (WebCore::_javascript_CallFrame::line):
+ (WebCore::_javascript_CallFrame::column):
+ (WebCore::_javascript_CallFrame::functionName):
+ (WebCore::_javascript_CallFrame::scopeChain):
+ (WebCore::_javascript_CallFrame::scopeType):
+ (WebCore::_javascript_CallFrame::thisObject):
+ (WebCore::_javascript_CallFrame::evaluate):
+ (WebCore::_javascript_CallFrame::restart):
+ * bindings/v8/V8ThrowException.cpp:
+ (WebCore::domExceptionStackGetter):
+ (WebCore::domExceptionStackSetter):
+ (WebCore::V8ThrowException::setDOMException):
+ * bindings/v8/custom/V8InspectorFrontendHostCustom.cpp:
+ (WebCore::V8InspectorFrontendHost::platformCallback):
+ * bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp:
+ (WebCore::V8JavaScriptCallFrame::typeAccessorGetter):
+
2012-12-06 Sheriff Bot <webkit.review....@gmail.com>
Unreviewed, rolling out r136784 and r136802.
Modified: trunk/Source/WebCore/bindings/v8/_javascript_CallFrame.cpp (136812 => 136813)
--- trunk/Source/WebCore/bindings/v8/_javascript_CallFrame.cpp 2012-12-06 08:20:59 UTC (rev 136812)
+++ trunk/Source/WebCore/bindings/v8/_javascript_CallFrame.cpp 2012-12-06 08:31:55 UTC (rev 136813)
@@ -52,7 +52,7 @@
if (!m_caller) {
v8::HandleScope handleScope;
v8::Context::Scope contextScope(m_debuggerContext.get());
- v8::Handle<v8::Value> callerFrame = m_callFrame.get()->Get(v8String("caller"));
+ v8::Handle<v8::Value> callerFrame = m_callFrame.get()->Get(v8::String::NewSymbol("caller"));
if (!callerFrame->IsObject())
return 0;
m_caller = _javascript_CallFrame::create(m_debuggerContext.get(), v8::Handle<v8::Object>::Cast(callerFrame));
@@ -64,7 +64,7 @@
{
v8::HandleScope handleScope;
v8::Context::Scope contextScope(m_debuggerContext.get());
- v8::Handle<v8::Value> result = m_callFrame.get()->Get(v8String("sourceID"));
+ v8::Handle<v8::Value> result = m_callFrame.get()->Get(v8::String::NewSymbol("sourceID"));
if (result->IsInt32())
return result->Int32Value();
return 0;
@@ -74,7 +74,7 @@
{
v8::HandleScope handleScope;
v8::Context::Scope contextScope(m_debuggerContext.get());
- v8::Handle<v8::Value> result = m_callFrame.get()->Get(v8String("line"));
+ v8::Handle<v8::Value> result = m_callFrame.get()->Get(v8::String::NewSymbol("line"));
if (result->IsInt32())
return result->Int32Value();
return 0;
@@ -84,7 +84,7 @@
{
v8::HandleScope handleScope;
v8::Context::Scope contextScope(m_debuggerContext.get());
- v8::Handle<v8::Value> result = m_callFrame.get()->Get(v8String("column"));
+ v8::Handle<v8::Value> result = m_callFrame.get()->Get(v8::String::NewSymbol("column"));
if (result->IsInt32())
return result->Int32Value();
return 0;
@@ -94,13 +94,13 @@
{
v8::HandleScope handleScope;
v8::Context::Scope contextScope(m_debuggerContext.get());
- v8::Handle<v8::Value> result = m_callFrame.get()->Get(v8String("functionName"));
+ v8::Handle<v8::Value> result = m_callFrame.get()->Get(v8::String::NewSymbol("functionName"));
return toWebCoreStringWithUndefinedOrNullCheck(result);
}
v8::Handle<v8::Value> _javascript_CallFrame::scopeChain() const
{
- v8::Handle<v8::Array> scopeChain = v8::Handle<v8::Array>::Cast(m_callFrame.get()->Get(v8String("scopeChain")));
+ v8::Handle<v8::Array> scopeChain = v8::Handle<v8::Array>::Cast(m_callFrame.get()->Get(v8::String::NewSymbol("scopeChain")));
v8::Handle<v8::Array> result = v8::Array::New(scopeChain->Length());
for (uint32_t i = 0; i < scopeChain->Length(); i++)
result->Set(i, scopeChain->Get(i));
@@ -109,25 +109,25 @@
int _javascript_CallFrame::scopeType(int scopeIndex) const
{
- v8::Handle<v8::Array> scopeType = v8::Handle<v8::Array>::Cast(m_callFrame.get()->Get(v8String("scopeType")));
+ v8::Handle<v8::Array> scopeType = v8::Handle<v8::Array>::Cast(m_callFrame.get()->Get(v8::String::NewSymbol("scopeType")));
return scopeType->Get(scopeIndex)->Int32Value();
}
v8::Handle<v8::Value> _javascript_CallFrame::thisObject() const
{
- return m_callFrame.get()->Get(v8String("thisObject"));
+ return m_callFrame.get()->Get(v8::String::NewSymbol("thisObject"));
}
v8::Handle<v8::Value> _javascript_CallFrame::evaluate(const String& _expression_)
{
- v8::Handle<v8::Function> evalFunction = v8::Handle<v8::Function>::Cast(m_callFrame.get()->Get(v8String("evaluate")));
+ v8::Handle<v8::Function> evalFunction = v8::Handle<v8::Function>::Cast(m_callFrame.get()->Get(v8::String::NewSymbol("evaluate")));
v8::Handle<v8::Value> argv[] = { v8String(_expression_) };
return evalFunction->Call(m_callFrame.get(), 1, argv);
}
v8::Handle<v8::Value> _javascript_CallFrame::restart()
{
- v8::Handle<v8::Function> restartFunction = v8::Handle<v8::Function>::Cast(m_callFrame.get()->Get(v8String("restart")));
+ v8::Handle<v8::Function> restartFunction = v8::Handle<v8::Function>::Cast(m_callFrame.get()->Get(v8::String::NewSymbol("restart")));
return restartFunction->Call(m_callFrame.get(), 0, 0);
}
Modified: trunk/Source/WebCore/bindings/v8/V8ThrowException.cpp (136812 => 136813)
--- trunk/Source/WebCore/bindings/v8/V8ThrowException.cpp 2012-12-06 08:20:59 UTC (rev 136812)
+++ trunk/Source/WebCore/bindings/v8/V8ThrowException.cpp 2012-12-06 08:31:55 UTC (rev 136813)
@@ -34,13 +34,13 @@
static v8::Handle<v8::Value> domExceptionStackGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
ASSERT(info.Data()->IsObject());
- return info.Data()->ToObject()->Get(v8String("stack", info.GetIsolate()));
+ return info.Data()->ToObject()->Get(v8::String::NewSymbol("stack"));
}
static void domExceptionStackSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
ASSERT(info.Data()->IsObject());
- info.Data()->ToObject()->Set(v8String("stack", info.GetIsolate()), value);
+ info.Data()->ToObject()->Set(v8::String::NewSymbol("stack"), value);
}
#define TRY_TO_CREATE_EXCEPTION(interfaceName) \
@@ -71,7 +71,7 @@
v8::Handle<v8::Value> error = v8::Exception::Error(v8String(description.description, isolate));
ASSERT(!error.IsEmpty());
ASSERT(exception->IsObject());
- exception->ToObject()->SetAccessor(v8String("stack", isolate), domExceptionStackGetter, domExceptionStackSetter, error);
+ exception->ToObject()->SetAccessor(v8::String::NewSymbol("stack"), domExceptionStackGetter, domExceptionStackSetter, error);
return v8::ThrowException(exception);
}
Modified: trunk/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp (136812 => 136813)
--- trunk/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp 2012-12-06 08:20:59 UTC (rev 136812)
+++ trunk/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp 2012-12-06 08:31:55 UTC (rev 136813)
@@ -46,19 +46,19 @@
v8::Handle<v8::Value> V8InspectorFrontendHost::platformCallback(const v8::Arguments& args)
{
#if defined(OS_MACOSX)
- return v8String("mac", args.GetIsolate());
+ return v8::String::NewSymbol("mac");
#elif defined(OS_LINUX)
- return v8String("linux", args.GetIsolate());
+ return v8::String::NewSymbol("linux");
#elif defined(OS_FREEBSD)
- return v8String("freebsd", args.GetIsolate());
+ return v8::String::NewSymbol("freebsd");
#elif defined(OS_OPENBSD)
- return v8String("openbsd", args.GetIsolate());
+ return v8::String::NewSymbol("openbsd");
#elif defined(OS_SOLARIS)
- return v8String("solaris", args.GetIsolate());
+ return v8::String::NewSymbol("solaris");
#elif defined(OS_WIN)
- return v8String("windows", args.GetIsolate());
+ return v8::String::NewSymbol("windows");
#else
- return v8String("unknown", args.GetIsolate());
+ return v8::String::NewSymbol("unknown");
#endif
}
Modified: trunk/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp (136812 => 136813)
--- trunk/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp 2012-12-06 08:20:59 UTC (rev 136812)
+++ trunk/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp 2012-12-06 08:31:55 UTC (rev 136813)
@@ -77,7 +77,7 @@
v8::Handle<v8::Value> V8JavaScriptCallFrame::typeAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("V8JavaScriptCallFrame.typeAccessorGetter()");
- return v8String("function", info.GetIsolate());
+ return v8::String::NewSymbol("function");
}
} // namespace WebCore