Title: [201645] trunk/Source/_javascript_Core
- Revision
- 201645
- Author
- [email protected]
- Date
- 2016-06-03 09:43:10 -0700 (Fri, 03 Jun 2016)
Log Message
Eliminate two large sources of temporary StringImpl objects.
<https://webkit.org/b/158336>
Reviewed by Anders Carlsson.
We were jumping through some inefficient hoops when creating Identifiers due to the
convenience of our String(const char*) constructor.
This patch avoids just over 1 million temporary StringImpl objects on the PLUM benchmark.
* runtime/JSObject.h:
(JSC::makeIdentifier): Add an overload for string literals so we can stop creating a temporary
String just for passing to Identifier::fromString().
* runtime/Lookup.h:
(JSC::reifyStaticProperties): Use the Identifier::fromString() that takes an LChar* and a length
instead of creating a temporary String.
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (201644 => 201645)
--- trunk/Source/_javascript_Core/ChangeLog 2016-06-03 16:32:47 UTC (rev 201644)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-06-03 16:43:10 UTC (rev 201645)
@@ -1,3 +1,23 @@
+2016-06-03 Andreas Kling <[email protected]>
+
+ Eliminate two large sources of temporary StringImpl objects.
+ <https://webkit.org/b/158336>
+
+ Reviewed by Anders Carlsson.
+
+ We were jumping through some inefficient hoops when creating Identifiers due to the
+ convenience of our String(const char*) constructor.
+
+ This patch avoids just over 1 million temporary StringImpl objects on the PLUM benchmark.
+
+ * runtime/JSObject.h:
+ (JSC::makeIdentifier): Add an overload for string literals so we can stop creating a temporary
+ String just for passing to Identifier::fromString().
+
+ * runtime/Lookup.h:
+ (JSC::reifyStaticProperties): Use the Identifier::fromString() that takes an LChar* and a length
+ instead of creating a temporary String.
+
2016-06-03 Mark Lam <[email protected]>
Clean up how StackVisitor dumps its frames.
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (201644 => 201645)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2016-06-03 16:32:47 UTC (rev 201644)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2016-06-03 16:43:10 UTC (rev 201645)
@@ -1624,6 +1624,12 @@
COMPILE_ASSERT(!(sizeof(JSObject) % sizeof(WriteBarrierBase<Unknown>)), JSObject_inline_storage_has_correct_alignment);
+template<unsigned charactersCount>
+ALWAYS_INLINE Identifier makeIdentifier(VM& vm, const char (&characters)[charactersCount])
+{
+ return Identifier::fromString(&vm, characters);
+}
+
ALWAYS_INLINE Identifier makeIdentifier(VM& vm, const char* name)
{
return Identifier::fromString(&vm, name);
Modified: trunk/Source/_javascript_Core/runtime/Lookup.h (201644 => 201645)
--- trunk/Source/_javascript_Core/runtime/Lookup.h 2016-06-03 16:32:47 UTC (rev 201644)
+++ trunk/Source/_javascript_Core/runtime/Lookup.h 2016-06-03 16:43:10 UTC (rev 201645)
@@ -428,7 +428,7 @@
for (auto& value : values) {
if (!value.m_key)
continue;
- auto key = Identifier::fromString(&vm, value.m_key);
+ auto key = Identifier::fromString(&vm, reinterpret_cast<const LChar*>(value.m_key), strlen(value.m_key));
reifyStaticProperty(vm, key, value, thisObj);
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes