Changeset 138604 in webkit


Ignore:
Timestamp:
Jan 1, 2013 7:51:15 PM (11 years ago)
Author:
barraclough@apple.com
Message:

Objective-C API for JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=105889

Reviewed by Filip Pizlo.

../JavaScriptCore:

For a detailed description of the API implemented here, see:

JSContext.h
APIJSValue.h
JSVirtualMachine.h
JSExport.h

Still to do -

(1) Shoud rename APIJSValue.h -> JSValue.h (but we'll have to rename JSValue.h first).
(2) Numerous FIXMEs, all with separate bugs filed.

  • API/APIJSValue.h: Added.
    • this Objective-C class is used to reference a JavaScript object.
  • API/JSBase.h:
    • added JS_OBJC_API_ENABLED macro to control ObjC API support.
  • API/JSBlockAdaptor.h: Added.
    • this Objective-C class is used in creating a special NSBlock proxying a JavaScript function.
  • API/JSBlockAdaptor.mm: Added.

(BlockArgument):
(BlockArgument::~BlockArgument):
(BlockArgumentBoolean):
(BlockArgumentBoolean::get):
(BlockArgumentNumeric):
(BlockArgumentNumeric::get):
(BlockArgumentId):
(BlockArgumentId::get):
(BlockArgumentStruct):
(BlockArgumentStruct::BlockArgumentStruct):
(BlockArgumentStruct::~BlockArgumentStruct):
(BlockArgumentStruct::get):

  • decoded arguent type information of a JSBlockAdaptor.

(BlockArgumentTypeDelegate):
(BlockArgumentTypeDelegate::typeInteger):
(BlockArgumentTypeDelegate::typeDouble):
(BlockArgumentTypeDelegate::typeBool):
(BlockArgumentTypeDelegate::typeVoid):
(BlockArgumentTypeDelegate::typeId):
(BlockArgumentTypeDelegate::typeOfClass):
(BlockArgumentTypeDelegate::typeBlock):
(BlockArgumentTypeDelegate::typeStruct):

  • delegate for use in conjunction with parseObjCType.

(BlockResult):
(BlockResult::~BlockResult):
(BlockResultVoid):
(BlockResultVoid::set):
(BlockResultInteger):
(BlockResultInteger::set):
(BlockResultDouble):
(BlockResultDouble::set):
(BlockResultBoolean):
(BlockResultBoolean::set):
(BlockResultStruct):
(BlockResultStruct::BlockResultStruct):
(BlockResultStruct::~BlockResultStruct):
(BlockResultStruct::set):

  • decoded result type information of a JSBlockAdaptor.

(buildBlockSignature):

  • partial step in constructing a signature with stack offset information from one without.

(-[JSBlockAdaptor initWithBlockSignatureFromProtocol:]):

  • constructor.

(-[JSBlockAdaptor blockMatchesSignature:]):

  • check whether signature strings match, where only one contains stack frame offsets.

(-[JSBlockAdaptor blockFromValue:inContext:withException:]):

  • use the adaptor to create a special forwarding block.
  • API/JSCallbackObjectFunctions.h:

(JSC::::inherits):

  • add missing braces to multiline for statement.
  • API/JSContext.h: Added.
    • this Objective-C class is used to reference a JavaScript context.
  • API/JSContext.mm: Added.

(-[JSContext init]):

  • constructor.

(-[JSContext initWithVirtualMachine:]):

  • construct in a given VM (JSGlobalData).

(-[JSContext evaluateScript:]):
(-[JSContext globalObject]):

  • evaluate a script, global object accessor.

(+[JSContext currentContext]):
(+[JSContext currentThis]):
(+[JSContext currentArguments]):

  • These methods obtain context, this, arguments from within a callback.

(-[JSContext virtualMachine]):

  • implementation for .virtualMachine property.

(-[JSContext objectForKeyedSubscript:]):
(-[JSContext setObject:forKeyedSubscript:]):

  • support for subscript property access.

(contextInternalContext):

  • internal accessor to m_context.

(-[JSContext dealloc]):

  • desctructor.

(-[JSContext notifyException:]):
(-[JSContext valueFromNotifyException:]):
(-[JSContext boolFromNotifyException:]):

  • internal method to record an exception was thrown.

(-[JSContext beginCallbackWithData:thisValue:argumentCount:arguments:]):
(-[JSContext endCallbackWithData:]):

  • internal methods to push/pop a callback record.

(-[JSContext protect:]):
(-[JSContext unprotect:]):

  • internal methods to add a value to a protect set (used to protect the internal property of JSValue).

(-[JSContext wrapperForObject:]):

  • internal method to create a wrapper object.

(WeakContextRef::WeakContextRef):
(WeakContextRef::~WeakContextRef):
(WeakContextRef::get):
(WeakContextRef::set):

  • Helper class to implement a weak reference to a JSContext.
  • API/JSContextInternal.h: Added.

(CallbackData):
(WeakContextRef):

  • see API/JSContext.mm for description of internal methods.
  • API/JSExport.h: Added.
    • Provides JSExport protocol & JSExportAs macro.
  • API/JSValue.mm: Added.

(+[JSValue valueWithObject:inContext:]):
(+[JSValue valueWithBool:inContext:]):
(+[JSValue valueWithDouble:inContext:]):
(+[JSValue valueWithInt32:inContext:]):
(+[JSValue valueWithUInt32:inContext:]):
(+[JSValue valueWithNewObjectInContext:]):
(+[JSValue valueWithNewArrayInContext:]):
(+[JSValue valueWithNewRegularExpressionFromPattern:flags:inContext:]):
(+[JSValue valueWithNewErrorFromMessage:inContext:]):
(+[JSValue valueWithNullInContext:]):
(+[JSValue valueWithUndefinedInContext:]):

  • Constructors.

(-[JSValue toObject]):
(-[JSValue toObjectOfClass:]):
(-[JSValue toBool]):
(-[JSValue toDouble]):
(-[JSValue toInt32]):
(-[JSValue toUInt32]):
(-[JSValue toNumber]):
(-[JSValue toString]):
(-[JSValue toDate]):
(-[JSValue toArray]):
(-[JSValue toDictionary]):

  • Conversion to Objective-C types.

(-[JSValue valueForProperty:]):
(-[JSValue setValue:forProperty:]):
(-[JSValue deleteProperty:]):
(-[JSValue hasProperty:]):
(-[JSValue defineProperty:descriptor:]):

  • Property access by property name.

(-[JSValue valueAtIndex:]):
(-[JSValue setValue:atIndex:]):

  • Property access by index.

(-[JSValue isUndefined]):
(-[JSValue isNull]):
(-[JSValue isBoolean]):
(-[JSValue isNumber]):
(-[JSValue isString]):
(-[JSValue isObject]):

  • Test JavaScript type.

(-[JSValue isEqualToObject:]):
(-[JSValue isEqualWithTypeCoercionToObject:]):
(-[JSValue isInstanceOf:]):

  • ===, ==, instanceof operators.

(-[JSValue callWithArguments:]):
(-[JSValue constructWithArguments:]):
(-[JSValue invokeMethod:withArguments:]):

  • Call & construct.

(-[JSValue context]):

  • implementation for .context property.

(-[JSValue toPoint]):
(-[JSValue toRange]):
(-[JSValue toRect]):
(-[JSValue toSize]):
(+[JSValue valueWithPoint:inContext:]):
(+[JSValue valueWithRange:inContext:]):
(+[JSValue valueWithRect:inContext:]):
(+[JSValue valueWithSize:inContext:]):

  • Support for NS struct types.

(-[JSValue objectForKeyedSubscript:]):
(-[JSValue objectAtIndexedSubscript:]):
(-[JSValue setObject:forKeyedSubscript:]):
(-[JSValue setObject:atIndexedSubscript:]):

  • support for subscript property access.

(isDate):
(isArray):

  • internal helper functions to check for instances of JS Date, Array types.

(JSContainerConvertor):
(Task):
(JSContainerConvertor::JSContainerConvertor):
(JSContainerConvertor::isWorkListEmpty):
(JSContainerConvertor::convert):
(JSContainerConvertor::add):
(JSContainerConvertor::take):

  • helper class for tracking state while converting to Array/Dictionary objects.

(valueToObjectWithoutCopy):
(containerValueToObject):
(valueToObject):
(valueToNumber):
(valueToString):
(valueToDate):
(valueToArray):
(valueToDictionary):

  • function for converting JavaScript values to Objective-C objects.

(ObjcContainerConvertor):
(ObjcContainerConvertor::ObjcContainerConvertor):
(ObjcContainerConvertor::isWorkListEmpty):
(ObjcContainerConvertor::convert):
(ObjcContainerConvertor::add):
(ObjcContainerConvertor::take):

  • helper class for tracking state while converting to Array/Dictionary values.

(objectToValueWithoutCopy):
(objectToValue):
(valueInternalValue):

  • function for converting Objective-C objects to JavaScript values.

(+[JSValue valueWithValue:inContext:]):
(-[JSValue initWithValue:inContext:]):

  • internal constructors.

(StructTagHandler):
(getStructTagHandler):
(+[JSValue selectorForStructToValue:]):
(+[JSValue selectorForValueToStruct:]):

  • methods to tracking struct types that support conversion to/from JSValue.

(-[JSValue dealloc]):

  • destructor.

(-[JSValue description]):

  • Objective-C to-NSString conversion.

(typeToValueInvocationFor):
(valueToTypeInvocationFor):

  • create invocation objects for conversion to/from JSValue.
  • API/JSValueInternal.h: Added.
    • see API/JSValue.mm for description of internal methods.
  • API/JSVirtualMachine.h: Added.
    • this Objective-C class is used to reference a JavaScript virtual machine (JSGlobalData).
  • API/JSVirtualMachine.mm: Added.

(-[JSVirtualMachine init]):
(-[JSVirtualMachine dealloc]):

  • constructor & destructor.

(getGroupFromVirtualMachine):

  • internal accessor for m_group property.
  • API/JSVirtualMachineInternal.h: Added.
    • see API/JSVirtualMachine.mm for description of internal methods.
  • API/JSWrapperMap.h: Added.
  • API/JSWrapperMap.mm: Added.

(wrapperClass):

  • singleton root for detction (& unwrapping) of wrapper objects.

(selectorToPropertyName):

  • default selector to property name conversion.

(createObjectWithCustomBrand):

  • creates a JSObject with a custom NativeBrand (class name).

(createRenameMap):

  • parse @optional properties of a JSExport protocol.

(putNonEnumerable):

  • property put with enumerable=false.

(copyMethodsToObject):

  • iterate methods in a protocol; add functions to a JSObject.

(parsePropertyAttributes):

  • examine protocol property metadata.

(makeSetterName):

  • "foo" -> "setFoo"

(copyPrototypeProperties):

  • create properties on a Protocol object reflecting the instance methods & properties of a protocol.

(-[JSObjCClassInfo initWithContext:forClass:superClassInfo:]):
(-[JSObjCClassInfo dealloc]):
(-[JSObjCClassInfo wrapperForObject:]):
(-[JSObjCClassInfo constructor]):

  • cache the Protocol/Constructor objects for an Objective-C type.

(-[JSWrapperMap initWithContext:]):
(-[JSWrapperMap dealloc]):

  • constructor & desctructor.

(-[JSWrapperMap classInfoForClass:]):

  • maps Class -> JSObjCClassInfo.

(-[JSWrapperMap wrapperForObject:]):

  • cretae or retrieve a cached wrapper value for an object.

(tryUnwrapObjcObject):

  • check whether a value is a wrapper object; unwrap if so.
  • API/JavaScriptCore.h:
    • Added includes for new API headers.
  • API/ObjCCallbackFunction.h: Added.
    • this class is used to wrap Objective-C instance methods, class methods & blocks as JSFunction objects.
  • API/ObjCCallbackFunction.mm: Added.

(CallbackArgument):
(CallbackArgument::~CallbackArgument):
(CallbackArgumentBoolean):
(CallbackArgumentBoolean::set):
(CallbackArgumentInteger):
(CallbackArgumentInteger::set):
(CallbackArgumentDouble):
(CallbackArgumentDouble::set):
(CallbackArgumentJSValue):
(CallbackArgumentJSValue::set):
(CallbackArgumentId):
(CallbackArgumentId::set):
(CallbackArgumentOfClass):
(CallbackArgumentOfClass::CallbackArgumentOfClass):
(CallbackArgumentOfClass::~CallbackArgumentOfClass):
(CallbackArgumentOfClass::set):
(CallbackArgumentNSNumber):
(CallbackArgumentNSNumber::set):
(CallbackArgumentNSString):
(CallbackArgumentNSString::set):
(CallbackArgumentNSDate):
(CallbackArgumentNSDate::set):
(CallbackArgumentNSArray):
(CallbackArgumentNSArray::set):
(CallbackArgumentNSDictionary):
(CallbackArgumentNSDictionary::set):
(CallbackArgumentStruct):
(CallbackArgumentStruct::CallbackArgumentStruct):
(CallbackArgumentStruct::~CallbackArgumentStruct):
(CallbackArgumentStruct::set):
(CallbackArgumentBlockCallback):
(CallbackArgumentBlockCallback::CallbackArgumentBlockCallback):
(CallbackArgumentBlockCallback::~CallbackArgumentBlockCallback):
(CallbackArgumentBlockCallback::set):

  • decoded arguent type information of a ObjCCallbackFunction.

(ArgumentTypeDelegate):
(ArgumentTypeDelegate::typeInteger):
(ArgumentTypeDelegate::typeDouble):
(ArgumentTypeDelegate::typeBool):
(ArgumentTypeDelegate::typeVoid):
(ArgumentTypeDelegate::typeId):
(ArgumentTypeDelegate::typeOfClass):
(ArgumentTypeDelegate::typeBlock):
(ArgumentTypeDelegate::typeStruct):

  • delegate for use in conjunction with parseObjCType.

(CallbackResult):
(CallbackResult::~CallbackResult):
(CallbackResultVoid):
(CallbackResultVoid::get):
(CallbackResultId):
(CallbackResultId::get):
(CallbackResultNumeric):
(CallbackResultNumeric::get):
(CallbackResultBoolean):
(CallbackResultBoolean::get):
(CallbackResultStruct):
(CallbackResultStruct::CallbackResultStruct):
(CallbackResultStruct::~CallbackResultStruct):
(CallbackResultStruct::get):

  • decoded result type information of a ObjCCallbackFunction.

(ResultTypeDelegate):
(ResultTypeDelegate::typeInteger):
(ResultTypeDelegate::typeDouble):
(ResultTypeDelegate::typeBool):
(ResultTypeDelegate::typeVoid):
(ResultTypeDelegate::typeId):
(ResultTypeDelegate::typeOfClass):
(ResultTypeDelegate::typeBlock):
(ResultTypeDelegate::typeStruct):

  • delegate for use in conjunction with parseObjCType.

(ObjCCallbackFunction):
(ObjCCallbackFunction::ObjCCallbackFunction):
(ObjCCallbackFunction::~ObjCCallbackFunction):

  • constructor & destructor.

(ObjCCallbackFunction::context):

  • accessor.

(ObjCCallbackFunction::wrappedBlock):

  • attemmpt to unwrap a block object.

(objCCallbackFunctionFinalize):
(objCCallbackFunctionCallAsFunction):
(objCCallbackFunctionClass):

  • JSClassRef used to represent ObjCCallbackFunction objects.

(ObjCCallbackFunction::call):
(blockSignatureContainsClass):

  • helper function to determine if we're running on a recent Clang.

(skipNumber):

  • helper used in parsing signature strings.

(objCCallbackFunctionForInvocation):
(objCCallbackFunctionForMethod):
(objCCallbackFunctionForBlock):

  • functions to try to create ObjCCallbackFunction instances for methods/blocks.

(tryUnwrapBlock):

  • attemmpt to unwrap a block object.
  • API/ObjcRuntimeExtras.h: Added.

(protocolImplementsProtocol):
(forEachProtocolImplementingProtocol):
(forEachMethodInClass):
(forEachMethodInProtocol):
(forEachPropertyInProtocol):

  • functions used in reflecting on Objective-C types.

(skipPair):

  • parsing helper used by parseObjCType, scans for matching parentheses.

(StringRange):
(StringRange::StringRange):
(StringRange::~StringRange):
(StringRange::operator const char*):
(StringRange::get):

  • Helper class - create a c string copy of a range of an existing string.

(parseObjCType):

  • function to parse Objective-C type strings, makes callbacks to a deleagte.
  • API/tests/testapi.c:

(main):

  • added call to testObjectiveCAPI (in testapi.m).
  • API/tests/testapi.m: Added.

(+[ParentObject parentTest]):
(+[TestObject testObject]):
(+[TestObject classTest]):
(-[TestObject getString]):
(-[TestObject testArgumentTypesWithInt:double:boolean:string:number:array:dictionary:]):
(-[TestObject callback:]):
(-[TextXYZ test:]):

  • test object, used in various test vases.

(checkResult):

  • helper function.

(blockSignatureContainsClass):

  • helper function to determine if we're running on a recent Clang.

(testObjectiveCAPI):

  • new test cases.
  • JavaScriptCore.xcodeproj/project.pbxproj:
    • added new files.
  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::JSGlobalData):

  • runtime/JSGlobalData.h:

