Title: [209636] trunk/Source/_javascript_Core
Revision
209636
Author
cdu...@apple.com
Date
2016-12-09 15:37:00 -0800 (Fri, 09 Dec 2016)

Log Message

Inline JSCell::toObject()
https://bugs.webkit.org/show_bug.cgi?id=165679

Reviewed by Geoffrey Garen.

Inline JSCell::toObject() as it shows on Speedometer profiles.

* runtime/JSCell.cpp:
(JSC::JSCell::toObjectSlow):
(JSC::JSCell::toObject): Deleted.
* runtime/JSCell.h:
* runtime/JSCellInlines.h:
(JSC::JSCell::toObject):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (209635 => 209636)


--- trunk/Source/_javascript_Core/ChangeLog	2016-12-09 23:30:43 UTC (rev 209635)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-12-09 23:37:00 UTC (rev 209636)
@@ -1,3 +1,19 @@
+2016-12-09  Chris Dumez  <cdu...@apple.com>
+
+        Inline JSCell::toObject()
+        https://bugs.webkit.org/show_bug.cgi?id=165679
+
+        Reviewed by Geoffrey Garen.
+
+        Inline JSCell::toObject() as it shows on Speedometer profiles.
+
+        * runtime/JSCell.cpp:
+        (JSC::JSCell::toObjectSlow):
+        (JSC::JSCell::toObject): Deleted.
+        * runtime/JSCell.h:
+        * runtime/JSCellInlines.h:
+        (JSC::JSCell::toObject):
+
 2016-12-09  Geoffrey Garen  <gga...@apple.com>
 
         Deploy OrdinalNumber in JSC::SourceCode

Modified: trunk/Source/_javascript_Core/runtime/JSCell.cpp (209635 => 209636)


--- trunk/Source/_javascript_Core/runtime/JSCell.cpp	2016-12-09 23:30:43 UTC (rev 209635)
+++ trunk/Source/_javascript_Core/runtime/JSCell.cpp	2016-12-09 23:37:00 UTC (rev 209636)
@@ -169,14 +169,13 @@
     return static_cast<const JSObject*>(this)->toNumber(exec);
 }
 
-JSObject* JSCell::toObject(ExecState* exec, JSGlobalObject* globalObject) const
+JSObject* JSCell::toObjectSlow(ExecState* exec, JSGlobalObject* globalObject) const
 {
+    ASSERT(!isObject());
     if (isString())
         return static_cast<const JSString*>(this)->toObject(exec, globalObject);
-    if (isSymbol())
-        return static_cast<const Symbol*>(this)->toObject(exec, globalObject);
-    ASSERT(isObject());
-    return jsCast<JSObject*>(const_cast<JSCell*>(this));
+    ASSERT(isSymbol());
+    return static_cast<const Symbol*>(this)->toObject(exec, globalObject);
 }
 
 void slowValidateCell(JSCell* cell)

Modified: trunk/Source/_javascript_Core/runtime/JSCell.h (209635 => 209636)


--- trunk/Source/_javascript_Core/runtime/JSCell.h	2016-12-09 23:30:43 UTC (rev 209635)
+++ trunk/Source/_javascript_Core/runtime/JSCell.h	2016-12-09 23:37:00 UTC (rev 209636)
@@ -144,7 +144,7 @@
     bool toBoolean(ExecState*) const;
     TriState pureToBoolean() const;
     JS_EXPORT_PRIVATE double toNumber(ExecState*) const;
-    JS_EXPORT_PRIVATE JSObject* toObject(ExecState*, JSGlobalObject*) const;
+    JSObject* toObject(ExecState*, JSGlobalObject*) const;
 
     void dump(PrintStream&) const;
     JS_EXPORT_PRIVATE static void dumpToStream(const JSCell*, PrintStream&);
@@ -250,6 +250,8 @@
 private:
     friend class LLIntOffsetsExtractor;
 
+    JS_EXPORT_PRIVATE JSObject* toObjectSlow(ExecState*, JSGlobalObject*) const;
+
     StructureID m_structureID;
     IndexingType m_indexingTypeAndMisc; // DO NOT store to this field. Always CAS.
     JSType m_type;

Modified: trunk/Source/_javascript_Core/runtime/JSCellInlines.h (209635 => 209636)


--- trunk/Source/_javascript_Core/runtime/JSCellInlines.h	2016-12-09 23:30:43 UTC (rev 209635)
+++ trunk/Source/_javascript_Core/runtime/JSCellInlines.h	2016-12-09 23:37:00 UTC (rev 209636)
@@ -336,4 +336,11 @@
     return IndexingTypeLockAlgorithm::isLocked(*lock);
 }
 
+inline JSObject* JSCell::toObject(ExecState* exec, JSGlobalObject* globalObject) const
+{
+    if (isObject())
+        return jsCast<JSObject*>(const_cast<JSCell*>(this));
+    return toObjectSlow(exec, globalObject);
+}
+
 } // namespace JSC
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to