Title: [205989] trunk/Source
Revision
205989
Author
[email protected]
Date
2016-09-15 11:35:51 -0700 (Thu, 15 Sep 2016)

Log Message

Pragma out undefined-var-template warnings in JSC for JSObjects that are templatized
https://bugs.webkit.org/show_bug.cgi?id=161985

Reviewed by Alex Christensen.

Source/_javascript_Core:

I started a true fix for this in
https://bugs.webkit.org/show_bug.cgi?id=161979, however the fix
for this issue is not sustainable. Since the scope of this issue
is just limited to the static const ClassInfo member it is
simpler to just pragma out this warning. This works because
COMDAT will, AFAIK, pick the actual specialization.  If, in the
future, we want to expose these classes to WebCore we will need to
do what we do for JSGenericTypedArrayViews and create a custom
info() function with a switch.

This patch also fixes a bunch of weak external symbols due to one of:
1) out of line template member definitions functions not being marked inline.
2) inline member functions definitions being marked as exported.
3) missing header file includes for forward function declarations.

* API/JSCallbackObject.h:
* b3/B3ValueInlines.h:
(JSC::B3::Value::as):
* runtime/HashMapImpl.cpp:
(JSC::getHashMapBucketKeyClassInfo):
(JSC::getHashMapBucketKeyValueClassInfo):
(JSC::getHashMapImplKeyClassInfo):
(JSC::getHashMapImplKeyValueClassInfo):
* runtime/HashMapImpl.h:
(JSC::HashMapBucket::info):
(JSC::HashMapImpl::info):
* runtime/JSCJSValue.h:
(JSC::toUInt32): Deleted.
* runtime/JSGenericTypedArrayView.h:
(JSC::JSGenericTypedArrayView::setIndexQuicklyToDouble):
* runtime/JSGenericTypedArrayViewConstructor.h:
* runtime/JSGenericTypedArrayViewPrototype.h:
* runtime/MathCommon.h:
(JSC::toUInt32):
* runtime/TypedArrayAdaptors.h:
* runtime/VM.h:
(JSC::VM::watchdog):
(JSC::VM::heapProfiler):
(JSC::VM::samplingProfiler):

Source/WebCore:

Delete unneeded using, which broke the build on newer versions of clang.

* bridge/objc/WebScriptObject.mm:

Source/WTF:

Fix WTF_EXPORT_PRIVATE for an inline member function. This would
generate a weak export.

* wtf/MetaAllocator.h:
(WTF::MetaAllocator::getLock):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSCallbackObject.h (205988 => 205989)


--- trunk/Source/_javascript_Core/API/JSCallbackObject.h	2016-09-15 18:20:33 UTC (rev 205988)
+++ trunk/Source/_javascript_Core/API/JSCallbackObject.h	2016-09-15 18:35:51 UTC (rev 205989)
@@ -149,7 +149,19 @@
     void setPrivate(void* data);
     void* getPrivate();
 
+    // FIXME: We should fix the warnings for extern-template in JSObject template classes: https://bugs.webkit.org/show_bug.cgi?id=161979
+#if COMPILER(CLANG)
+#if __has_warning("-Wundefined-var-template")
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wundefined-var-template"
+#endif
+#endif
     DECLARE_INFO;
+#if COMPILER(CLANG)
+#if __has_warning("-Wundefined-var-template")
+#pragma clang diagnostic pop
+#endif
+#endif
 
     JSClassRef classRef() const { return m_callbackObjectData->jsClass; }
     bool inherits(JSClassRef) const;

Modified: trunk/Source/_javascript_Core/ChangeLog (205988 => 205989)