(JSGlobalData):

  • added m_apiData - provide convenient storage for use by the API.
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::JSGlobalObject):

  • runtime/JSGlobalObject.h:

(JSGlobalObject):

  • added m_apiData - provide convenient storage for use by the API.

../WTF:

  • wtf/WTFThreadData.cpp:

(WTF::WTFThreadData::WTFThreadData):

  • wtf/WTFThreadData.h:

(WTFThreadData):

  • Added m_apiData - provide convenient storage for use by the API.
Location:
trunk/Source
Files:
18 added
13 edited

Legend:

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

    r121762 r138604  
    2929#ifndef __cplusplus
    3030#include <stdbool.h>
     31#endif
     32
     33#ifdef __OBJC__
     34#import <Foundation/Foundation.h>
    3135#endif
    3236
     
    136140#endif
    137141
     142/* Enable the Objective-C API for platforms with a modern runtime. */
     143#undef JS_OBJC_API_ENABLED
     144#define JS_OBJC_API_ENABLED (defined(__OBJC__) && defined(__clang__) && defined(__APPLE__) && (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1090) && !defined(__i386__))
     145
    138146#endif /* JSBase_h */
  • trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r130612 r138604  
    509509bool JSCallbackObject<Parent>::inherits(JSClassRef c) const
    510510{
    511     for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass)
     511    for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
    512512        if (jsClass == c)
    513513            return true;
    514    
     514    }
    515515    return false;
    516516}
  • trunk/Source/JavaScriptCore/API/JavaScriptCore.h

    r34599 r138604  
    3030#include <JavaScriptCore/JSStringRefCF.h>
    3131
     32#if JS_OBJC_API_ENABLED
     33
     34#import "JSContext.h"
     35#import "APIJSValue.h"
     36#import "JSVirtualMachine.h"
     37#import "JSExport.h"
     38
     39#endif
     40
    3241#endif /* JavaScriptCore_h */
  • trunk/Source/JavaScriptCore/API/tests/testapi.c

    r138329 r138604  
    4949#endif
    5050
     51#if PLATFORM(MAC)
     52void testObjectiveCAPI(void);
     53#endif
     54
    5155static JSGlobalContextRef context;
    52 static int failed;
     56int failed;
    5357static void assertEqualsAsBoolean(JSValueRef value, bool expectedValue)
    5458{
     
    10391043    // error mode here to work around Cygwin's behavior. See <http://webkit.org/b/55222>.
    10401044    ::SetErrorMode(0);
     1045#endif
     1046
     1047#if PLATFORM(MAC)
     1048    testObjectiveCAPI();
    10411049#endif
    10421050
  • trunk/Source/JavaScriptCore/ChangeLog

    r138523 r138604  
     12012-12-31  Gavin Barraclough  <barraclough@apple.com>
     2
     3        Objective-C API for JavaScriptCore
     4        https://bugs.webkit.org/show_bug.cgi?id=105889
     5
     6        Reviewed by Filip Pizlo.
     7
     8        For a detailed description of the API implemented here, see:
     9            JSContext.h
     10            APIJSValue.h
     11            JSVirtualMachine.h
     12            JSExport.h
     13        Still to do -
     14            (1) Shoud rename APIJSValue.h -> JSValue.h (but we'll have to rename JSValue.h first).
     15            (2) Numerous FIXMEs, all with separate bugs filed.
     16
     17        * API/APIJSValue.h: Added.
     18            - this Objective-C class is used to reference a JavaScript object.
     19        * API/JSBase.h:
     20            - added JS_OBJC_API_ENABLED macro to control ObjC API support.
     21        * API/JSBlockAdaptor.h: Added.
     22            - this Objective-C class is used in creating a special NSBlock proxying a JavaScript function.
     23        * API/JSBlockAdaptor.mm: Added.
     24        (BlockArgument):
     25        (BlockArgument::~BlockArgument):
     26        (BlockArgumentBoolean):
     27        (BlockArgumentBoolean::get):
     28        (BlockArgumentNumeric):
     29        (BlockArgumentNumeric::get):
     30        (BlockArgumentId):
     31        (BlockArgumentId::get):
     32        (BlockArgumentStruct):
     33        (BlockArgumentStruct::BlockArgumentStruct):
     34        (BlockArgumentStruct::~BlockArgumentStruct):
     35        (BlockArgumentStruct::get):
     36            - decoded arguent type information of a JSBlockAdaptor.
     37        (BlockArgumentTypeDelegate):
     38        (BlockArgumentTypeDelegate::typeInteger):
     39        (BlockArgumentTypeDelegate::typeDouble):
     40        (BlockArgumentTypeDelegate::typeBool):
     41        (BlockArgumentTypeDelegate::typeVoid):
     42        (BlockArgumentTypeDelegate::typeId):
     43        (BlockArgumentTypeDelegate::typeOfClass):
     44        (BlockArgumentTypeDelegate::typeBlock):
     45        (BlockArgumentTypeDelegate::typeStruct):
     46            - delegate for use in conjunction with parseObjCType.
     47        (BlockResult):
     48        (BlockResult::~BlockResult):
     49        (BlockResultVoid):
     50        (BlockResultVoid::set):
     51        (BlockResultInteger):
     52        (BlockResultInteger::set):
     53        (BlockResultDouble):
     54        (BlockResultDouble::set):
     55        (BlockResultBoolean):
     56        (BlockResultBoolean::set):
     57        (BlockResultStruct):
     58        (BlockResultStruct::BlockResultStruct):
     59        (BlockResultStruct::~BlockResultStruct):
     60        (BlockResultStruct::set):
     61            - decoded result type information of a JSBlockAdaptor.
     62        (buildBlockSignature):
     63            - partial step in constructing a signature with stack offset information from one without.
     64        (-[JSBlockAdaptor initWithBlockSignatureFromProtocol:]):
     65            - constructor.
     66        (-[JSBlockAdaptor blockMatchesSignature:]):
     67            - check whether signature strings match, where only one contains stack frame offsets.
     68        (-[JSBlockAdaptor blockFromValue:inContext:withException:]):
     69            - use the adaptor to create a special forwarding block.
     70        * API/JSCallbackObjectFunctions.h:
     71        (JSC::::inherits):
     72            - add missing braces to multiline for statement.
     73        * API/JSContext.h: Added.
     74            - this Objective-C class is used to reference a JavaScript context.
     75        * API/JSContext.mm: Added.
     76        (-[JSContext init]):
     77            - constructor.
     78        (-[JSContext initWithVirtualMachine:]):
     79            - construct in a given VM (JSGlobalData).
     80        (-[JSContext evaluateScript:]):
     81        (-[JSContext globalObject]):
     82            - evaluate a script, global object accessor.
     83        (+[JSContext currentContext]):
     84        (+[JSContext currentThis]):
     85        (+[JSContext currentArguments]):
     86            - These methods obtain context, this, arguments from within a callback.
     87        (-[JSContext virtualMachine]):
     88            - implementation for .virtualMachine property.
     89        (-[JSContext objectForKeyedSubscript:]):
     90        (-[JSContext setObject:forKeyedSubscript:]):
     91            - support for subscript property access.
     92        (contextInternalContext):
     93            - internal accessor to m_context.
     94        (-[JSContext dealloc]):
     95            - desctructor.
     96        (-[JSContext notifyException:]):
     97        (-[JSContext valueFromNotifyException:]):
     98        (-[JSContext boolFromNotifyException:]):
     99            - internal method to record an exception was thrown.
     100        (-[JSContext beginCallbackWithData:thisValue:argumentCount:arguments:]):
     101        (-[JSContext endCallbackWithData:]):
     102            - internal methods to push/pop a callback record.
     103        (-[JSContext protect:]):
     104        (-[JSContext unprotect:]):
     105            - internal methods to add a value to a protect set (used to protect the internal property of JSValue).
     106        (-[JSContext wrapperForObject:]):
     107            - internal method to create a wrapper object.
     108        (WeakContextRef::WeakContextRef):
     109        (WeakContextRef::~WeakContextRef):
     110        (WeakContextRef::get):
     111        (WeakContextRef::set):
     112            - Helper class to implement a weak reference to a JSContext.
     113        * API/JSContextInternal.h: Added.
     114        (CallbackData):
     115        (WeakContextRef):
     116            - see API/JSContext.mm for description of internal methods.
     117        * API/JSExport.h: Added.
     118            - Provides JSExport protocol & JSExportAs macro.
     119        * API/JSValue.mm: Added.
     120        (+[JSValue valueWithObject:inContext:]):
     121        (+[JSValue valueWithBool:inContext:]):
     122        (+[JSValue valueWithDouble:inContext:]):
     123        (+[JSValue valueWithInt32:inContext:]):
     124        (+[JSValue valueWithUInt32:inContext:]):
     125        (+[JSValue valueWithNewObjectInContext:]):
     126        (+[JSValue valueWithNewArrayInContext:]):
     127        (+[JSValue valueWithNewRegularExpressionFromPattern:flags:inContext:]):
     128        (+[JSValue valueWithNewErrorFromMessage:inContext:]):
     129        (+[JSValue valueWithNullInContext:]):
     130        (+[JSValue valueWithUndefinedInContext:]):
     131            - Constructors.
     132        (-[JSValue toObject]):
     133        (-[JSValue toObjectOfClass:]):
     134        (-[JSValue toBool]):
     135        (-[JSValue toDouble]):
     136        (-[JSValue toInt32]):
     137        (-[JSValue toUInt32]):
     138        (-[JSValue toNumber]):
     139        (-[JSValue toString]):
     140        (-[JSValue toDate]):
     141        (-[JSValue toArray]):
     142        (-[JSValue toDictionary]):
     143            - Conversion to Objective-C types.
     144        (-[JSValue valueForProperty:]):
     145        (-[JSValue setValue:forProperty:]):
     146        (-[JSValue deleteProperty:]):
     147        (-[JSValue hasProperty:]):
     148        (-[JSValue defineProperty:descriptor:]):
     149            - Property access by property name.
     150        (-[JSValue valueAtIndex:]):
     151        (-[JSValue setValue:atIndex:]):
     152            - Property access by index.
     153        (-[JSValue isUndefined]):
     154        (-[JSValue isNull]):
     155        (-[JSValue isBoolean]):
     156        (-[JSValue isNumber]):
     157        (-[JSValue isString]):
     158        (-[JSValue isObject]):
     159            - Test JavaScript type.
     160        (-[JSValue isEqualToObject:]):
     161        (-[JSValue isEqualWithTypeCoercionToObject:]):
     162        (-[JSValue isInstanceOf:]):
     163            - ===, ==, instanceof operators.
     164        (-[JSValue callWithArguments:]):
     165        (-[JSValue constructWithArguments:]):
     166        (-[JSValue invokeMethod:withArguments:]):
     167            - Call & construct.
     168        (-[JSValue context]):
     169            - implementation for .context property.
     170        (-[JSValue toPoint]):
     171        (-[JSValue toRange]):
     172        (-[JSValue toRect]):
     173        (-[JSValue toSize]):
     174        (+[JSValue valueWithPoint:inContext:]):
     175        (+[JSValue valueWithRange:inContext:]):
     176        (+[JSValue valueWithRect:inContext:]):
     177        (+[JSValue valueWithSize:inContext:]):
     178            - Support for NS struct types.
     179        (-[JSValue objectForKeyedSubscript:]):
     180        (-[JSValue objectAtIndexedSubscript:]):
     181        (-[JSValue setObject:forKeyedSubscript:]):
     182        (-[JSValue setObject:atIndexedSubscript:]):
     183            - support for subscript property access.
     184        (isDate):
     185        (isArray):
     186            - internal helper functions to check for instances of JS Date, Array types.
     187        (JSContainerConvertor):
     188        (Task):
     189        (JSContainerConvertor::JSContainerConvertor):
     190        (JSContainerConvertor::isWorkListEmpty):
     191        (JSContainerConvertor::convert):
     192        (JSContainerConvertor::add):
     193        (JSContainerConvertor::take):
     194            - helper class for tracking state while converting to Array/Dictionary objects.
     195        (valueToObjectWithoutCopy):
     196        (containerValueToObject):
     197        (valueToObject):
     198        (valueToNumber):
     199        (valueToString):
     200        (valueToDate):
     201        (valueToArray):
     202        (valueToDictionary):
     203            - function for converting JavaScript values to Objective-C objects.
     204        (ObjcContainerConvertor):
     205        (ObjcContainerConvertor::ObjcContainerConvertor):
     206        (ObjcContainerConvertor::isWorkListEmpty):
     207        (ObjcContainerConvertor::convert):
     208        (ObjcContainerConvertor::add):
     209        (ObjcContainerConvertor::take):
     210            - helper class for tracking state while converting to Array/Dictionary values.
     211        (objectToValueWithoutCopy):
     212        (objectToValue):
     213        (valueInternalValue):
     214            - function for converting Objective-C objects to JavaScript values.
     215        (+[JSValue valueWithValue:inContext:]):
     216        (-[JSValue initWithValue:inContext:]):
     217            - internal constructors.
     218        (StructTagHandler):
     219        (getStructTagHandler):
     220        (+[JSValue selectorForStructToValue:]):
     221        (+[JSValue selectorForValueToStruct:]):
     222            - methods to tracking struct types that support conversion to/from JSValue.
     223        (-[JSValue dealloc]):
     224            - destructor.
     225        (-[JSValue description]):
     226            - Objective-C to-NSString conversion.
     227        (typeToValueInvocationFor):
     228        (valueToTypeInvocationFor):
     229            - create invocation objects for conversion to/from JSValue.
     230        * API/JSValueInternal.h: Added.
     231            - see API/JSValue.mm for description of internal methods.
     232        * API/JSVirtualMachine.h: Added.
     233            - this Objective-C class is used to reference a JavaScript virtual machine (JSGlobalData).
     234        * API/JSVirtualMachine.mm: Added.
     235        (-[JSVirtualMachine init]):
     236        (-[JSVirtualMachine dealloc]):
     237            - constructor & destructor.
     238        (getGroupFromVirtualMachine):
     239            - internal accessor for m_group property.
     240        * API/JSVirtualMachineInternal.h: Added.
     241            - see API/JSVirtualMachine.mm for description of internal methods.
     242        * API/JSWrapperMap.h: Added.
     243        * API/JSWrapperMap.mm: Added.
     244        (wrapperClass):
     245            - singleton root for detction (& unwrapping) of wrapper objects.
     246        (selectorToPropertyName):
     247            - default selector to property name conversion.
     248        (createObjectWithCustomBrand):
     249            - creates a JSObject with a custom NativeBrand (class name).
     250        (createRenameMap):
     251            - parse @optional properties of a JSExport protocol.
     252        (putNonEnumerable):
     253            - property put with enumerable=false.
     254        (copyMethodsToObject):
     255            - iterate methods in a protocol; add functions to a JSObject.
     256        (parsePropertyAttributes):
     257            - examine protocol property metadata.
     258        (makeSetterName):
     259            - "foo" -> "setFoo"
     260        (copyPrototypeProperties):
     261            - create properties on a Protocol object reflecting the instance methods & properties of a protocol.
     262        (-[JSObjCClassInfo initWithContext:forClass:superClassInfo:]):
     263        (-[JSObjCClassInfo dealloc]):
     264        (-[JSObjCClassInfo wrapperForObject:]):
     265        (-[JSObjCClassInfo constructor]):
     266            - cache the Protocol/Constructor objects for an Objective-C type.
     267        (-[JSWrapperMap initWithContext:]):
     268        (-[JSWrapperMap dealloc]):
     269            - constructor & desctructor.
     270        (-[JSWrapperMap classInfoForClass:]):
     271            - maps Class -> JSObjCClassInfo.
     272        (-[JSWrapperMap wrapperForObject:]):
     273            - cretae or retrieve a cached wrapper value for an object.
     274        (tryUnwrapObjcObject):
     275            - check whether a value is a wrapper object; unwrap if so.
     276        * API/JavaScriptCore.h:
     277            - Added includes for new API headers.
     278        * API/ObjCCallbackFunction.h: Added.
     279            - this class is used to wrap Objective-C instance methods, class methods & blocks as JSFunction objects.
     280        * API/ObjCCallbackFunction.mm: Added.
     281        (CallbackArgument):
     282        (CallbackArgument::~CallbackArgument):
     283        (CallbackArgumentBoolean):
     284        (CallbackArgumentBoolean::set):
     285        (CallbackArgumentInteger):
     286        (CallbackArgumentInteger::set):
     287        (CallbackArgumentDouble):
     288        (CallbackArgumentDouble::set):
     289        (CallbackArgumentJSValue):
     290        (CallbackArgumentJSValue::set):
     291        (CallbackArgumentId):
     292        (CallbackArgumentId::set):
     293        (CallbackArgumentOfClass):
     294        (CallbackArgumentOfClass::CallbackArgumentOfClass):
     295        (CallbackArgumentOfClass::~CallbackArgumentOfClass):
     296        (CallbackArgumentOfClass::set):
     297        (CallbackArgumentNSNumber):
     298        (CallbackArgumentNSNumber::set):
     299        (CallbackArgumentNSString):
     300        (CallbackArgumentNSString::set):
     301        (CallbackArgumentNSDate):
     302        (CallbackArgumentNSDate::set):
     303        (CallbackArgumentNSArray):
     304        (CallbackArgumentNSArray::set):
     305        (CallbackArgumentNSDictionary):
     306        (CallbackArgumentNSDictionary::set):
     307        (CallbackArgumentStruct):
     308        (CallbackArgumentStruct::CallbackArgumentStruct):
     309        (CallbackArgumentStruct::~CallbackArgumentStruct):
     310        (CallbackArgumentStruct::set):
     311        (CallbackArgumentBlockCallback):
     312        (CallbackArgumentBlockCallback::CallbackArgumentBlockCallback):
     313        (CallbackArgumentBlockCallback::~CallbackArgumentBlockCallback):
     314        (CallbackArgumentBlockCallback::set):
     315            - decoded arguent type information of a ObjCCallbackFunction.
     316        (ArgumentTypeDelegate):
     317        (ArgumentTypeDelegate::typeInteger):
     318        (ArgumentTypeDelegate::typeDouble):
     319        (ArgumentTypeDelegate::typeBool):
     320        (ArgumentTypeDelegate::typeVoid):
     321        (ArgumentTypeDelegate::typeId):
     322        (ArgumentTypeDelegate::typeOfClass):
     323        (ArgumentTypeDelegate::typeBlock):
     324        (ArgumentTypeDelegate::typeStruct):
     325            - delegate for use in conjunction with parseObjCType.
     326        (CallbackResult):
     327        (CallbackResult::~CallbackResult):
     328        (CallbackResultVoid):
     329        (CallbackResultVoid::get):
     330        (CallbackResultId):
     331        (CallbackResultId::get):
     332        (CallbackResultNumeric):
     333        (CallbackResultNumeric::get):
     334        (CallbackResultBoolean):
     335        (CallbackResultBoolean::get):
     336        (CallbackResultStruct):
     337        (CallbackResultStruct::CallbackResultStruct):
     338        (CallbackResultStruct::~CallbackResultStruct):
     339        (CallbackResultStruct::get):
     340            - decoded result type information of a ObjCCallbackFunction.
     341        (ResultTypeDelegate):
     342        (ResultTypeDelegate::typeInteger):
     343        (ResultTypeDelegate::typeDouble):
     344        (ResultTypeDelegate::typeBool):
     345        (ResultTypeDelegate::typeVoid):
     346        (ResultTypeDelegate::typeId):
     347        (ResultTypeDelegate::typeOfClass):
     348        (ResultTypeDelegate::typeBlock):
     349        (ResultTypeDelegate::typeStruct):
     350            - delegate for use in conjunction with parseObjCType.
     351        (ObjCCallbackFunction):
     352        (ObjCCallbackFunction::ObjCCallbackFunction):
     353        (ObjCCallbackFunction::~ObjCCallbackFunction):
     354            - constructor & destructor.
     355        (ObjCCallbackFunction::context):
     356            - accessor.
     357        (ObjCCallbackFunction::wrappedBlock):
     358            - attemmpt to unwrap a block object.
     359        (objCCallbackFunctionFinalize):
     360        (objCCallbackFunctionCallAsFunction):
     361        (objCCallbackFunctionClass):
     362            - JSClassRef used to represent ObjCCallbackFunction objects.
     363        (ObjCCallbackFunction::call):
     364        (blockSignatureContainsClass):
     365            - helper function to determine if we're running on a recent Clang.
     366        (skipNumber):
     367            - helper used in parsing signature strings.
     368        (objCCallbackFunctionForInvocation):
     369        (objCCallbackFunctionForMethod):
     370        (objCCallbackFunctionForBlock):
     371            - functions to try to create ObjCCallbackFunction instances for methods/blocks.
     372        (tryUnwrapBlock):
     373            - attemmpt to unwrap a block object.
     374        * API/ObjcRuntimeExtras.h: Added.
     375        (protocolImplementsProtocol):
     376        (forEachProtocolImplementingProtocol):
     377        (forEachMethodInClass):
     378        (forEachMethodInProtocol):
     379        (forEachPropertyInProtocol):
     380            - functions used in reflecting on Objective-C types.
     381        (skipPair):
     382            - parsing helper used by parseObjCType, scans for matching parentheses.
     383        (StringRange):
     384        (StringRange::StringRange):
     385        (StringRange::~StringRange):
     386        (StringRange::operator const char*):
     387        (StringRange::get):
     388            - Helper class - create a c string copy of a range of an existing string.
     389        (parseObjCType):
     390            - function to parse Objective-C type strings, makes callbacks to a deleagte.
     391        * API/tests/testapi.c:
     392        (main):
     393            - added call to testObjectiveCAPI (in testapi.m).
     394        * API/tests/testapi.m: Added.
     395        (+[ParentObject parentTest]):
     396        (+[TestObject testObject]):
     397        (+[TestObject classTest]):
     398        (-[TestObject getString]):
     399        (-[TestObject testArgumentTypesWithInt:double:boolean:string:number:array:dictionary:]):
     400        (-[TestObject callback:]):
     401        (-[TextXYZ test:]):
     402            - test object, used in various test vases.
     403        (checkResult):
     404            - helper function.
     405        (blockSignatureContainsClass):
     406            - helper function to determine if we're running on a recent Clang.
     407        (testObjectiveCAPI):
     408            - new test cases.
     409        * JavaScriptCore.xcodeproj/project.pbxproj:
     410            - added new files.
     411        * runtime/JSGlobalData.cpp:
     412        (JSC::JSGlobalData::JSGlobalData):
     413        * runtime/JSGlobalData.h:
     414        (JSGlobalData):
     415            - added m_apiData - provide convenient storage for use by the API.
     416        * runtime/JSGlobalObject.cpp:
     417        (JSC::JSGlobalObject::JSGlobalObject):
     418        * runtime/JSGlobalObject.h:
     419        (JSGlobalObject):
     420            - added m_apiData - provide convenient storage for use by the API.
     421
    14222012-12-27  Csaba Osztrogonác  <ossy@webkit.org>
    2423
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r138465 r138604  
    541541                86CC85C40EE7A89400288682 /* JITPropertyAccess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */; };
    542542                86CCEFDE0F413F8900FD7F9E /* JITCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 86CCEFDD0F413F8900FD7F9E /* JITCode.h */; settings = {ATTRIBUTES = (Private, ); }; };
     543                86D2221A167EF9440024C804 /* testapi.m in Sources */ = {isa = PBXBuildFile; fileRef = 86D22219167EF9440024C804 /* testapi.m */; };
    543544                86D3B2C310156BDE002865E7 /* ARMAssembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86D3B2BF10156BDE002865E7 /* ARMAssembler.cpp */; };
    544545                86D3B2C410156BDE002865E7 /* ARMAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B2C010156BDE002865E7 /* ARMAssembler.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    549550                86DB64640F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86DB64630F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp */; };
    550551                86E116B10FE75AC800B512BC /* CodeLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E116B00FE75AC800B512BC /* CodeLocation.h */; settings = {ATTRIBUTES = (Private, ); }; };
     552                86E3C612167BABD7006D760A /* APIJSValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E3C606167BAB87006D760A /* APIJSValue.h */; settings = {ATTRIBUTES = (Public, ); }; };
     553                86E3C613167BABD7006D760A /* JSContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E3C607167BAB87006D760A /* JSContext.h */; settings = {ATTRIBUTES = (Public, ); }; };
     554                86E3C614167BABD7006D760A /* JSExport.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E3C60A167BAB87006D760A /* JSExport.h */; settings = {ATTRIBUTES = (Public, ); }; };
     555                86E3C615167BABD7006D760A /* JSVirtualMachine.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E3C60F167BAB87006D760A /* JSVirtualMachine.h */; settings = {ATTRIBUTES = (Public, ); }; };
     556                86E3C616167BABEE006D760A /* JSContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 86E3C608167BAB87006D760A /* JSContext.mm */; };
     557                86E3C617167BABEE006D760A /* JSContextInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E3C609167BAB87006D760A /* JSContextInternal.h */; };
     558                86E3C618167BABEE006D760A /* JSWrapperMap.mm in Sources */ = {isa = PBXBuildFile; fileRef = 86E3C60B167BAB87006D760A /* JSWrapperMap.mm */; };
     559                86E3C619167BABEE006D760A /* JSWrapperMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E3C60C167BAB87006D760A /* JSWrapperMap.h */; };
     560                86E3C61A167BABEE006D760A /* JSValue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 86E3C60D167BAB87006D760A /* JSValue.mm */; };
     561                86E3C61B167BABEE006D760A /* JSValueInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E3C60E167BAB87006D760A /* JSValueInternal.h */; };
     562                86E3C61C167BABEE006D760A /* JSVirtualMachine.mm in Sources */ = {isa = PBXBuildFile; fileRef = 86E3C610167BAB87006D760A /* JSVirtualMachine.mm */; };
     563                86E3C61D167BABEE006D760A /* JSVirtualMachineInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E3C611167BAB87006D760A /* JSVirtualMachineInternal.h */; };
    551564                86E85539111B9968001AF51E /* JSStringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E85538111B9968001AF51E /* JSStringBuilder.h */; };
    552565                86EBF2FF1560F06A008E9222 /* NameConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EBF2F91560F036008E9222 /* NameConstructor.cpp */; };
     
    570583                86ECA3EA132DEF1C002B2AD7 /* DFGNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 86ECA3E9132DEF1C002B2AD7 /* DFGNode.h */; };
    571584                86ECA3FA132DF25A002B2AD7 /* DFGScoreBoard.h in Headers */ = {isa = PBXBuildFile; fileRef = 86ECA3F9132DF25A002B2AD7 /* DFGScoreBoard.h */; };
     585                86F3EEBB168CDE930077B92A /* JSBlockAdaptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 86F3EEB7168CCF750077B92A /* JSBlockAdaptor.h */; };
     586                86F3EEBC168CDE930077B92A /* JSBlockAdaptor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 86F3EEB8168CCF750077B92A /* JSBlockAdaptor.mm */; };
     587                86F3EEBD168CDE930077B92A /* ObjCCallbackFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 86F3EEB9168CCF750077B92A /* ObjCCallbackFunction.h */; };
     588                86F3EEBE168CDE930077B92A /* ObjCCallbackFunction.mm in Sources */ = {isa = PBXBuildFile; fileRef = 86F3EEBA168CCF750077B92A /* ObjCCallbackFunction.mm */; };
     589                86F3EEBF168CDE930077B92A /* ObjcRuntimeExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 86F3EEB616855A5B0077B92A /* ObjcRuntimeExtras.h */; };
    572590                86FA9E91142BBB2E001773B7 /* JSBoundFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86FA9E8F142BBB2D001773B7 /* JSBoundFunction.cpp */; };
    573591                86FA9E92142BBB2E001773B7 /* JSBoundFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 86FA9E90142BBB2E001773B7 /* JSBoundFunction.h */; };
     
    13791397                86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITPropertyAccess.cpp; sourceTree = "<group>"; };
    13801398                86CCEFDD0F413F8900FD7F9E /* JITCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITCode.h; sourceTree = "<group>"; };
     1399                86D22219167EF9440024C804 /* testapi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = testapi.m; path = API/tests/testapi.m; sourceTree = "<group>"; };
    13811400                86D3B2BF10156BDE002865E7 /* ARMAssembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ARMAssembler.cpp; sourceTree = "<group>"; };
    13821401                86D3B2C010156BDE002865E7 /* ARMAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARMAssembler.h; sourceTree = "<group>"; };
     
    13871406                86DB64630F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExecutableAllocatorFixedVMPool.cpp; sourceTree = "<group>"; };
    13881407                86E116B00FE75AC800B512BC /* CodeLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeLocation.h; sourceTree = "<group>"; };
     1408                86E3C606167BAB87006D760A /* APIJSValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIJSValue.h; sourceTree = "<group>"; };
     1409                86E3C607167BAB87006D760A /* JSContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSContext.h; sourceTree = "<group>"; };
     1410                86E3C608167BAB87006D760A /* JSContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JSContext.mm; sourceTree = "<group>"; };
     1411                86E3C609167BAB87006D760A /* JSContextInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSContextInternal.h; sourceTree = "<group>"; };
     1412                86E3C60A167BAB87006D760A /* JSExport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSExport.h; sourceTree = "<group>"; };
     1413                86E3C60B167BAB87006D760A /* JSWrapperMap.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JSWrapperMap.mm; sourceTree = "<group>"; };
     1414                86E3C60C167BAB87006D760A /* JSWrapperMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWrapperMap.h; sourceTree = "<group>"; };
     1415                86E3C60D167BAB87006D760A /* JSValue.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JSValue.mm; sourceTree = "<group>"; };
     1416                86E3C60E167BAB87006D760A /* JSValueInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSValueInternal.h; sourceTree = "<group>"; };
     1417                86E3C60F167BAB87006D760A /* JSVirtualMachine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVirtualMachine.h; sourceTree = "<group>"; };
     1418                86E3C610167BAB87006D760A /* JSVirtualMachine.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JSVirtualMachine.mm; sourceTree = "<group>"; };
     1419                86E3C611167BAB87006D760A /* JSVirtualMachineInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVirtualMachineInternal.h; sourceTree = "<group>"; };
    13891420                86E85538111B9968001AF51E /* JSStringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringBuilder.h; sourceTree = "<group>"; };
    13901421                86EBF2F91560F036008E9222 /* NameConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NameConstructor.cpp; sourceTree = "<group>"; };
     
    14081439                86ECA3E9132DEF1C002B2AD7 /* DFGNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGNode.h; path = dfg/DFGNode.h; sourceTree = "<group>"; };
    14091440                86ECA3F9132DF25A002B2AD7 /* DFGScoreBoard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGScoreBoard.h; path = dfg/DFGScoreBoard.h; sourceTree = "<group>"; };
     1441                86F3EEB616855A5B0077B92A /* ObjcRuntimeExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjcRuntimeExtras.h; sourceTree = "<group>"; };
     1442                86F3EEB7168CCF750077B92A /* JSBlockAdaptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBlockAdaptor.h; sourceTree = "<group>"; };
     1443                86F3EEB8168CCF750077B92A /* JSBlockAdaptor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JSBlockAdaptor.mm; sourceTree = "<group>"; };
     1444                86F3EEB9168CCF750077B92A /* ObjCCallbackFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjCCallbackFunction.h; sourceTree = "<group>"; };
     1445                86F3EEBA168CCF750077B92A /* ObjCCallbackFunction.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ObjCCallbackFunction.mm; sourceTree = "<group>"; };
    14101446                86F75EFB151C062F007C9BA3 /* RegExpCachedResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExpCachedResult.cpp; sourceTree = "<group>"; };
    14111447                86F75EFC151C062F007C9BA3 /* RegExpCachedResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpCachedResult.h; sourceTree = "<group>"; };
     
    18791915                                14BD5A2D0A3E91F600BAF59C /* testapi.c */,
    18801916                                14D857740A4696C80032146C /* testapi.js */,
     1917                                86D22219167EF9440024C804 /* testapi.m */,
    18811918                                651122E5140469BA002B101D /* testRegExp.cpp */,
    18821919                        );
     
    20462083                        children = (
    20472084                                1482B78A0A4305AB00517CFC /* APICast.h */,
     2085                                86E3C606167BAB87006D760A /* APIJSValue.h */,
    20482086                                865F408710E7D56300947361 /* APIShims.h */,
    20492087                                1CAA8B4A0D32C39A0041BCFF /* JavaScript.h */,
     
    20542092                                142711380A460BBB0080EEEA /* JSBase.h */,
    20552093                                140D17D60E8AD4A9000CD17D /* JSBasePrivate.h */,
     2094                                86F3EEB7168CCF750077B92A /* JSBlockAdaptor.h */,
     2095                                86F3EEB8168CCF750077B92A /* JSBlockAdaptor.mm */,
    20562096                                1440F8AD0A508D200005F061 /* JSCallbackConstructor.cpp */,
    20572097                                1440F8AC0A508D200005F061 /* JSCallbackConstructor.h */,
     
    20632103                                1440FCE20A51E46B0005F061 /* JSClassRef.cpp */,
    20642104                                1440FCE10A51E46B0005F061 /* JSClassRef.h */,
     2105                                86E3C607167BAB87006D760A /* JSContext.h */,
     2106                                86E3C608167BAB87006D760A /* JSContext.mm */,
     2107                                86E3C609167BAB87006D760A /* JSContextInternal.h */,
    20652108                                14BD5A290A3E91F600BAF59C /* JSContextRef.cpp */,
    20662109                                14BD5A2A0A3E91F600BAF59C /* JSContextRef.h */,
    20672110                                148CD1D7108CF902008163C6 /* JSContextRefPrivate.h */,
     2111                                86E3C60A167BAB87006D760A /* JSExport.h */,
    20682112                                1482B7E20A43076000517CFC /* JSObjectRef.cpp */,
    20692113                                1482B7E10A43076000517CFC /* JSObjectRef.h */,
     
    20782122                                146AAB370B66A94400E55F16 /* JSStringRefCF.cpp */,
    20792123                                146AAB2A0B66A84900E55F16 /* JSStringRefCF.h */,
     2124                                86E3C60D167BAB87006D760A /* JSValue.mm */,
     2125                                86E3C60E167BAB87006D760A /* JSValueInternal.h */,
    20802126                                14BD5A2B0A3E91F600BAF59C /* JSValueRef.cpp */,
    20812127                                1482B6EA0A4300B300517CFC /* JSValueRef.h */,
     2128                                86E3C60F167BAB87006D760A /* JSVirtualMachine.h */,
     2129                                86E3C610167BAB87006D760A /* JSVirtualMachine.mm */,
     2130                                86E3C611167BAB87006D760A /* JSVirtualMachineInternal.h */,
    20822131                                A7482E37116A697B003B0712 /* JSWeakObjectMapRefInternal.h */,
    20832132                                A7482B7A1166CDEA003B0712 /* JSWeakObjectMapRefPrivate.cpp */,
    20842133                                A7482B791166CDEA003B0712 /* JSWeakObjectMapRefPrivate.h */,
     2134                                86E3C60B167BAB87006D760A /* JSWrapperMap.mm */,
     2135                                86E3C60C167BAB87006D760A /* JSWrapperMap.h */,
     2136                                86F3EEB9168CCF750077B92A /* ObjCCallbackFunction.h */,
     2137                                86F3EEBA168CCF750077B92A /* ObjCCallbackFunction.mm */,
     2138                                86F3EEB616855A5B0077B92A /* ObjcRuntimeExtras.h */,
    20852139                                E124A8F60E555775003091F1 /* OpaqueJSString.cpp */,
    20862140                                E124A8F50E555775003091F1 /* OpaqueJSString.h */,
     
    32063260                                0F5EF91F16878F7D003E5C25 /* JITThunks.h in Headers */,
    32073261                                0F572D4F16879FDD00E57FBD /* ThunkGenerator.h in Headers */,
     3262                                86E3C612167BABD7006D760A /* APIJSValue.h in Headers */,
     3263                                86E3C613167BABD7006D760A /* JSContext.h in Headers */,
     3264                                86E3C614167BABD7006D760A /* JSExport.h in Headers */,
     3265                                86E3C615167BABD7006D760A /* JSVirtualMachine.h in Headers */,
     3266                                86E3C617167BABEE006D760A /* JSContextInternal.h in Headers */,
     3267                                86E3C619167BABEE006D760A /* JSWrapperMap.h in Headers */,
     3268                                86E3C61B167BABEE006D760A /* JSValueInternal.h in Headers */,
     3269                                86E3C61D167BABEE006D760A /* JSVirtualMachineInternal.h in Headers */,
     3270                                86F3EEBB168CDE930077B92A /* JSBlockAdaptor.h in Headers */,
     3271                                86F3EEBD168CDE930077B92A /* ObjCCallbackFunction.h in Headers */,
     3272                                86F3EEBF168CDE930077B92A /* ObjcRuntimeExtras.h in Headers */,
    32083273                        );
    32093274                        runOnlyForDeploymentPostprocessing = 0;
     
    35293594                        files = (
    35303595                                1440F6100A4F85670005F061 /* testapi.c in Sources */,
     3596                                86D2221A167EF9440024C804 /* testapi.m in Sources */,
    35313597                        );
    35323598                        runOnlyForDeploymentPostprocessing = 0;
     
    38263892                                0FEFC9AA1681A3B300567F53 /* DFGOSRExitJumpPlaceholder.cpp in Sources */,
    38273893                                0F5EF91E16878F7A003E5C25 /* JITThunks.cpp in Sources */,
     3894                                86E3C616167BABEE006D760A /* JSContext.mm in Sources */,
     3895                                86E3C618167BABEE006D760A /* JSWrapperMap.mm in Sources */,
     3896                                86E3C61A167BABEE006D760A /* JSValue.mm in Sources */,
     3897                                86E3C61C167BABEE006D760A /* JSVirtualMachine.mm in Sources */,
     3898                                86F3EEBC168CDE930077B92A /* JSBlockAdaptor.mm in Sources */,
     3899                                86F3EEBE168CDE930077B92A /* ObjCCallbackFunction.mm in Sources */,
    38283900                        );
    38293901                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp

    r136895 r138604  
    186186#endif
    187187    , m_newStringsSinceLastHashConst(0)
     188    , m_apiData(0)
    188189#if ENABLE(ASSEMBLER)
    189190    , m_canUseAssembler(enableAssembler(executableAllocator))
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.h

    r138465 r138604  
    454454        JS_EXPORT_PRIVATE void discardAllCode();
    455455
     456        void *m_apiData;
     457
    456458    private:
    457459        friend class LLIntOffsetsExtractor;
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r136572 r138604  
    115115    , m_evalEnabled(true)
    116116    , m_globalObjectMethodTable(globalObjectMethodTable ? globalObjectMethodTable : &s_globalObjectMethodTable)
     117    , m_apiData(0)
    117118{
    118119}
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r135041 r138604  
    197197        bool hasProfiler() const { return globalObjectMethodTable()->supportsProfiling(this); }
    198198
     199        void* m_apiData;
     200
    199201    protected:
    200202        JS_EXPORT_PRIVATE explicit JSGlobalObject(JSGlobalData&, Structure*, const GlobalObjectMethodTable* = 0);
  • trunk/Source/WTF/ChangeLog

    r138561 r138604  
     12012-12-31  Gavin Barraclough  <barraclough@apple.com>
     2
     3        Objective-C API for JavaScriptCore
     4        https://bugs.webkit.org/show_bug.cgi?id=105889
     5
     6        Reviewed by Filip Pizlo.
     7
     8        * wtf/WTFThreadData.cpp:
     9        (WTF::WTFThreadData::WTFThreadData):
     10        * wtf/WTFThreadData.h:
     11        (WTFThreadData):
     12            - Added m_apiData - provide convenient storage for use by the API.
     13
    1142012-12-28  Ilya Tikhonovsky  <loislo@chromium.org>
    215
  • trunk/Source/WTF/wtf/WTFThreadData.cpp

    r131938 r138604  
    3333
    3434WTFThreadData::WTFThreadData()
    35     : m_atomicStringTable(0)
     35    : m_apiData(0)
     36    , m_atomicStringTable(0)
    3637    , m_atomicStringTableDestructor(0)
    3738#if USE(JSC)
  • trunk/Source/WTF/wtf/WTFThreadData.h

    r134797 r138604  
    124124#endif // USE(JSC)
    125125
     126    void* m_apiData;
     127
    126128private:
    127129    AtomicStringTable* m_atomicStringTable;
Note: See TracChangeset for help on using the changeset viewer.