Changeset 180772 in webkit


Ignore:
Timestamp:
Feb 27, 2015 11:52:11 AM (9 years ago)
Author:
akling@apple.com
Message:

Use NeverDestroyed for JS wrapper owners.
<https://webkit.org/b/142090>

Reviewed by Chris Dumez.

Using NeverDestroyed puts these objects in BSS which is preferable
since that prevents them from pinning down entire malloc pages forever.

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateHeader): Use NeverDestroyed instead of DEPRECATED_DEFINE_STATIC_LOCAL.

  • bindings/scripts/test/JS/*: Rebaseline bindings tests for this change.
Location:
trunk/Source/WebCore
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r180771 r180772  
     12015-02-27  Andreas Kling  <akling@apple.com>
     2
     3        Use NeverDestroyed for JS wrapper owners.
     4        <https://webkit.org/b/142090>
     5
     6        Reviewed by Chris Dumez.
     7
     8        Using NeverDestroyed puts these objects in BSS which is preferable
     9        since that prevents them from pinning down entire malloc pages forever.
     10
     11        * bindings/scripts/CodeGeneratorJS.pm:
     12        (GenerateHeader): Use NeverDestroyed instead of DEPRECATED_DEFINE_STATIC_LOCAL.
     13
     14        * bindings/scripts/test/JS/*: Rebaseline bindings tests for this change.
     15
    1162015-02-27  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r180653 r180772  
    11561156            push(@headerContent, "class JS${interfaceName}Owner : public JSC::WeakHandleOwner {\n");
    11571157        }
     1158        $headerIncludes{"<wtf/NeverDestroyed.h>"} = 1;
    11581159        push(@headerContent, "public:\n");
    11591160        push(@headerContent, "    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);\n");
     
    11631164        push(@headerContent, "inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, $implType*)\n");
    11641165        push(@headerContent, "{\n");
    1165         push(@headerContent, "    DEPRECATED_DEFINE_STATIC_LOCAL(JS${interfaceName}Owner, js${interfaceName}Owner, ());\n");
    1166         push(@headerContent, "    return &js${interfaceName}Owner;\n");
     1166        push(@headerContent, "    static NeverDestroyed<JS${interfaceName}Owner> owner;\n");
     1167        push(@headerContent, "    return &owner.get();\n");
    11671168        push(@headerContent, "}\n");
    11681169        push(@headerContent, "\n");
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.h

    r180301 r180772  
    2424#include "JSDOMWrapper.h"
    2525#include "TestActiveDOMObject.h"
     26#include <wtf/NeverDestroyed.h>
    2627
    2728namespace WebCore {
     
    8586inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestActiveDOMObject*)
    8687{
    87     DEPRECATED_DEFINE_STATIC_LOCAL(JSTestActiveDOMObjectOwner, jsTestActiveDOMObjectOwner, ());
    88     return &jsTestActiveDOMObjectOwner;
     88    static NeverDestroyed<JSTestActiveDOMObjectOwner> owner;
     89    return &owner.get();
    8990}
    9091
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.h

    r180301 r180772  
    2424#include "JSDOMWrapper.h"
    2525#include "TestCustomNamedGetter.h"
     26#include <wtf/NeverDestroyed.h>
    2627
    2728namespace WebCore {
     
    8990inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestCustomNamedGetter*)
    9091{
    91     DEPRECATED_DEFINE_STATIC_LOCAL(JSTestCustomNamedGetterOwner, jsTestCustomNamedGetterOwner, ());
    92     return &jsTestCustomNamedGetterOwner;
     92    static NeverDestroyed<JSTestCustomNamedGetterOwner> owner;
     93    return &owner.get();
    9394}
    9495
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.h

    r180301 r180772  
    2424#include "JSDOMWrapper.h"
    2525#include "TestEventConstructor.h"
     26#include <wtf/NeverDestroyed.h>
    2627
    2728namespace WebCore {
     
    8586inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestEventConstructor*)
    8687{
    87     DEPRECATED_DEFINE_STATIC_LOCAL(JSTestEventConstructorOwner, jsTestEventConstructorOwner, ());
    88     return &jsTestEventConstructorOwner;
     88    static NeverDestroyed<JSTestEventConstructorOwner> owner;
     89    return &owner.get();
    8990}
    9091
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h

    r180301 r180772  
    2424#include "JSDOMWrapper.h"
    2525#include "TestEventTarget.h"
     26#include <wtf/NeverDestroyed.h>
    2627
    2728namespace WebCore {
     
    9394inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestEventTarget*)
    9495{
    95     DEPRECATED_DEFINE_STATIC_LOCAL(JSTestEventTargetOwner, jsTestEventTargetOwner, ());
    96     return &jsTestEventTargetOwner;
     96    static NeverDestroyed<JSTestEventTargetOwner> owner;
     97    return &owner.get();
    9798}
    9899
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.h

    r180301 r180772  
    2525#include "TestException.h"
    2626#include <runtime/ErrorPrototype.h>
     27#include <wtf/NeverDestroyed.h>
    2728
    2829namespace WebCore {
     
    8687inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestException*)
    8788{
    88     DEPRECATED_DEFINE_STATIC_LOCAL(JSTestExceptionOwner, jsTestExceptionOwner, ());
    89     return &jsTestExceptionOwner;
     89    static NeverDestroyed<JSTestExceptionOwner> owner;
     90    return &owner.get();
    9091}
    9192
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.h

    r180301 r180772  
    2424#include "JSDOMWrapper.h"
    2525#include "TestGenerateIsReachable.h"
     26#include <wtf/NeverDestroyed.h>
    2627
    2728namespace WebCore {
     
    8384inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestGenerateIsReachable*)
    8485{
    85     DEPRECATED_DEFINE_STATIC_LOCAL(JSTestGenerateIsReachableOwner, jsTestGenerateIsReachableOwner, ());
    86     return &jsTestGenerateIsReachableOwner;
     86    static NeverDestroyed<JSTestGenerateIsReachableOwner> owner;
     87    return &owner.get();
    8788}
    8889
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h

    r180301 r180772  
    2626#include "JSDOMWrapper.h"
    2727#include "TestInterface.h"
     28#include <wtf/NeverDestroyed.h>
    2829
    2930namespace WebCore {
     
    112113inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestInterface*)
    113114{
    114     DEPRECATED_DEFINE_STATIC_LOCAL(JSTestInterfaceOwner, jsTestInterfaceOwner, ());
    115     return &jsTestInterfaceOwner;
     115    static NeverDestroyed<JSTestInterfaceOwner> owner;
     116    return &owner.get();
    116117}
    117118
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.h

    r180301 r180772  
    2424#include "JSDOMWrapper.h"
    2525#include "TestMediaQueryListListener.h"
     26#include <wtf/NeverDestroyed.h>
    2627
    2728namespace WebCore {
     
    8384inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestMediaQueryListListener*)
    8485{
    85     DEPRECATED_DEFINE_STATIC_LOCAL(JSTestMediaQueryListListenerOwner, jsTestMediaQueryListListenerOwner, ());
    86     return &jsTestMediaQueryListListenerOwner;
     86    static NeverDestroyed<JSTestMediaQueryListListenerOwner> owner;
     87    return &owner.get();
    8788}
    8889
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.h

    r180301 r180772  
    2424#include "JSDOMWrapper.h"
    2525#include "TestNamedConstructor.h"
     26#include <wtf/NeverDestroyed.h>
    2627
    2728namespace WebCore {
     
    8485inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestNamedConstructor*)
    8586{
    86     DEPRECATED_DEFINE_STATIC_LOCAL(JSTestNamedConstructorOwner, jsTestNamedConstructorOwner, ());
    87     return &jsTestNamedConstructorOwner;
     87    static NeverDestroyed<JSTestNamedConstructorOwner> owner;
     88    return &owner.get();
    8889}
    8990
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.h

    r180301 r180772  
    2424#include "JSDOMWrapper.h"
    2525#include "TestNondeterministic.h"
     26#include <wtf/NeverDestroyed.h>
    2627
    2728namespace WebCore {
     
    8384inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestNondeterministic*)
    8485{
    85     DEPRECATED_DEFINE_STATIC_LOCAL(JSTestNondeterministicOwner, jsTestNondeterministicOwner, ());
    86     return &jsTestNondeterministicOwner;
     86    static NeverDestroyed<JSTestNondeterministicOwner> owner;
     87    return &owner.get();
    8788}
    8889
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h

    r180301 r180772  
    2424#include "JSDOMWrapper.h"
    2525#include "TestObj.h"
     26#include <wtf/NeverDestroyed.h>
    2627
    2728namespace WebCore {
     
    9899inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestObj*)
    99100{
    100     DEPRECATED_DEFINE_STATIC_LOCAL(JSTestObjOwner, jsTestObjOwner, ());
    101     return &jsTestObjOwner;
     101    static NeverDestroyed<JSTestObjOwner> owner;
     102    return &owner.get();
    102103}
    103104
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.h

    r180301 r180772  
    2424#include "JSDOMWrapper.h"
    2525#include "TestOverloadedConstructors.h"
     26#include <wtf/NeverDestroyed.h>
    2627
    2728namespace WebCore {
     
    8384inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestOverloadedConstructors*)
    8485{
    85     DEPRECATED_DEFINE_STATIC_LOCAL(JSTestOverloadedConstructorsOwner, jsTestOverloadedConstructorsOwner, ());
    86     return &jsTestOverloadedConstructorsOwner;
     86    static NeverDestroyed<JSTestOverloadedConstructorsOwner> owner;
     87    return &owner.get();
    8788}
    8889
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h

    r180301 r180772  
    2626#include "JSDOMWrapper.h"
    2727#include "TestSerializedScriptValueInterface.h"
     28#include <wtf/NeverDestroyed.h>
    2829
    2930namespace WebCore {
     
    8990inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestSerializedScriptValueInterface*)
    9091{
    91     DEPRECATED_DEFINE_STATIC_LOCAL(JSTestSerializedScriptValueInterfaceOwner, jsTestSerializedScriptValueInterfaceOwner, ());
    92     return &jsTestSerializedScriptValueInterfaceOwner;
     92    static NeverDestroyed<JSTestSerializedScriptValueInterfaceOwner> owner;
     93    return &owner.get();
    9394}
    9495
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.h

    r180301 r180772  
    2424#include "JSDOMWrapper.h"
    2525#include "TestTypedefs.h"
     26#include <wtf/NeverDestroyed.h>
    2627
    2728namespace WebCore {
     
    8586inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestTypedefs*)
    8687{
    87     DEPRECATED_DEFINE_STATIC_LOCAL(JSTestTypedefsOwner, jsTestTypedefsOwner, ());
    88     return &jsTestTypedefsOwner;
     88    static NeverDestroyed<JSTestTypedefsOwner> owner;
     89    return &owner.get();
    8990}
    9091
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.h

    r180301 r180772  
    2525#include "attribute.h"
    2626#include <runtime/ErrorPrototype.h>
     27#include <wtf/NeverDestroyed.h>
    2728
    2829namespace WebCore {
     
    8485inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, attribute*)
    8586{
    86     DEPRECATED_DEFINE_STATIC_LOCAL(JSattributeOwner, jsattributeOwner, ());
    87     return &jsattributeOwner;
     87    static NeverDestroyed<JSattributeOwner> owner;
     88    return &owner.get();
    8889}
    8990
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSreadonly.h

    r180301 r180772  
    2424#include "JSDOMWrapper.h"
    2525#include "readonly.h"
     26#include <wtf/NeverDestroyed.h>
    2627
    2728namespace WebCore {
     
    8384inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, readonly*)
    8485{
    85     DEPRECATED_DEFINE_STATIC_LOCAL(JSreadonlyOwner, jsreadonlyOwner, ());
    86     return &jsreadonlyOwner;
     86    static NeverDestroyed<JSreadonlyOwner> owner;
     87    return &owner.get();
    8788}
    8889
Note: See TracChangeset for help on using the changeset viewer.