--- trunk/Source/_javascript_Core/ChangeLog	2016-09-15 18:20:33 UTC (rev 205988)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-09-15 18:35:51 UTC (rev 205989)
@@ -1,3 +1,51 @@
+2016-09-15  Keith Miller  <[email protected]>
+
+
+        Pragma out undefined-var-template warnings in JSC for JSObjects that are templatized
+        https://bugs.webkit.org/show_bug.cgi?id=161985
+
+        Reviewed by Alex Christensen.
+
+        I started a true fix for this in
+        https://bugs.webkit.org/show_bug.cgi?id=161979, however the fix
+        for this issue is not sustainable. Since the scope of this issue
+        is just limited to the static const ClassInfo member it is
+        simpler to just pragma out this warning. This works because
+        COMDAT will, AFAIK, pick the actual specialization.  If, in the
+        future, we want to expose these classes to WebCore we will need to
+        do what we do for JSGenericTypedArrayViews and create a custom
+        info() function with a switch.
+
+        This patch also fixes a bunch of weak external symbols due to one of:
+        1) out of line template member definitions functions not being marked inline.
+        2) inline member functions definitions being marked as exported.
+        3) missing header file includes for forward function declarations.
+
+        * API/JSCallbackObject.h:
+        * b3/B3ValueInlines.h:
+        (JSC::B3::Value::as):
+        * runtime/HashMapImpl.cpp:
+        (JSC::getHashMapBucketKeyClassInfo):
+        (JSC::getHashMapBucketKeyValueClassInfo):
+        (JSC::getHashMapImplKeyClassInfo):
+        (JSC::getHashMapImplKeyValueClassInfo):
+        * runtime/HashMapImpl.h:
+        (JSC::HashMapBucket::info):
+        (JSC::HashMapImpl::info):
+        * runtime/JSCJSValue.h:
+        (JSC::toUInt32): Deleted.
+        * runtime/JSGenericTypedArrayView.h:
+        (JSC::JSGenericTypedArrayView::setIndexQuicklyToDouble):
+        * runtime/JSGenericTypedArrayViewConstructor.h:
+        * runtime/JSGenericTypedArrayViewPrototype.h:
+        * runtime/MathCommon.h:
+        (JSC::toUInt32):
+        * runtime/TypedArrayAdaptors.h:
+        * runtime/VM.h:
+        (JSC::VM::watchdog):
+        (JSC::VM::heapProfiler):
+        (JSC::VM::samplingProfiler):
+
 2016-09-14  Filip Pizlo  <[email protected]>
 
         There is no good reason for WeakBlock to care about newly allocated objects

Modified: trunk/Source/_javascript_Core/b3/B3ValueInlines.h (205988 => 205989)


--- trunk/Source/_javascript_Core/b3/B3ValueInlines.h	2016-09-15 18:20:33 UTC (rev 205988)
+++ trunk/Source/_javascript_Core/b3/B3ValueInlines.h	2016-09-15 18:35:51 UTC (rev 205989)
@@ -56,7 +56,7 @@
 }
 
 template<typename T>
-T* Value::as()
+inline T* Value::as()
 {
     if (T::accepts(opcode()))
         return static_cast<T*>(this);
@@ -64,7 +64,7 @@
 }
 
 template<typename T>
-const T* Value::as() const
+inline const T* Value::as() const
 {
     return const_cast<Value*>(this)->as<T>();
 }

Modified: trunk/Source/_javascript_Core/runtime/HashMapImpl.cpp (205988 => 205989)


--- trunk/Source/_javascript_Core/runtime/HashMapImpl.cpp	2016-09-15 18:20:33 UTC (rev 205988)
+++ trunk/Source/_javascript_Core/runtime/HashMapImpl.cpp	2016-09-15 18:35:51 UTC (rev 205989)
@@ -31,11 +31,11 @@
 namespace JSC {
 
 template<>
-const JS_EXPORTDATA ClassInfo HashMapBucket<HashMapBucketDataKey>::s_info =
+const ClassInfo HashMapBucket<HashMapBucketDataKey>::s_info =
     { "HashMapBucket", nullptr, 0, CREATE_METHOD_TABLE(HashMapBucket<HashMapBucketDataKey>) };
 
 template<>
-const JS_EXPORTDATA ClassInfo HashMapBucket<HashMapBucketDataKeyValue>::s_info =
+const ClassInfo HashMapBucket<HashMapBucketDataKeyValue>::s_info =
     { "HashMapBucket", nullptr, 0, CREATE_METHOD_TABLE(HashMapBucket<HashMapBucketDataKeyValue>) };
 
 template <typename Data>
@@ -53,11 +53,11 @@
 }
 
 template<>
-const JS_EXPORTDATA ClassInfo HashMapImpl<HashMapBucket<HashMapBucketDataKey>>::s_info =
+const ClassInfo HashMapImpl<HashMapBucket<HashMapBucketDataKey>>::s_info =
     { "HashMapImpl", nullptr, 0, CREATE_METHOD_TABLE(HashMapImpl<HashMapBucket<HashMapBucketDataKey>>) };
 
 template<>
