Skip to content

Commit

Permalink
Updated JavaScriptCore to Apr.6 2019
Browse files Browse the repository at this point in the history
  • Loading branch information
mbbill committed May 10, 2019
1 parent 540d395 commit 1ab0873
Show file tree
Hide file tree
Showing 1,130 changed files with 305,045 additions and 229,552 deletions.
63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
*.bc
*.db
*.dll
*.exp
*.idb
*.ilk
Expand Down
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/API/JSAPIGlobalObject.mm
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
return rejectPromise(makeString("The same JSScript was provided for two different identifiers, previously: ", oldModuleKey, " and now: ", moduleKey.string()));
} else {
[jsScript setSourceURL:[NSURL URLWithString:static_cast<NSString *>(moduleKey.string())]];
source = [jsScript forceRecreateJSSourceCode];
source = [jsScript jsSourceCode];
}

args.append(source);
Expand Down
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/API/JSAPIWrapperObject.mm
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
// the same Objective-C object in multiple global objects keeps all of the global objects alive.
if (!wrapperObject->wrappedObject())
return false;
return JSC::Heap::isMarked(wrapperObject->structure()->globalObject()) && visitor.containsOpaqueRoot(wrapperObject->wrappedObject());
return visitor.vm().heap.isMarked(wrapperObject->structure()->globalObject()) && visitor.containsOpaqueRoot(wrapperObject->wrappedObject());
}

