Title: [184107] trunk/Source/_javascript_Core
Revision
184107
Author
[email protected]
Date
2015-05-11 10:47:55 -0700 (Mon, 11 May 2015)

Log Message

JSON.stringify shouldn't use generic get() to access Array.length
<https://webkit.org/b/144847>

Reviewed by Geoffrey Garen.

If the value being serialized is a JSArray object, we can downcast and call its
length() directly instead of doing a generic property lookup.

0.5% progression on Kraken/json-stringify-tinderbox.

* runtime/JSONObject.cpp:
(JSC::Stringifier::Holder::appendNextProperty):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (184106 => 184107)


--- trunk/Source/_javascript_Core/ChangeLog	2015-05-11 17:38:51 UTC (rev 184106)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-05-11 17:47:55 UTC (rev 184107)
@@ -1,3 +1,18 @@
+2015-05-11  Andreas Kling  <[email protected]>
+
+        JSON.stringify shouldn't use generic get() to access Array.length
+        <https://webkit.org/b/144847>
+
+        Reviewed by Geoffrey Garen.
+
+        If the value being serialized is a JSArray object, we can downcast and call its
+        length() directly instead of doing a generic property lookup.
+
+        0.5% progression on Kraken/json-stringify-tinderbox.
+
+        * runtime/JSONObject.cpp:
+        (JSC::Stringifier::Holder::appendNextProperty):
+
 2015-05-10  Andreas Kling  <[email protected]>
 
         Remove unnecessary AtomicStringImpl* hash specification in PropertyNameArray.

Modified: trunk/Source/_javascript_Core/runtime/JSONObject.cpp (184106 => 184107)


--- trunk/Source/_javascript_Core/runtime/JSONObject.cpp	2015-05-11 17:38:51 UTC (rev 184106)
+++ trunk/Source/_javascript_Core/runtime/JSONObject.cpp	2015-05-11 17:47:55 UTC (rev 184107)
@@ -418,7 +418,10 @@
     if (!m_index) {
         if (m_isArray) {
             m_isJSArray = isJSArray(m_object.get());
-            m_size = m_object->get(exec, exec->vm().propertyNames->length).toUInt32(exec);
+            if (m_isJSArray)
+                m_size = asArray(m_object.get())->length();
+            else
+                m_size = m_object->get(exec, exec->vm().propertyNames->length).toUInt32(exec);
             builder.append('[');
         } else {
             if (stringifier.m_usingArrayReplacer)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to