-const JS_EXPORTDATA ClassInfo HashMapImpl<HashMapBucket<HashMapBucketDataKeyValue>>::s_info =
+const ClassInfo HashMapImpl<HashMapBucket<HashMapBucketDataKeyValue>>::s_info =
     { "HashMapImpl", nullptr, 0, CREATE_METHOD_TABLE(HashMapImpl<HashMapBucket<HashMapBucketDataKeyValue>>) };
 
 template <typename HashMapBucket>
@@ -74,4 +74,21 @@
         visitor.markAuxiliary(thisObject->m_buffer.get());
 }
 
+const ClassInfo* getHashMapBucketKeyClassInfo()
+{
+    return &HashMapBucket<HashMapBucketDataKey>::s_info;
+}
+const ClassInfo* getHashMapBucketKeyValueClassInfo()
+{
+    return &HashMapBucket<HashMapBucketDataKeyValue>::s_info;
+}
+const ClassInfo* getHashMapImplKeyClassInfo()
+{
+    return &HashMapImpl<HashMapBucket<HashMapBucketDataKey>>::s_info;
+}
+const ClassInfo* getHashMapImplKeyValueClassInfo()
+{
+    return &HashMapImpl<HashMapBucket<HashMapBucketDataKeyValue>>::s_info;
+}
+
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/HashMapImpl.h (205988 => 205989)


--- trunk/Source/_javascript_Core/runtime/HashMapImpl.h	2016-09-15 18:20:33 UTC (rev 205988)
+++ trunk/Source/_javascript_Core/runtime/HashMapImpl.h	2016-09-15 18:35:51 UTC (rev 205989)
@@ -30,11 +30,23 @@
 
 namespace JSC {
 
+JS_EXPORT_PRIVATE const ClassInfo* getHashMapBucketKeyClassInfo();
+JS_EXPORT_PRIVATE const ClassInfo* getHashMapBucketKeyValueClassInfo();
+JS_EXPORT_PRIVATE const ClassInfo* getHashMapImplKeyClassInfo();
+JS_EXPORT_PRIVATE const ClassInfo* getHashMapImplKeyValueClassInfo();
+
+enum class HashTableType {
+    Key,
+    KeyValue
+};
+
 struct HashMapBucketDataKey {
+    static const HashTableType Type = HashTableType::Key;
     WriteBarrier<Unknown> key;
 };
 
 struct HashMapBucketDataKeyValue {
+    static const HashTableType Type = HashTableType::KeyValue;
     WriteBarrier<Unknown> key;
     WriteBarrier<Unknown> value;
 };
@@ -56,8 +68,20 @@
     }
 
 public:
-    DECLARE_EXPORT_INFO;
+    static const HashTableType Type = Data::Type;
+    static const ClassInfo s_info; // This is never accessed directly, since that would break linkage on some compilers.
 
+    static const ClassInfo* info()
+    {
+        switch (Type) {
+        case HashTableType::Key:
+            return getHashMapBucketKeyClassInfo();
+        case HashTableType::KeyValue:
+            return getHashMapBucketKeyValueClassInfo();
+        }
+        RELEASE_ASSERT_NOT_REACHED();
+    }
+
     static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
     {
         return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info());
@@ -265,8 +289,19 @@
     }
 
 public:
-    DECLARE_EXPORT_INFO;
+    static const ClassInfo s_info; // This is never accessed directly, since that would break linkage on some compilers.
 
+    static const ClassInfo* info()
+    {
+        switch (HashMapBucketType::Type) {
+        case HashTableType::Key:
+            return getHashMapImplKeyClassInfo();
+        case HashTableType::KeyValue:
+            return getHashMapImplKeyValueClassInfo();
+        }
+        RELEASE_ASSERT_NOT_REACHED();
+    }
+
     static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
     {
         return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info());

Modified: trunk/Source/_javascript_Core/runtime/JSCJSValue.h (205988 => 205989)


--- trunk/Source/_javascript_Core/runtime/JSCJSValue.h	2016-09-15 18:20:33 UTC (rev 205988)
+++ trunk/Source/_javascript_Core/runtime/JSCJSValue.h	2016-09-15 18:35:51 UTC (rev 205989)
@@ -118,17 +118,6 @@
     PayloadWord
 };
 
-// This implements ToInt32, defined in ECMA-262 9.5.
-JS_EXPORT_PRIVATE int32_t toInt32(double);
-
-// This implements ToUInt32, defined in ECMA-262 9.6.
-inline uint32_t toUInt32(double number)
-{
-    // As commented in the spec, the operation of ToInt32 and ToUint32 only differ
-    // in how the result is interpreted; see NOTEs in sections 9.5 and 9.6.
-    return toInt32(number);
-}
-
 int64_t tryConvertToInt52(double);
 bool isInt52(double);
 

