Changeset 35442 in webkit for trunk/JavaScriptCore/API/JSBase.h


Ignore:
Timestamp:
Jul 29, 2008, 11:05:11 PM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Geoff Garen.

Implement JSContextGroup APIs to make concurrent execution possible for
JavaScriptCore clients.

This changes the behavior of JSGlobalContextCreate(), so that it now uses a private context
group for each context, making JSlock implicit locking unnecessary.

  • API/JSContextRef.h:
  • API/JSContextRef.cpp: (JSContextGroupCreate): (JSContextGroupRetain): (JSContextGroupRelease): (JSGlobalContextCreate): (JSGlobalContextCreateInGroup): (JSGlobalContextRelease): (JSContextGetGroup): Added new methods. JSGlobalContextCreate() calls JSGlobalContextCreateInGroup() now.
  • API/APICast.h: (toJS): (toRef): Added converters for JSContextGroupRef.
  • API/JSBase.cpp: (JSGarbageCollect): JSGarbageCollect(0) is now a no-op, and the passed in context is actually used.
  • API/JSBase.h: Aded a typedef for JSContextGroupRef. Updated documentation for JSGarbageCollect().
  • kjs/JSGlobalData.cpp:
  • kjs/JSGlobalData.h: Removed support for JSGlobalData shared instance. JSGlobalData::isSharedInstance member variable still remains, to be deleted in a followup patch.
  • kjs/JSLock.cpp: (KJS::JSLock::JSLock): Disabled JSLock, to be deleted in a follow-up patch.


  • kjs/collector.cpp: (KJS::Heap::markOtherThreadConservatively): Removed an assertion that referenced JSGlobalData::sharedInstance.
  • kjs/collector.h: Made Heap destructor public, so that JSContextRelease can use it.

JavaScriptGlue:

  • JSRun.cpp: (JSRun::JSRun):
  • JSUtils.cpp: (getThreadGlobalExecState): Changed JavaScriptGlue to use a JSGlobalData of its own, now that there is no shared instance.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSBase.h

    r34606 r35442  
    3232
    3333/* JavaScript engine interface */
     34
     35/*! @typedef JSContextGroupRef A group that associates JavaScript contexts with one another. Contexts in the same group may share and exchange JavaScript objects. */
     36typedef const struct OpaqueJSContextGroup* JSContextGroupRef;
    3437
    3538/*! @typedef JSContextRef A JavaScript execution context. Holds the global object and other execution state. */
     
    109112@function
    110113@abstract Performs a JavaScript garbage collection.
    111 @param ctx This parameter is currently unused. Pass NULL.
     114@param ctx The execution context to use.
    112115@discussion JavaScript values that are on the machine stack, in a register,
    113116 protected by JSValueProtect, set as the global object of an execution context,
    114  or reachable from any such value will not be collected. 
    115  
     117 or reachable from any such value will not be collected.
     118
    116119 During JavaScript execution, you are not required to call this function; the
    117  JavaScript engine will garbage collect as needed. One place you may want to call
    118  this function, however, is after releasing the last reference to a JSGlobalContextRef.
    119  At that point, a garbage collection can free the objects still referenced by the
    120  JSGlobalContextRef's global object, along with the global object itself.
     120 JavaScript engine will garbage collect as needed. JavaScript values created
     121 within a context group are automatically destroyed when the last reference
     122 to the context group is released.
    121123*/
    122124JS_EXPORT void JSGarbageCollect(JSContextRef ctx);
Note: See TracChangeset for help on using the changeset viewer.