namespace JSC {
Expand Down
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/API/JSBasePrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ owns a large non-GC memory region. Calling this function will encourage the
garbage collector to collect soon, hoping to reclaim that large non-GC memory
region.
*/
JS_EXPORT void JSReportExtraMemoryCost(JSContextRef ctx, size_t size) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
JS_EXPORT void JSReportExtraMemoryCost(JSContextRef ctx, size_t size) JSC_API_AVAILABLE(macos(10.6), ios(7.0));

JS_EXPORT void JSDisableGCTimer(void);

Expand Down
8 changes: 4 additions & 4 deletions Source/JavaScriptCore/API/JSContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
JavaScript execution takes place within a context, and all JavaScript values
are tied to a context.
*/
JSC_CLASS_AVAILABLE(macosx(10.9), ios(7.0))
JSC_CLASS_AVAILABLE(macos(10.9), ios(7.0))
@interface JSContext : NSObject

/*!
Expand Down Expand Up @@ -78,7 +78,7 @@ JSC_CLASS_AVAILABLE(macosx(10.9), ios(7.0))
@param sourceURL A URL for the script's source file. Used by debuggers and when reporting exceptions. This parameter is informative only: it does not change the behavior of the script.
@result The last value generated by the script.
*/
- (JSValue *)evaluateScript:(NSString *)script withSourceURL:(NSURL *)sourceURL JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
- (JSValue *)evaluateScript:(NSString *)script withSourceURL:(NSURL *)sourceURL JSC_API_AVAILABLE(macos(10.10), ios(8.0));

/*!
@methodgroup Callback Accessors
Expand All @@ -101,7 +101,7 @@ JSC_CLASS_AVAILABLE(macosx(10.9), ios(7.0))
a callback from JavaScript this method will return nil.
@result The currently executing JavaScript function or nil if there isn't one.
*/
+ (JSValue *)currentCallee JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
+ (JSValue *)currentCallee JSC_API_AVAILABLE(macos(10.10), ios(8.0));

/*!
@method
Expand Down Expand Up @@ -176,7 +176,7 @@ JSC_CLASS_AVAILABLE(macosx(10.9), ios(7.0))
@property
@discussion Name of the JSContext. Exposed when remote debugging the context.
*/
@property (copy) NSString *name JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
@property (copy) NSString *name JSC_API_AVAILABLE(macos(10.10), ios(8.0));
@end

/*!
Expand Down
19 changes: 13 additions & 6 deletions Source/JavaScriptCore/API/JSContext.mm
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,15 @@ - (instancetype)initWithVirtualMachine:(JSVirtualMachine *)virtualMachine
};

[self ensureWrapperMap];
[m_virtualMachine addContext:self forGlobalContextRef:m_context];

toJSGlobalObject(m_context)->setAPIWrapper((__bridge void*)self);

return self;
}

- (void)dealloc
{
toJSGlobalObject(m_context)->setAPIWrapper((__bridge void*)nil);
m_exception.clear();
JSGlobalContextRelease(m_context);
[m_virtualMachine release];
Expand Down Expand Up @@ -124,7 +126,8 @@ - (JSValue *)evaluateJSScript:(JSScript *)script

if (script.type == kJSScriptTypeProgram) {
JSValueRef exceptionValue = nullptr;
JSValueRef result = JSEvaluateScriptInternal(locker, exec, m_context, nullptr, [script jsSourceCode]->sourceCode(), &exceptionValue);
JSC::SourceCode sourceCode = [script sourceCode];
JSValueRef result = JSEvaluateScriptInternal(locker, exec, m_context, nullptr, sourceCode, &exceptionValue);

if (exceptionValue)
return [self valueFromNotifyException:exceptionValue];
Expand Down Expand Up @@ -307,7 +310,7 @@ - (instancetype)initWithGlobalContextRef:(JSGlobalContextRef)context
context.exception = exceptionValue;
};

[m_virtualMachine addContext:self forGlobalContextRef:m_context];
toJSGlobalObject(m_context)->setAPIWrapper((__bridge void*)self);

return self;
}
Expand Down Expand Up @@ -357,7 +360,7 @@ - (JSValue *)wrapperForObjCObject:(id)object

- (JSWrapperMap *)wrapperMap
{
return toJS(m_context)->lexicalGlobalObject()->wrapperMap();
return toJSGlobalObject(m_context)->wrapperMap();
}

- (JSValue *)wrapperForJSObject:(JSValueRef)value
Expand All @@ -366,10 +369,14 @@ - (JSValue *)wrapperForJSObject:(JSValueRef)value
return [[self wrapperMap] objcWrapperForJSValueRef:value inContext:self];
}

- (void)removeWrapper:(JSValue *)value
{
return [[self wrapperMap] removeWrapper:value];
}

+ (JSContext *)contextWithJSGlobalContextRef:(JSGlobalContextRef)globalContext
{
JSVirtualMachine *virtualMachine = [JSVirtualMachine virtualMachineWithContextGroupRef:toRef(&toJS(globalContext)->vm())];
JSContext *context = [virtualMachine contextForGlobalContextRef:globalContext];
JSContext *context = (__bridge JSContext *)toJSGlobalObject(globalContext)->apiWrapper();
if (!context)
context = [[[JSContext alloc] initWithGlobalContextRef:globalContext] autorelease];
return context;
Expand Down
1 change: 1 addition & 0 deletions Source/JavaScriptCore/API/JSContextInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ struct CallbackData {
- (JSWrapperMap *)wrapperMap;
- (JSValue *)wrapperForObjCObject:(id)object;
- (JSValue *)wrapperForJSObject:(JSValueRef)value;
- (void)removeWrapper:(JSValue *)value;

@end

Expand Down
8 changes: 4 additions & 4 deletions Source/JavaScriptCore/API/JSContextPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,22 @@
@property
@discussion Remote inspection setting of the JSContext. Default value is YES.
*/
@property (setter=_setRemoteInspectionEnabled:) BOOL _remoteInspectionEnabled JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
@property (setter=_setRemoteInspectionEnabled:) BOOL _remoteInspectionEnabled JSC_API_AVAILABLE(macos(10.10), ios(8.0));

/*!
@property
@discussion Set whether or not the native call stack is included when reporting exceptions. Default value is YES.
*/
@property (setter=_setIncludesNativeCallStackWhenReportingExceptions:) BOOL _includesNativeCallStackWhenReportingExceptions JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
@property (setter=_setIncludesNativeCallStackWhenReportingExceptions:) BOOL _includesNativeCallStackWhenReportingExceptions JSC_API_AVAILABLE(macos(10.10), ios(8.0));

/*!
@property
@discussion Set the run loop the Web Inspector debugger should use when evaluating JavaScript in the JSContext.
*/
@property (setter=_setDebuggerRunLoop:) CFRunLoopRef _debuggerRunLoop JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
@property (setter=_setDebuggerRunLoop:) CFRunLoopRef _debuggerRunLoop JSC_API_AVAILABLE(macos(10.10), ios(8.0));

/*! @abstract The delegate the context will use when trying to load a module. Note, this delegate will be ignored for contexts returned by UIWebView. */
@property (nonatomic, weak) id <JSModuleLoaderDelegate> moduleLoaderDelegate JSC_API_AVAILABLE(macosx(JSC_MAC_TBA), ios(JSC_IOS_TBA));
@property (nonatomic, weak) id <JSModuleLoaderDelegate> moduleLoaderDelegate JSC_API_AVAILABLE(macos(JSC_MAC_TBA), ios(JSC_IOS_TBA));

/*!
@method
Expand Down
18 changes: 9 additions & 9 deletions Source/JavaScriptCore/API/JSContextRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,22 @@ extern "C" {
JSContextGroup's run loop once it has been created.
@result The created JSContextGroup.
*/
JS_EXPORT JSContextGroupRef JSContextGroupCreate(void) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
JS_EXPORT JSContextGroupRef JSContextGroupCreate(void) JSC_API_AVAILABLE(macos(10.6), ios(7.0));

/*!
@function
@abstract Retains a JavaScript context group.
@param group The JSContextGroup to retain.
@result A JSContextGroup that is the same as group.
*/
JS_EXPORT JSContextGroupRef JSContextGroupRetain(JSContextGroupRef group) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
JS_EXPORT JSContextGroupRef JSContextGroupRetain(JSContextGroupRef group) JSC_API_AVAILABLE(macos(10.6), ios(7.0));

/*!
@function
@abstract Releases a JavaScript context group.
@param group The JSContextGroup to release.
*/
JS_EXPORT void JSContextGroupRelease(JSContextGroupRef group) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
JS_EXPORT void JSContextGroupRelease(JSContextGroupRef group) JSC_API_AVAILABLE(macos(10.6), ios(7.0));

/*!
@function
Expand All @@ -83,7 +83,7 @@ JS_EXPORT void JSContextGroupRelease(JSContextGroupRef group) JSC_API_AVAILABLE(
NULL to use the default object class.
@result A JSGlobalContext with a global object of class globalObjectClass.
*/
JS_EXPORT JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) JSC_API_AVAILABLE(macosx(10.5), ios(7.0));
JS_EXPORT JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) JSC_API_AVAILABLE(macos(10.5), ios(7.0));

