Title: [205933] trunk/Source
Revision
205933
Author
[email protected]
Date
2016-09-14 15:32:58 -0700 (Wed, 14 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 Geoffrey Garen.

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.h:
* 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/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 (205932 => 205933)


--- trunk/Source/_javascript_Core/API/JSCallbackObject.h	2016-09-14 22:27:19 UTC (rev 205932)
+++ trunk/Source/_javascript_Core/API/JSCallbackObject.h	2016-09-14 22:32:58 UTC (rev 205933)
@@ -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 (205932 => 205933)


--- trunk/Source/_javascript_Core/ChangeLog	2016-09-14 22:27:19 UTC (rev 205932)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-09-14 22:32:58 UTC (rev 205933)
@@ -1,3 +1,43 @@
+2016-09-14  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 Geoffrey Garen.
+
+        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.h:
+        * 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  Joseph Pecoraro  <[email protected]>
 
         test262: TypedArray constructors length should be 3 and configurable

Modified: trunk/Source/_javascript_Core/b3/B3ValueInlines.h (205932 => 205933)


--- trunk/Source/_javascript_Core/b3/B3ValueInlines.h	2016-09-14 22:27:19 UTC (rev 205932)
+++ trunk/Source/_javascript_Core/b3/B3ValueInlines.h	2016-09-14 22:32:58 UTC (rev 205933)
@@ -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.h (205932 => 205933)


--- trunk/Source/_javascript_Core/runtime/HashMapImpl.h	2016-09-14 22:27:19 UTC (rev 205932)
+++ trunk/Source/_javascript_Core/runtime/HashMapImpl.h	2016-09-14 22:32:58 UTC (rev 205933)
@@ -56,8 +56,21 @@
     }
 
 public:
-    DECLARE_EXPORT_INFO;
 
+    // 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& vm, JSGlobalObject* globalObject, JSValue prototype)
     {
         return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info());
@@ -265,7 +278,19 @@
     }
 
 public:
-    DECLARE_EXPORT_INFO;
+    // 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& vm, JSGlobalObject* globalObject, JSValue prototype)
     {

Modified: trunk/Source/_javascript_Core/runtime/JSCJSValue.h (205932 => 205933)


--- trunk/Source/_javascript_Core/runtime/JSCJSValue.h	2016-09-14 22:27:19 UTC (rev 205932)
+++ trunk/Source/_javascript_Core/runtime/JSCJSValue.h	2016-09-14 22:32:58 UTC (rev 205933)
@@ -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 (205932 => 205933)


--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayView.h	2016-09-14 22:27:19 UTC (rev 205932)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayView.h	2016-09-14 22:32:58 UTC (rev 205933)
@@ -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 (205932 => 205933)


--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewConstructor.h	2016-09-14 22:27:19 UTC (rev 205932)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewConstructor.h	2016-09-14 22:32:58 UTC (rev 205933)
@@ -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 (205932 => 205933)


--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewPrototype.h	2016-09-14 22:27:19 UTC (rev 205932)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewPrototype.h	2016-09-14 22:32:58 UTC (rev 205933)
@@ -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 (205932 => 205933)


--- trunk/Source/_javascript_Core/runtime/MathCommon.h	2016-09-14 22:27:19 UTC (rev 205932)
+++ trunk/Source/_javascript_Core/runtime/MathCommon.h	2016-09-14 22:32:58 UTC (rev 205933)
@@ -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 (205932 => 205933)


--- trunk/Source/_javascript_Core/runtime/TypedArrayAdaptors.h	2016-09-14 22:27:19 UTC (rev 205932)
+++ trunk/Source/_javascript_Core/runtime/TypedArrayAdaptors.h	2016-09-14 22:32:58 UTC (rev 205933)
@@ -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 (205932 => 205933)


--- trunk/Source/_javascript_Core/runtime/VM.h	2016-09-14 22:27:19 UTC (rev 205932)
+++ trunk/Source/_javascript_Core/runtime/VM.h	2016-09-14 22:32:58 UTC (rev 205933)
@@ -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 (205932 => 205933)


--- trunk/Source/WTF/ChangeLog	2016-09-14 22:27:19 UTC (rev 205932)
+++ trunk/Source/WTF/ChangeLog	2016-09-14 22:32:58 UTC (rev 205933)
@@ -1,3 +1,16 @@
+2016-09-14  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 Geoffrey Garen.
+
+        Fix WTF_EXPORT_PRIVATE for an inline member function. This would
+        generate a weak export.
+
+        * wtf/MetaAllocator.h:
+        (WTF::MetaAllocator::getLock):
+
 2016-09-14  JF Bastien  <[email protected]>
 
         Atomics on ARM don't require full-system fencing, and other minutiae

Modified: trunk/Source/WTF/wtf/MetaAllocator.h (205932 => 205933)


--- trunk/Source/WTF/wtf/MetaAllocator.h	2016-09-14 22:27:19 UTC (rev 205932)
+++ trunk/Source/WTF/wtf/MetaAllocator.h	2016-09-14 22:32:58 UTC (rev 205933)
@@ -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)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to