Modified: trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayView.h (205988 => 205989)


--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayView.h	2016-09-15 18:20:33 UTC (rev 205988)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayView.h	2016-09-15 18:35:51 UTC (rev 205989)
@@ -159,7 +159,7 @@
     
     void setIndexQuicklyToDouble(unsigned i, double value)
     {
-        setIndexQuicklyToNativeValue(i, toNativeFromValue<Adaptor>(value));
+        setIndexQuicklyToNativeValue(i, toNativeFromValue<Adaptor>(jsNumber(value)));
     }
     
     void setIndexQuickly(unsigned i, JSValue value)

Modified: trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewConstructor.h (205988 => 205989)


--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewConstructor.h	2016-09-15 18:20:33 UTC (rev 205988)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewConstructor.h	2016-09-15 18:35:51 UTC (rev 205989)
@@ -43,7 +43,19 @@
     static JSGenericTypedArrayViewConstructor* create(
         VM&, JSGlobalObject*, Structure*, JSObject* prototype, const String& name, FunctionExecutable* privateAllocator);
 
+    // FIXME: We should fix the warnings for extern-template in JSObject template classes: https://bugs.webkit.org/show_bug.cgi?id=161979
+#if COMPILER(CLANG)
+#if __has_warning("-Wundefined-var-template")
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wundefined-var-template"
+#endif
+#endif
     DECLARE_INFO;
+#if COMPILER(CLANG)
+#if __has_warning("-Wundefined-var-template")
+#pragma clang diagnostic pop
+#endif
+#endif
     
     static Structure* createStructure(VM&, JSGlobalObject*, JSValue prototype);
 

Modified: trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewPrototype.h (205988 => 205989)


--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewPrototype.h	2016-09-15 18:20:33 UTC (rev 205988)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewPrototype.h	2016-09-15 18:35:51 UTC (rev 205989)
@@ -42,8 +42,20 @@
 public:
     static JSGenericTypedArrayViewPrototype* create(
         VM&, JSGlobalObject*, Structure*);
-    
+
+    // FIXME: We should fix the warnings for extern-template in JSObject template classes: https://bugs.webkit.org/show_bug.cgi?id=161979
+#if COMPILER(CLANG)
+#if __has_warning("-Wundefined-var-template")
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wundefined-var-template"
+#endif
+#endif
     DECLARE_INFO;
+#if COMPILER(CLANG)
+#if __has_warning("-Wundefined-var-template")
+#pragma clang diagnostic pop
+#endif
+#endif
     
     static Structure* createStructure(VM&, JSGlobalObject*, JSValue prototype);
 };

Modified: trunk/Source/_javascript_Core/runtime/MathCommon.h (205988 => 205989)


--- trunk/Source/_javascript_Core/runtime/MathCommon.h	2016-09-15 18:20:33 UTC (rev 205988)
+++ trunk/Source/_javascript_Core/runtime/MathCommon.h	2016-09-15 18:35:51 UTC (rev 205989)
@@ -111,6 +111,14 @@
     return bits < 0 ? -result : result;
 }
 
