Changeset 52751 in webkit for trunk/JavaScriptCore/API/JSBase.cpp


Ignore:
Timestamp:
Jan 4, 2010, 11:18:31 AM (15 years ago)
Author:
[email protected]
Message:

https://bugs.webkit.org/show_bug.cgi?id=33158
Refactor JSC API entry/exit to use RAII instead of copy/pasting code.
Make it easier to change set of actions taken when passing across the API boundary.

Reviewed by Sam "Shimmey Shimmey" Weinig.

  • API/APIShims.h: Added.

(JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
(JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
(JSC::APIEntryShim::APIEntryShim):
(JSC::APICallbackShim::APICallbackShim):
(JSC::APICallbackShim::~APICallbackShim):

  • API/JSBase.cpp:

(JSEvaluateScript):
(JSCheckScriptSyntax):
(JSGarbageCollect):
(JSReportExtraMemoryCost):

  • API/JSCallbackConstructor.cpp:

(JSC::constructJSCallback):

  • API/JSCallbackFunction.cpp:

(JSC::JSCallbackFunction::call):

  • API/JSCallbackObjectFunctions.h:

(JSC::::init):
(JSC::::getOwnPropertySlot):
(JSC::::put):
(JSC::::deleteProperty):
(JSC::::construct):
(JSC::::hasInstance):
(JSC::::call):
(JSC::::getOwnPropertyNames):
(JSC::::toNumber):
(JSC::::toString):
(JSC::::staticValueGetter):
(JSC::::callbackGetter):

  • API/JSContextRef.cpp:
  • API/JSObjectRef.cpp:

(JSObjectMake):
(JSObjectMakeFunctionWithCallback):
(JSObjectMakeConstructor):
(JSObjectMakeFunction):
(JSObjectMakeArray):
(JSObjectMakeDate):
(JSObjectMakeError):
(JSObjectMakeRegExp):
(JSObjectGetPrototype):
(JSObjectSetPrototype):
(JSObjectHasProperty):
(JSObjectGetProperty):
(JSObjectSetProperty):
(JSObjectGetPropertyAtIndex):
(JSObjectSetPropertyAtIndex):
(JSObjectDeleteProperty):
(JSObjectCallAsFunction):
(JSObjectCallAsConstructor):
(JSObjectCopyPropertyNames):
(JSPropertyNameArrayRelease):
(JSPropertyNameAccumulatorAddName):

  • API/JSValueRef.cpp:

(JSValueGetType):
(JSValueIsUndefined):
(JSValueIsNull):
(JSValueIsBoolean):
(JSValueIsNumber):
(JSValueIsString):
(JSValueIsObject):
(JSValueIsObjectOfClass):
(JSValueIsEqual):
(JSValueIsStrictEqual):
(JSValueIsInstanceOfConstructor):
(JSValueMakeUndefined):
(JSValueMakeNull):
(JSValueMakeBoolean):
(JSValueMakeNumber):
(JSValueMakeString):
(JSValueToBoolean):
(JSValueToNumber):
(JSValueToStringCopy):
(JSValueToObject):
(JSValueProtect):
(JSValueUnprotect):

File:
1 edited

Legend:

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

    r52082 r52751  
    2929
    3030#include "APICast.h"
     31#include "APIShims.h"
    3132#include "Completion.h"
    3233#include "OpaqueJSString.h"
     
    4445{
    4546    ExecState* exec = toJS(ctx);
    46     exec->globalData().heap.registerThread();
    47     JSLock lock(exec);
     47    APIEntryShim entryShim(exec);
    4848
    4949    JSObject* jsThisObject = toJS(thisObject);
     
    7070{
    7171    ExecState* exec = toJS(ctx);
    72     exec->globalData().heap.registerThread();
    73     JSLock lock(exec);
     72    APIEntryShim entryShim(exec);
    7473
    7574    SourceCode source = makeSource(script->ustring(), sourceURL->ustring(), startingLineNumber);
     
    9594
    9695    ExecState* exec = toJS(ctx);
     96    APIEntryShim entryShim(exec, false);
     97
    9798    JSGlobalData& globalData = exec->globalData();
    98 
    99     JSLock lock(globalData.isSharedInstance ? LockForReal : SilenceAssertionsOnly);
    100 
    10199    if (!globalData.heap.isBusy())
    102100        globalData.heap.collectAllGarbage();
     
    110108{
    111109    ExecState* exec = toJS(ctx);
    112     exec->globalData().heap.registerThread();
    113     JSLock lock(exec);
    114 
     110    APIEntryShim entryShim(exec);
    115111    exec->globalData().heap.reportExtraMemoryCost(size);
    116112}
Note: See TracChangeset for help on using the changeset viewer.