/*!
@function
Expand All @@ -97,7 +97,7 @@ JS_EXPORT JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass)
@result A JSGlobalContext with a global object of class globalObjectClass and a context
group equal to group.
*/
JS_EXPORT JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClassRef globalObjectClass) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
JS_EXPORT JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClassRef globalObjectClass) JSC_API_AVAILABLE(macos(10.6), ios(7.0));

/*!
@function
Expand Down Expand Up @@ -128,15 +128,15 @@ JS_EXPORT JSObjectRef JSContextGetGlobalObject(JSContextRef ctx);
@param ctx The JSContext whose group you want to get.
@result ctx's group.
*/
JS_EXPORT JSContextGroupRef JSContextGetGroup(JSContextRef ctx) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
JS_EXPORT JSContextGroupRef JSContextGetGroup(JSContextRef ctx) JSC_API_AVAILABLE(macos(10.6), ios(7.0));

/*!
@function
@abstract Gets the global context of a JavaScript execution context.
@param ctx The JSContext whose global context you want to get.
@result ctx's global context.
*/
JS_EXPORT JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx) JSC_API_AVAILABLE(macosx(10.7), ios(7.0));
JS_EXPORT JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx) JSC_API_AVAILABLE(macos(10.7), ios(7.0));

/*!
@function
Expand All @@ -146,15 +146,15 @@ JS_EXPORT JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx) JSC_API
@discussion A JSGlobalContext's name is exposed for remote debugging to make it
easier to identify the context you would like to attach to.
*/
JS_EXPORT JSStringRef JSGlobalContextCopyName(JSGlobalContextRef ctx) JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
JS_EXPORT JSStringRef JSGlobalContextCopyName(JSGlobalContextRef ctx) JSC_API_AVAILABLE(macos(10.10), ios(8.0));

/*!
@function
@abstract Sets the remote debugging name for a context.
@param ctx The JSGlobalContext that you want to name.
@param name The remote debugging name to set on ctx.
*/
JS_EXPORT void JSGlobalContextSetName(JSGlobalContextRef ctx, JSStringRef name) JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
JS_EXPORT void JSGlobalContextSetName(JSGlobalContextRef ctx, JSStringRef name) JSC_API_AVAILABLE(macos(10.10), ios(8.0));

