Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (173081 => 173082)
--- trunk/Source/_javascript_Core/ChangeLog 2014-08-28 21:36:25 UTC (rev 173081)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-08-28 21:38:18 UTC (rev 173082)
@@ -1,3 +1,33 @@
+2014-08-28 Andreas Kling <akl...@apple.com>
+
+ Use JSString::toIdentifier() in more places.
+ <https://webkit.org/b/136348>
+
+ Call sites that grab the WTF::String from a JSString using value() can
+ use the more efficient toIdentifier() if the string is going to be used
+ to construct an Identifier.
+
+ If the JSString is a rope that resolves to something that is already
+ present in the VM's Identifier table, using toIdentifier() can avoid
+ allocating a new StringImpl.
+
+ Reviewed by Geoffrey Garen.
+
+ * jit/JITOperations.cpp:
+ * llint/LLIntSlowPaths.cpp:
+ (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+ * runtime/CommonSlowPaths.cpp:
+ (JSC::SLOW_PATH_DECL):
+ * runtime/CommonSlowPaths.h:
+ (JSC::CommonSlowPaths::opIn):
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::Stringifier):
+ * runtime/ObjectConstructor.cpp:
+ (JSC::objectConstructorGetOwnPropertyDescriptor):
+ (JSC::objectConstructorDefineProperty):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncPropertyIsEnumerable):
+
2014-08-27 Filip Pizlo <fpi...@apple.com>
DFG should compute immediate dominators using the O(n log n) form of Lengauer and Tarjan's "A Fast Algorithm for Finding Dominators in a Flowgraph"
Modified: trunk/Source/_javascript_Core/jit/JITOperations.cpp (173081 => 173082)
--- trunk/Source/_javascript_Core/jit/JITOperations.cpp 2014-08-28 21:36:25 UTC (rev 173081)
+++ trunk/Source/_javascript_Core/jit/JITOperations.cpp 2014-08-28 21:38:18 UTC (rev 173082)
@@ -480,7 +480,7 @@
PutPropertySlot slot(baseObject, callFrame->codeBlock()->isStrictMode());
baseObject->putDirect(callFrame->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot);
} else {
- Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame));
+ Identifier property = subscript.toString(callFrame)->toIdentifier(callFrame);
if (!callFrame->vm().exception()) { // Don't put to an object if toString threw an exception.
PutPropertySlot slot(baseObject, callFrame->codeBlock()->isStrictMode());
baseObject->putDirect(callFrame->vm(), property, value, slot);
@@ -920,7 +920,7 @@
size_t JIT_OPERATION operationHasProperty(ExecState* exec, JSObject* base, JSString* property)
{
- int result = base->hasProperty(exec, Identifier(exec, property->value(exec)));
+ int result = base->hasProperty(exec, property->toIdentifier(exec));
return result;
}
Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (173081 => 173082)
--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp 2014-08-28 21:36:25 UTC (rev 173081)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp 2014-08-28 21:38:18 UTC (rev 173082)
@@ -793,7 +793,7 @@
LLINT_END();
}
- Identifier property(exec, subscript.toString(exec)->value(exec));
+ Identifier property = subscript.toString(exec)->toIdentifier(exec);
LLINT_CHECK_EXCEPTION();
PutPropertySlot slot(baseValue, exec->codeBlock()->isStrictMode());
baseValue.put(exec, property, value, slot);
@@ -816,7 +816,7 @@
PutPropertySlot slot(baseObject, exec->codeBlock()->isStrictMode());
baseObject->putDirect(exec->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot);
} else {
- Identifier property(exec, subscript.toString(exec)->value(exec));
+ Identifier property = subscript.toString(exec)->toIdentifier(exec);
if (!exec->vm().exception()) { // Don't put to an object if toString threw an exception.
PutPropertySlot slot(baseObject, exec->codeBlock()->isStrictMode());
baseObject->putDirect(exec->vm(), property, value, slot);
@@ -842,7 +842,7 @@
couldDelete = baseObject->methodTable()->deleteProperty(baseObject, exec, jsCast<NameInstance*>(subscript.asCell())->privateName());
else {
LLINT_CHECK_EXCEPTION();
- Identifier property(exec, subscript.toString(exec)->value(exec));
+ Identifier property = subscript.toString(exec)->toIdentifier(exec);
LLINT_CHECK_EXCEPTION();
couldDelete = baseObject->methodTable()->deleteProperty(baseObject, exec, property);
}
Modified: trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp (173081 => 173082)
--- trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp 2014-08-28 21:36:25 UTC (rev 173081)
+++ trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp 2014-08-28 21:38:18 UTC (rev 173082)
@@ -507,7 +507,7 @@
couldDelete = baseObject->methodTable()->deleteProperty(baseObject, exec, jsCast<NameInstance*>(subscript.asCell())->privateName());
else {
CHECK_EXCEPTION();
- Identifier property(exec, subscript.toString(exec)->value(exec));
+ Identifier property = subscript.toString(exec)->toIdentifier(exec);
CHECK_EXCEPTION();
couldDelete = baseObject->methodTable()->deleteProperty(baseObject, exec, property);
}
Modified: trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h (173081 => 173082)
--- trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h 2014-08-28 21:36:25 UTC (rev 173081)
+++ trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h 2014-08-28 21:38:18 UTC (rev 173082)
@@ -85,7 +85,7 @@
if (isName(propName))
return baseObj->hasProperty(exec, jsCast<NameInstance*>(propName.asCell())->privateName());
- Identifier property(exec, propName.toString(exec)->value(exec));
+ Identifier property = propName.toString(exec)->toIdentifier(exec);
if (exec->vm().exception())
return false;
return baseObj->hasProperty(exec, property);
Modified: trunk/Source/_javascript_Core/runtime/JSONObject.cpp (173081 => 173082)
--- trunk/Source/_javascript_Core/runtime/JSONObject.cpp 2014-08-28 21:36:25 UTC (rev 173081)
+++ trunk/Source/_javascript_Core/runtime/JSONObject.cpp 2014-08-28 21:38:18 UTC (rev 173082)
@@ -228,7 +228,7 @@
continue;
}
- m_arrayReplacerPropertyNames.add(Identifier(exec, name.toString(exec)->value(exec)));
+ m_arrayReplacerPropertyNames.add(name.toString(exec)->toIdentifier(exec));
}
return;
}
Modified: trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp (173081 => 173082)
--- trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp 2014-08-28 21:36:25 UTC (rev 173081)
+++ trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp 2014-08-28 21:38:18 UTC (rev 173082)
@@ -173,12 +173,12 @@
{
if (!exec->argument(0).isObject())
return throwVMError(exec, createTypeError(exec, ASCIILiteral("Requested property descriptor of a value that is not an object.")));
- String propertyName = exec->argument(1).toString(exec)->value(exec);
+ Identifier propertyName = exec->argument(1).toString(exec)->toIdentifier(exec);
if (exec->hadException())
return JSValue::encode(jsNull());
JSObject* object = asObject(exec->argument(0));
PropertyDescriptor descriptor;
- if (!object->getOwnPropertyDescriptor(exec, Identifier(exec, propertyName), descriptor))
+ if (!object->getOwnPropertyDescriptor(exec, propertyName, descriptor))
return JSValue::encode(jsUndefined());
if (exec->hadException())
return JSValue::encode(jsUndefined());
@@ -316,7 +316,7 @@
if (!exec->argument(0).isObject())
return throwVMError(exec, createTypeError(exec, ASCIILiteral("Properties can only be defined on Objects.")));
JSObject* O = asObject(exec->argument(0));
- String propertyName = exec->argument(1).toString(exec)->value(exec);
+ Identifier propertyName = exec->argument(1).toString(exec)->toIdentifier(exec);
if (exec->hadException())
return JSValue::encode(jsNull());
PropertyDescriptor descriptor;
@@ -324,7 +324,7 @@
return JSValue::encode(jsNull());
ASSERT((descriptor.attributes() & Accessor) || (!descriptor.isAccessorDescriptor()));
ASSERT(!exec->hadException());
- O->methodTable(exec->vm())->defineOwnProperty(O, exec, Identifier(exec, propertyName), descriptor, true);
+ O->methodTable(exec->vm())->defineOwnProperty(O, exec, propertyName, descriptor, true);
return JSValue::encode(O);
}
Modified: trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp (173081 => 173082)
--- trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp 2014-08-28 21:36:25 UTC (rev 173081)
+++ trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp 2014-08-28 21:38:18 UTC (rev 173082)
@@ -182,7 +182,7 @@
EncodedJSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState* exec)
{
JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec);
- Identifier propertyName(exec, exec->argument(0).toString(exec)->value(exec));
+ Identifier propertyName = exec->argument(0).toString(exec)->toIdentifier(exec);
PropertyDescriptor descriptor;
bool enumerable = thisObject->getOwnPropertyDescriptor(exec, propertyName, descriptor) && descriptor.enumerable();