Changeset 57120 in webkit


Ignore:
Timestamp:
Apr 5, 2010 9:18:18 PM (14 years ago)
Author:
oliver@apple.com
Message:

2010-04-05 Oliver Hunt <oliver@apple.com>

Reviewed by Gavin Barraclough.

Support weak maps in JSC
https://bugs.webkit.org/show_bug.cgi?id=37132

Expose an API to allow creation of a map for storing
weak JS references.

  • API/JSWeakObjectMapRefInternal.h: Added. (OpaqueJSWeakObjectMap::create): (OpaqueJSWeakObjectMap::map): (OpaqueJSWeakObjectMap::~OpaqueJSWeakObjectMap): (OpaqueJSWeakObjectMap::OpaqueJSWeakObjectMap):
  • API/JSWeakObjectMapRefPrivate.cpp: Added.
  • API/JSWeakObjectMapRefPrivate.h: Added.
  • JavaScriptCore.exp:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • runtime/JSGlobalObject.h: (JSC::JSGlobalObject::registerWeakMap): (JSC::JSGlobalObject::deregisterWeakMap):
Location:
trunk/JavaScriptCore
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r57108 r57120  
     12010-04-05  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        Support weak maps in JSC
     6        https://bugs.webkit.org/show_bug.cgi?id=37132
     7
     8        Expose an API to allow creation of a map for storing
     9        weak JS references.
     10
     11        * API/JSWeakObjectMapRefInternal.h: Added.
     12        (OpaqueJSWeakObjectMap::create):
     13        (OpaqueJSWeakObjectMap::map):
     14        (OpaqueJSWeakObjectMap::~OpaqueJSWeakObjectMap):
     15        (OpaqueJSWeakObjectMap::OpaqueJSWeakObjectMap):
     16        * API/JSWeakObjectMapRefPrivate.cpp: Added.
     17        * API/JSWeakObjectMapRefPrivate.h: Added.
     18        * JavaScriptCore.exp:
     19        * JavaScriptCore.xcodeproj/project.pbxproj:
     20        * runtime/JSGlobalObject.h:
     21        (JSC::JSGlobalObject::registerWeakMap):
     22        (JSC::JSGlobalObject::deregisterWeakMap):
     23
    1242010-04-05  Laszlo Gombos  <laszlo.1.gombos@nokia.com>
    225
  • trunk/JavaScriptCore/JavaScriptCore.exp

    r57055 r57120  
    8585_JSValueToStringCopy
    8686_JSValueUnprotect
     87_JSWeakObjectMapClear
     88_JSWeakObjectMapCreate
     89_JSWeakObjectMapGet
     90_JSWeakObjectMapSet
    8791_WTFLog
    8892_WTFLogVerbose
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r56825 r57120  
    274274                A727FF6B0DA3092200E548D7 /* JSPropertyNameIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A727FF660DA3053B00E548D7 /* JSPropertyNameIterator.cpp */; };
    275275                A7280A2811557E3000D56957 /* JSObjectRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A79EDB0811531CD60019E912 /* JSObjectRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
     276                A7482B9311671147003B0712 /* JSWeakObjectMapRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A7482B791166CDEA003B0712 /* JSWeakObjectMapRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
     277                A7482B9411671147003B0712 /* JSWeakObjectMapRefPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7482B7A1166CDEA003B0712 /* JSWeakObjectMapRefPrivate.cpp */; };
     278                A7482E93116A7CAD003B0712 /* JSWeakObjectMapRefInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A7482E37116A697B003B0712 /* JSWeakObjectMapRefInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };
    276279                A74B3499102A5F8E0032AB98 /* MarkStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74B3498102A5F8E0032AB98 /* MarkStack.cpp */; };
    277280                A766B44F0EE8DCD1009518CA /* ExecutableAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B48DB50EE74CFC00DCBDB6 /* ExecutableAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    829832                A727FF650DA3053B00E548D7 /* JSPropertyNameIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPropertyNameIterator.h; sourceTree = "<group>"; };
    830833                A727FF660DA3053B00E548D7 /* JSPropertyNameIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPropertyNameIterator.cpp; sourceTree = "<group>"; };
     834                A7482B791166CDEA003B0712 /* JSWeakObjectMapRefPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWeakObjectMapRefPrivate.h; sourceTree = "<group>"; };
     835                A7482B7A1166CDEA003B0712 /* JSWeakObjectMapRefPrivate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWeakObjectMapRefPrivate.cpp; sourceTree = "<group>"; };
     836                A7482E37116A697B003B0712 /* JSWeakObjectMapRefInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWeakObjectMapRefInternal.h; sourceTree = "<group>"; };
    831837                A74B3498102A5F8E0032AB98 /* MarkStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkStack.cpp; sourceTree = "<group>"; };
    832838                A76EE6580FAE59D5003F069A /* NativeFunctionWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeFunctionWrapper.h; sourceTree = "<group>"; };
     
    12151221                                E124A8F50E555775003091F1 /* OpaqueJSString.h */,
    12161222                                5DE3D0F40DD8DDFB00468714 /* WebKitAvailability.h */,
     1223                                A7482B791166CDEA003B0712 /* JSWeakObjectMapRefPrivate.h */,
     1224                                A7482B7A1166CDEA003B0712 /* JSWeakObjectMapRefPrivate.cpp */,
     1225                                A7482E37116A697B003B0712 /* JSWeakObjectMapRefInternal.h */,
    12171226                        );
    12181227                        path = API;
     
    20212030                                A7280A2811557E3000D56957 /* JSObjectRefPrivate.h in Headers */,
    20222031                                86565743115BE3DA00291F40 /* CString.h in Headers */,
     2032                                A7482B9311671147003B0712 /* JSWeakObjectMapRefPrivate.h in Headers */,
     2033                                A7482E93116A7CAD003B0712 /* JSWeakObjectMapRefInternal.h in Headers */,
    20232034                        );
    20242035                        runOnlyForDeploymentPostprocessing = 0;
     
    24632474                                E1EF79AA0CE97BA60088D500 /* UTF8.cpp in Sources */,
    24642475                                86565742115BE3DA00291F40 /* CString.cpp in Sources */,
     2476                                A7482B9411671147003B0712 /* JSWeakObjectMapRefPrivate.cpp in Sources */,
    24652477                        );
    24662478                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/JavaScriptCore/runtime/JSGlobalObject.h

    r54022 r57120  
    2626#include "JSGlobalData.h"
    2727#include "JSVariableObject.h"
     28#include "JSWeakObjectMapRefInternal.h"
    2829#include "NativeFunctionWrapper.h"
    2930#include "NumberPrototype.h"
     
    5758    protected:
    5859        using JSVariableObject::JSVariableObjectData;
     60        typedef HashSet<RefPtr<OpaqueJSWeakObjectMap> > WeakMapSet;
    5961
    6062        struct JSGlobalObjectData : public JSVariableObjectData {
     
    154156
    155157            HashSet<GlobalCodeBlock*> codeBlocks;
     158            WeakMapSet weakMaps;
    156159        };
    157160
     
    271274        }
    272275
     276        void registerWeakMap(OpaqueJSWeakObjectMap* map)
     277        {
     278            d()->weakMaps.add(map);
     279        }
     280
     281        void deregisterWeakMap(OpaqueJSWeakObjectMap* map)
     282        {
     283            d()->weakMaps.remove(map);
     284        }
     285
    273286    protected:
    274287
Note: See TracChangeset for help on using the changeset viewer.