#ifdef __cplusplus
}
Expand Down
4 changes: 2 additions & 2 deletions Source/JavaScriptCore/API/JSContextRefInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ extern "C" {
@abstract Gets the run loop used by the Web Inspector debugger when evaluating JavaScript in this context.
@param ctx The JSGlobalContext whose setting you want to get.
*/
JS_EXPORT CFRunLoopRef JSGlobalContextGetDebuggerRunLoop(JSGlobalContextRef ctx) JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
JS_EXPORT CFRunLoopRef JSGlobalContextGetDebuggerRunLoop(JSGlobalContextRef ctx) JSC_API_AVAILABLE(macos(10.10), ios(8.0));

/*!
@function
@abstract Sets the run loop used by the Web Inspector debugger when evaluating JavaScript in this context.
@param ctx The JSGlobalContext that you want to change.
@param runLoop The new value of the setting for the context.
*/
JS_EXPORT void JSGlobalContextSetDebuggerRunLoop(JSGlobalContextRef ctx, CFRunLoopRef runLoop) JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
JS_EXPORT void JSGlobalContextSetDebuggerRunLoop(JSGlobalContextRef ctx, CFRunLoopRef runLoop) JSC_API_AVAILABLE(macos(10.10), ios(8.0));
#endif

#ifdef __cplusplus
Expand Down
14 changes: 7 additions & 7 deletions Source/JavaScriptCore/API/JSContextRefPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extern "C" {
@param ctx The JSContext whose backtrace you want to get
@result A string containing the backtrace
*/
JS_EXPORT JSStringRef JSContextCreateBacktrace(JSContextRef ctx, unsigned maxStackSize) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
JS_EXPORT JSStringRef JSContextCreateBacktrace(JSContextRef ctx, unsigned maxStackSize) JSC_API_AVAILABLE(macos(10.6), ios(7.0));


/*!
Expand Down Expand Up @@ -85,14 +85,14 @@ typedef bool
need to call JSContextGroupSetExecutionTimeLimit before you start executing
any scripts.
*/
JS_EXPORT void JSContextGroupSetExecutionTimeLimit(JSContextGroupRef group, double limit, JSShouldTerminateCallback callback, void* context) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
JS_EXPORT void JSContextGroupSetExecutionTimeLimit(JSContextGroupRef group, double limit, JSShouldTerminateCallback callback, void* context) JSC_API_AVAILABLE(macos(10.6), ios(7.0));

/*!
@function
@abstract Clears the script execution time limit.
@param group The JavaScript context group that the time limit is cleared on.
*/
JS_EXPORT void JSContextGroupClearExecutionTimeLimit(JSContextGroupRef group) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
JS_EXPORT void JSContextGroupClearExecutionTimeLimit(JSContextGroupRef group) JSC_API_AVAILABLE(macos(10.6), ios(7.0));

/*!
@function
Expand All @@ -101,15 +101,15 @@ JS_EXPORT void JSContextGroupClearExecutionTimeLimit(JSContextGroupRef group) JS
@result The value of the setting, true if remote inspection is enabled, otherwise false.
@discussion Remote inspection is true by default.
*/
JS_EXPORT bool JSGlobalContextGetRemoteInspectionEnabled(JSGlobalContextRef ctx) JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
JS_EXPORT bool JSGlobalContextGetRemoteInspectionEnabled(JSGlobalContextRef ctx) JSC_API_AVAILABLE(macos(10.10), ios(8.0));

/*!
@function
@abstract Sets the remote inspection setting for a context.
@param ctx The JSGlobalContext that you want to change.
@param enabled The new remote inspection enabled setting for the context.
*/
JS_EXPORT void JSGlobalContextSetRemoteInspectionEnabled(JSGlobalContextRef ctx, bool enabled) JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
JS_EXPORT void JSGlobalContextSetRemoteInspectionEnabled(JSGlobalContextRef ctx, bool enabled) JSC_API_AVAILABLE(macos(10.10), ios(8.0));

/*!
@function
Expand All @@ -118,15 +118,15 @@ JS_EXPORT void JSGlobalContextSetRemoteInspectionEnabled(JSGlobalContextRef ctx,
@result The value of the setting, true if remote inspection is enabled, otherwise false.
@discussion This setting is true by default.
*/
JS_EXPORT bool JSGlobalContextGetIncludesNativeCallStackWhenReportingExceptions(JSGlobalContextRef ctx) JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
JS_EXPORT bool JSGlobalContextGetIncludesNativeCallStackWhenReportingExceptions(JSGlobalContextRef ctx) JSC_API_AVAILABLE(macos(10.10), ios(8.0));

/*!
@function
@abstract Sets the include native call stack when reporting exceptions setting for a context.
@param ctx The JSGlobalContext that you want to change.
@param includesNativeCallStack The new value of the setting for the context.
*/
JS_EXPORT void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSGlobalContextRef ctx, bool includesNativeCallStack) JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
JS_EXPORT void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSGlobalContextRef ctx, bool includesNativeCallStack) JSC_API_AVAILABLE(macos(10.10), ios(8.0));

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/API/JSManagedValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ NS_CLASS_AVAILABLE(10_9, 7_0)
@result The new JSManagedValue.
*/
+ (JSManagedValue *)managedValueWithValue:(JSValue *)value;
+ (JSManagedValue *)managedValueWithValue:(JSValue *)value andOwner:(id)owner JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
+ (JSManagedValue *)managedValueWithValue:(JSValue *)value andOwner:(id)owner JSC_API_AVAILABLE(macos(10.10), ios(8.0));

/*!
@method
Expand Down
Loading

0 comments on commit 1ab0873

Please sign in to comment.