+// This implements ToUInt32, defined in ECMA-262 9.6.
+inline uint32_t toUInt32(double number)
+{
+    // As commented in the spec, the operation of ToInt32 and ToUint32 only differ
+    // in how the result is interpreted; see NOTEs in sections 9.5 and 9.6.
+    return toInt32(number);
+}
+
 inline Optional<double> safeReciprocalForDivByConst(double constant)
 {
     // No "weird" numbers (NaN, Denormal, etc).

Modified: trunk/Source/_javascript_Core/runtime/TypedArrayAdaptors.h (205988 => 205989)


--- trunk/Source/_javascript_Core/runtime/TypedArrayAdaptors.h	2016-09-15 18:20:33 UTC (rev 205988)
+++ trunk/Source/_javascript_Core/runtime/TypedArrayAdaptors.h	2016-09-15 18:35:51 UTC (rev 205989)
@@ -27,6 +27,7 @@
 #define TypedArrayAdaptors_h
 
 #include "JSCJSValue.h"
+#include "MathCommon.h"
 #include "TypedArrayType.h"
 #include <wtf/MathExtras.h>
 

Modified: trunk/Source/_javascript_Core/runtime/VM.h (205988 => 205989)


--- trunk/Source/_javascript_Core/runtime/VM.h	2016-09-15 18:20:33 UTC (rev 205988)
+++ trunk/Source/_javascript_Core/runtime/VM.h	2016-09-15 18:35:51 UTC (rev 205989)
@@ -252,13 +252,13 @@
     JS_EXPORT_PRIVATE ~VM();
 
     JS_EXPORT_PRIVATE Watchdog& ensureWatchdog();
-    JS_EXPORT_PRIVATE Watchdog* watchdog() { return m_watchdog.get(); }
+    Watchdog* watchdog() { return m_watchdog.get(); }
 
-    JS_EXPORT_PRIVATE HeapProfiler* heapProfiler() const { return m_heapProfiler.get(); }
+    HeapProfiler* heapProfiler() const { return m_heapProfiler.get(); }
     JS_EXPORT_PRIVATE HeapProfiler& ensureHeapProfiler();
 
 #if ENABLE(SAMPLING_PROFILER)
-    JS_EXPORT_PRIVATE SamplingProfiler* samplingProfiler() { return m_samplingProfiler.get(); }
+    SamplingProfiler* samplingProfiler() { return m_samplingProfiler.get(); }
     JS_EXPORT_PRIVATE SamplingProfiler& ensureSamplingProfiler(RefPtr<Stopwatch>&&);
 #endif
 

Modified: trunk/Source/WTF/ChangeLog (205988 => 205989)


--- trunk/Source/WTF/ChangeLog	2016-09-15 18:20:33 UTC (rev 205988)
+++ trunk/Source/WTF/ChangeLog	2016-09-15 18:35:51 UTC (rev 205989)
@@ -1,3 +1,16 @@
+2016-09-15  Keith Miller  <[email protected]>
+
+        Pragma out undefined-var-template warnings in JSC for JSObjects that are templatized
+        https://bugs.webkit.org/show_bug.cgi?id=161985
+
+        Reviewed by Alex Christensen.
+
+        Fix WTF_EXPORT_PRIVATE for an inline member function. This would
+        generate a weak export.
+
+        * wtf/MetaAllocator.h:
+        (WTF::MetaAllocator::getLock):
+
 2016-09-14  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r205933 and r205936.

Modified: trunk/Source/WTF/wtf/MetaAllocator.h (205988 => 205989)


--- trunk/Source/WTF/wtf/MetaAllocator.h	2016-09-15 18:20:33 UTC (rev 205988)
+++ trunk/Source/WTF/wtf/MetaAllocator.h	2016-09-15 18:35:51 UTC (rev 205989)
@@ -97,7 +97,7 @@
     // builds.
     WTF_EXPORT_PRIVATE size_t debugFreeSpaceSize();
 
-    WTF_EXPORT_PRIVATE Lock& getLock() { return m_lock; }
+    Lock& getLock() { return m_lock; }
     WTF_EXPORT_PRIVATE bool isInAllocatedMemory(const LockHolder&, void* address);
     
 #if ENABLE(META_ALLOCATOR_PROFILE)

Modified: trunk/Source/WebCore/ChangeLog (205988 => 205989)


--- trunk/Source/WebCore/ChangeLog	2016-09-15 18:20:33 UTC (rev 205988)
+++ trunk/Source/WebCore/ChangeLog	2016-09-15 18:35:51 UTC (rev 205989)
@@ -1,3 +1,14 @@
+2016-09-15  Keith Miller  <[email protected]>
+
+        Pragma out undefined-var-template warnings in JSC for JSObjects that are templatized
+        https://bugs.webkit.org/show_bug.cgi?id=161985
+
+        Reviewed by Alex Christensen.
+
+        Delete unneeded using, which broke the build on newer versions of clang.
+
+        * bridge/objc/WebScriptObject.mm:
+
 2016-09-15  Alex Christensen  <[email protected]>
 
         URLParser: Check for invalid characters in the host

Modified: trunk/Source/WebCore/bridge/objc/WebScriptObject.mm (205988 => 205989)


--- trunk/Source/WebCore/bridge/objc/WebScriptObject.mm	2016-09-15 18:20:33 UTC (rev 205988)
+++ trunk/Source/WebCore/bridge/objc/WebScriptObject.mm	2016-09-15 18:35:51 UTC (rev 205989)
@@ -58,7 +58,6 @@
 
 using JSC::CallData;
 using JSC::CallType;
-using JSC::CallType::None;
 using JSC::ExecState;
 using JSC::Identifier;
 using JSC::JSLockHolder;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to