Diff
Modified: trunk/PerformanceTests/APIBench/CurrentAPI/RichardsMostlyC/RichardsMostlyC/richards.c (270658 => 270659)
--- trunk/PerformanceTests/APIBench/CurrentAPI/RichardsMostlyC/RichardsMostlyC/richards.c 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/PerformanceTests/APIBench/CurrentAPI/RichardsMostlyC/RichardsMostlyC/richards.c 2020-12-10 23:10:36 UTC (rev 270659)
@@ -10,9 +10,8 @@
#include <stdio.h>
#include <stdlib.h>
-
#include <_javascript_Core/_javascript_Core.h>
-#import <QuartzCore/QuartzCore.h>
+#include <QuartzCore/QuartzCore.h>
#if 1
#define Count 1000
Modified: trunk/PerformanceTests/APIBench/References/RichardsC/RichardsC/richards.c (270658 => 270659)
--- trunk/PerformanceTests/APIBench/References/RichardsC/RichardsC/richards.c 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/PerformanceTests/APIBench/References/RichardsC/RichardsC/richards.c 2020-12-10 23:10:36 UTC (rev 270659)
@@ -10,9 +10,8 @@
#include <stdio.h>
#include <stdlib.h>
-
#include <_javascript_Core/_javascript_Core.h>
-#import <QuartzCore/QuartzCore.h>
+#include <QuartzCore/QuartzCore.h>
#if 1
#define Count 1000
Modified: trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlyC/RichardsMostlyC/richards.c (270658 => 270659)
--- trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlyC/RichardsMostlyC/richards.c 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlyC/RichardsMostlyC/richards.c 2020-12-10 23:10:36 UTC (rev 270659)
@@ -10,9 +10,9 @@
#include <stdio.h>
#include <stdlib.h>
-
+#include <_javascript_Core/JSLockRefPrivate.h>
#include <_javascript_Core/_javascript_Core.h>
-#import <QuartzCore/QuartzCore.h>
+#include <QuartzCore/QuartzCore.h>
#if 1
#define Count 1000
@@ -322,6 +322,7 @@
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
ctx = JSGlobalContextCreate(NULL);
+ JSLock(ctx);
JSObjectRef globalObject = JSContextGetGlobalObject(ctx);
JSStringRef source = readFile("richards.js");
Modified: trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlyObjC/RichardsMostlyObjC/WorkerTask.m (270658 => 270659)
--- trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlyObjC/RichardsMostlyObjC/WorkerTask.m 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlyObjC/RichardsMostlyObjC/WorkerTask.m 2020-12-10 23:10:36 UTC (rev 270659)
@@ -25,6 +25,7 @@
#import "WorkerTask.h"
+#import <_javascript_Core/JSLockRefPrivate.h>
#import <_javascript_Core/_javascript_Core.h>
@implementation WorkerTask {
@@ -44,6 +45,7 @@
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
context = [[JSContext alloc] init];
+ JSLock(context.JSGlobalContextRef);
[context setExceptionHandler:^(JSContext *context, JSValue *exception) {
NSLog(@"%@", exception.toString);
exit(2);
Copied: trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlyObjC/RichardsMostlyObjC.xcodeproj/xcshareddata/xcschemes/RichardsMostlyObjC.xcscheme (from rev 270658, trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlyObjC/RichardsMostlyObjC.xcodeproj/xcshareddata/xcschemes/RichardsMostlySwift.xcscheme) (0 => 270659)
--- trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlyObjC/RichardsMostlyObjC.xcodeproj/xcshareddata/xcschemes/RichardsMostlyObjC.xcscheme (rev 0)
+++ trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlyObjC/RichardsMostlyObjC.xcodeproj/xcshareddata/xcschemes/RichardsMostlyObjC.xcscheme 2020-12-10 23:10:36 UTC (rev 270659)
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "1200"
+ version = "1.7">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "1415AD212499BC5C005BB2E4"
+ BuildableName = "RichardsMostlyObjC"
+ BlueprintName = "RichardsMostlyObjC"
+ ReferencedContainer = "container:RichardsMostlyObjC.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ buildConfiguration = "Debug"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES">
+ <Testables>
+ </Testables>
+ </TestAction>
+ <LaunchAction
+ buildConfiguration = "Debug"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ debugServiceExtension = "internal"
+ allowLocationSimulation = "YES">
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "1415AD212499BC5C005BB2E4"
+ BuildableName = "RichardsMostlyObjC"
+ BlueprintName = "RichardsMostlyObjC"
+ ReferencedContainer = "container:RichardsMostlyObjC.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </LaunchAction>
+ <ProfileAction
+ buildConfiguration = "Release"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ debugDocumentVersioning = "YES">
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "1415AD212499BC5C005BB2E4"
+ BuildableName = "RichardsMostlyObjC"
+ BlueprintName = "RichardsMostlyObjC"
+ ReferencedContainer = "container:RichardsMostlyObjC.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+ <InstallAction
+ buildConfiguration = "Release">
+ </InstallAction>
+</Scheme>
Deleted: trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlyObjC/RichardsMostlyObjC.xcodeproj/xcshareddata/xcschemes/RichardsMostlySwift.xcscheme (270658 => 270659)
--- trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlyObjC/RichardsMostlyObjC.xcodeproj/xcshareddata/xcschemes/RichardsMostlySwift.xcscheme 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlyObjC/RichardsMostlyObjC.xcodeproj/xcshareddata/xcschemes/RichardsMostlySwift.xcscheme 2020-12-10 23:10:36 UTC (rev 270659)
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Scheme
- LastUpgradeVersion = "1200"
- version = "1.7">
- <BuildAction
- parallelizeBuildables = "YES"
- buildImplicitDependencies = "YES">
- <BuildActionEntries>
- <BuildActionEntry
- buildForTesting = "YES"
- buildForRunning = "YES"
- buildForProfiling = "YES"
- buildForArchiving = "YES"
- buildForAnalyzing = "YES">
- <BuildableReference
- BuildableIdentifier = "primary"
- BlueprintIdentifier = "1415AD212499BC5C005BB2E4"
- BuildableName = "RichardsMostlyObjC"
- BlueprintName = "RichardsMostlyObjC"
- ReferencedContainer = "container:RichardsMostlyObjC.xcodeproj">
- </BuildableReference>
- </BuildActionEntry>
- </BuildActionEntries>
- </BuildAction>
- <TestAction
- buildConfiguration = "Debug"
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
- shouldUseLaunchSchemeArgsEnv = "YES">
- <Testables>
- </Testables>
- </TestAction>
- <LaunchAction
- buildConfiguration = "Debug"
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
- launchStyle = "0"
- useCustomWorkingDirectory = "NO"
- ignoresPersistentStateOnLaunch = "NO"
- debugDocumentVersioning = "YES"
- debugServiceExtension = "internal"
- allowLocationSimulation = "YES">
- <BuildableProductRunnable
- runnableDebuggingMode = "0">
- <BuildableReference
- BuildableIdentifier = "primary"
- BlueprintIdentifier = "1415AD212499BC5C005BB2E4"
- BuildableName = "RichardsMostlyObjC"
- BlueprintName = "RichardsMostlyObjC"
- ReferencedContainer = "container:RichardsMostlyObjC.xcodeproj">
- </BuildableReference>
- </BuildableProductRunnable>
- </LaunchAction>
- <ProfileAction
- buildConfiguration = "Release"
- shouldUseLaunchSchemeArgsEnv = "YES"
- savedToolIdentifier = ""
- useCustomWorkingDirectory = "NO"
- debugDocumentVersioning = "YES">
- <BuildableProductRunnable
- runnableDebuggingMode = "0">
- <BuildableReference
- BuildableIdentifier = "primary"
- BlueprintIdentifier = "1415AD212499BC5C005BB2E4"
- BuildableName = "RichardsMostlyObjC"
- BlueprintName = "RichardsMostlyObjC"
- ReferencedContainer = "container:RichardsMostlyObjC.xcodeproj">
- </BuildableReference>
- </BuildableProductRunnable>
- </ProfileAction>
- <AnalyzeAction
- buildConfiguration = "Debug">
- </AnalyzeAction>
- <ArchiveAction
- buildConfiguration = "Release"
- revealArchiveInOrganizer = "YES">
- </ArchiveAction>
- <InstallAction
- buildConfiguration = "Release">
- </InstallAction>
-</Scheme>
Copied: trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift/BridgingHeader.h (from rev 270658, trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift/WorkerTask.swift) (0 => 270659)
--- trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift/BridgingHeader.h (rev 0)
+++ trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift/BridgingHeader.h 2020-12-10 23:10:36 UTC (rev 270659)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#pragma once
+
+#include <_javascript_Core/JSLockRefPrivate.h>
Modified: trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift/WorkerTask.swift (270658 => 270659)
--- trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift/WorkerTask.swift 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift/WorkerTask.swift 2020-12-10 23:10:36 UTC (rev 270659)
@@ -31,6 +31,7 @@
private static let context : JSContext = {
let context = JSContext()!
let source = try! String(contentsOfFile: "richards.js")
+ JSLock(context.jsGlobalContextRef)
context.evaluateScript(source)
context.exceptionHandler = { context, exception in
print(exception!.toString()!)
Modified: trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift.xcodeproj/project.pbxproj (270658 => 270659)
--- trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift.xcodeproj/project.pbxproj 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift.xcodeproj/project.pbxproj 2020-12-10 23:10:36 UTC (rev 270659)
@@ -44,6 +44,7 @@
140AAC3F249B01D10001F11E /* DeviceTask.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeviceTask.swift; sourceTree = "<group>"; };
1415AD222499BC5C005BB2E4 /* RichardsMostlySwift */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = RichardsMostlySwift; sourceTree = BUILT_PRODUCTS_DIR; };
1415AD252499BC5C005BB2E4 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
+ 145087E92580581900D94197 /* BridgingHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BridgingHeader.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -76,6 +77,7 @@
1415AD242499BC5C005BB2E4 /* RichardsMostlySwift */ = {
isa = PBXGroup;
children = (
+ 145087E92580581900D94197 /* BridgingHeader.h */,
140AAC3F249B01D10001F11E /* DeviceTask.swift */,
140AAC3D249B01D10001F11E /* HandlerTask.swift */,
140AAC3C249B01D10001F11E /* IdleTask.swift */,
@@ -282,6 +284,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = RichardsMostlySwift/BridgingHeader.h;
SWIFT_VERSION = 5.0;
};
name = Debug;
@@ -291,6 +294,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = RichardsMostlySwift/BridgingHeader.h;
SWIFT_VERSION = 5.0;
};
name = Release;
Modified: trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsSomeC/RichardsSomeC/main.m (270658 => 270659)
--- trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsSomeC/RichardsSomeC/main.m 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsSomeC/RichardsSomeC/main.m 2020-12-10 23:10:36 UTC (rev 270659)
@@ -24,6 +24,7 @@
*/
#import <Foundation/Foundation.h>
+#import <_javascript_Core/JSLockRefPrivate.h>
#import <_javascript_Core/_javascript_Core.h>
#import <QuartzCore/QuartzCore.h>
@@ -132,7 +133,7 @@
JSGlobalContextRef context = JSGlobalContextCreate(NULL);
if (!context)
exit(1);
-
+ JSLock(context);
JSValueRef exception = NULL;
JSObjectRef globalObject = JSContextGetGlobalObject(context);
Modified: trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsSomeObjC/RichardsSomeObjC/main.m (270658 => 270659)
--- trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsSomeObjC/RichardsSomeObjC/main.m 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsSomeObjC/RichardsSomeObjC/main.m 2020-12-10 23:10:36 UTC (rev 270659)
@@ -24,6 +24,7 @@
*/
#import <Foundation/Foundation.h>
+#import <_javascript_Core/JSLockRefPrivate.h>
#import <_javascript_Core/_javascript_Core.h>
#import <QuartzCore/QuartzCore.h>
@@ -93,7 +94,7 @@
JSContext *context = [[JSContext alloc] init];
if (!context)
exit(1);
-
+ JSLock(context.JSGlobalContextRef);
[context setObject:WorkerTask.self forKeyedSubscript:@"WorkerTask"];
[context setExceptionHandler:^(JSContext *context, JSValue *exception) {
NSLog(@"%@", exception.toString);
Copied: trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsSomeSwift/RichardsSomeSwift/BridgingHeader.h (from rev 270658, trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift/WorkerTask.swift) (0 => 270659)
--- trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsSomeSwift/RichardsSomeSwift/BridgingHeader.h (rev 0)
+++ trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsSomeSwift/RichardsSomeSwift/BridgingHeader.h 2020-12-10 23:10:36 UTC (rev 270659)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#pragma once
+
+#include <_javascript_Core/JSLockRefPrivate.h>
Modified: trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsSomeSwift/RichardsSomeSwift/main.swift (270658 => 270659)
--- trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsSomeSwift/RichardsSomeSwift/main.swift 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsSomeSwift/RichardsSomeSwift/main.swift 2020-12-10 23:10:36 UTC (rev 270659)
@@ -83,6 +83,8 @@
exit(1)
}
+JSLock(context.jsGlobalContextRef)
+
context.setObject(WorkerTask.self, forKeyedSubscript: "WorkerTask" as NSString)
context.exceptionHandler = { context, exception in
print(exception?.toString() as Any)
Modified: trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsSomeSwift/RichardsSomeSwift.xcodeproj/project.pbxproj (270658 => 270659)
--- trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsSomeSwift/RichardsSomeSwift.xcodeproj/project.pbxproj 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/PerformanceTests/APIBench/UpcomingAPI/RichardsSomeSwift/RichardsSomeSwift.xcodeproj/project.pbxproj 2020-12-10 23:10:36 UTC (rev 270659)
@@ -28,6 +28,7 @@
1401181824998517003987A9 /* RichardsSomeSwift */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = RichardsSomeSwift; sourceTree = BUILT_PRODUCTS_DIR; };
1401181B24998517003987A9 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
1415AD1624998605005BB2E4 /* richards.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = richards.js; sourceTree = "<group>"; };
+ 145087EC258058B800D94197 /* BridgingHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BridgingHeader.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -60,6 +61,7 @@
1401181A24998517003987A9 /* RichardsSomeSwift */ = {
isa = PBXGroup;
children = (
+ 145087EC258058B800D94197 /* BridgingHeader.h */,
1401181B24998517003987A9 /* main.swift */,
1415AD1624998605005BB2E4 /* richards.js */,
);
@@ -250,6 +252,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = RichardsSomeSwift/BridgingHeader.h;
SWIFT_VERSION = 5.0;
};
name = Debug;
@@ -259,6 +262,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = RichardsSomeSwift/BridgingHeader.h;
SWIFT_VERSION = 5.0;
};
name = Release;
Modified: trunk/PerformanceTests/APIBench/api-bench (270658 => 270659)
--- trunk/PerformanceTests/APIBench/api-bench 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/PerformanceTests/APIBench/api-bench 2020-12-10 23:10:36 UTC (rev 270659)
@@ -36,6 +36,7 @@
REFERENCES=("X")
CURRENT_API=()
UPCOMING_API=()
+ARCHS=${ARCHS:-$(uname -m)}
shouldBuild=true
runReferences=true
@@ -146,11 +147,12 @@
return
fi
- log "Building $BENCHMARK_NAME..."
- xcodebuild -project "$project" -target "$BENCHMARK_NAME" -configuration Release build
+ log "Building $BENCHMARK_NAME... (FRAMEWORK_SEARCH_PATHS='$BUILD_DIRECTORY')"
+ xcodebuild -project "$project" -target "$BENCHMARK_NAME" -configuration Release build "FRAMEWORK_SEARCH_PATHS='$BUILD_DIRECTORY'" "ARCHS='$ARCHS'"
}
build() {
+ BUILD_DIRECTORY=$1
forEachBenchmark "buildBenchmark"
}
@@ -223,7 +225,7 @@
fi
local score count
- score=1
+ score=0
count=0
printCategory() {
@@ -237,12 +239,12 @@
avg=$(computeAverage "$benchmarkID")
printAverage "$benchmarkID" "$avg"
count=$((count + 1))
- score=$((score * avg))
+ score=$(echo "$score" "$avg" | awk '{print ($1 + log($2)) }')
done
}
printCategory "CURRENT_API"
printCategory "UPCOMING_API"
- score=$(echo "$score" "$count" | awk '{ print(5000.0 / ($1.0 ^ (1.0 / $2))) }')
+ score=$(echo "$score" "$count" | awk '{ print(5000.0 / exp($1 / $2)) }')
echo ""
echo "Score: $score"
@@ -265,11 +267,11 @@
main() {
collectFlags "$@"
collectBenchmarks
- if [ "$shouldBuild" == true ]; then
- build
- fi
+ for buildDirectory in "${BUILD_DIRECTORIES[@]}"; do
+ if [ "$shouldBuild" == true ]; then
+ build "$buildDirectory"
+ fi
- for buildDirectory in "${BUILD_DIRECTORIES[@]}"; do
run "$buildDirectory"
done
}
Modified: trunk/PerformanceTests/ChangeLog (270658 => 270659)
--- trunk/PerformanceTests/ChangeLog 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/PerformanceTests/ChangeLog 2020-12-10 23:10:36 UTC (rev 270659)
@@ -1,3 +1,45 @@
+2020-12-10 Tadeu Zagallo <[email protected]>
+
+ Add a JSC API to allow acquiring the JSLock
+ https://bugs.webkit.org/show_bug.cgi?id=219663
+
+ Reviewed by Filip Pizlo.
+
+ This patch does 3 things:
+ - Change how the geomean is calculated in api-bench to avoid overflowing
+ - Allow linking against the local build we're benchmarking
+ - Adopt the new JSLock API in the UpcomingAPI subtests
+
+ Using the new API the score improves by ~13.5%. Here are the results for each
+ of the "UpcomingAPI" subtests plus the total score:
+
+ Before After
+ RichardsMostlyC: 77ms 23ms
+ RichardsMostlyObjC: 309ms 282ms
+ RichardsMostlySwift 305ms 280ms
+ RichardsSomeC: 101ms 95ms
+ RichardsSomeObjC: 160ms 157ms
+ RichardsSomeSwift: 201ms 202ms
+ ------------------------------------------
+ Score: 29.5974 33.6404
+
+ * APIBench/UpcomingAPI/RichardsMostlyC/RichardsMostlyC/richards.c:
+ (workfn):
+ * APIBench/UpcomingAPI/RichardsMostlyObjC/RichardsMostlyObjC.xcodeproj/xcshareddata/xcschemes/RichardsMostlyObjC.xcscheme: Renamed from PerformanceTests/APIBench/UpcomingAPI/RichardsMostlyObjC/RichardsMostlyObjC.xcodeproj/xcshareddata/xcschemes/RichardsMostlySwift.xcscheme.
+ * APIBench/UpcomingAPI/RichardsMostlyObjC/RichardsMostlyObjC/WorkerTask.m:
+ (+[WorkerTask context]):
+ * APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift.xcodeproj/project.pbxproj:
+ * APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift/BridgingHeader.h: Copied from PerformanceTests/APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift/WorkerTask.swift.
+ * APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift/WorkerTask.swift:
+ * APIBench/UpcomingAPI/RichardsSomeC/RichardsSomeC/main.m:
+ (main):
+ * APIBench/UpcomingAPI/RichardsSomeObjC/RichardsSomeObjC/main.m:
+ (main):
+ * APIBench/UpcomingAPI/RichardsSomeSwift/RichardsSomeSwift.xcodeproj/project.pbxproj:
+ * APIBench/UpcomingAPI/RichardsSomeSwift/RichardsSomeSwift/BridgingHeader.h: Copied from PerformanceTests/APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift/WorkerTask.swift.
+ * APIBench/UpcomingAPI/RichardsSomeSwift/RichardsSomeSwift/main.swift:
+ * APIBench/api-bench:
+
2020-12-07 Don Olmstead <[email protected]>
[CMake] Remove WEBKIT_WRAP_SOURCELIST
Added: trunk/Source/_javascript_Core/API/JSLockRef.cpp (0 => 270659)
--- trunk/Source/_javascript_Core/API/JSLockRef.cpp (rev 0)
+++ trunk/Source/_javascript_Core/API/JSLockRef.cpp 2020-12-10 23:10:36 UTC (rev 270659)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSLockRefPrivate.h"
+
+#include "JSLock.h"
+
+using namespace JSC;
+
+void JSLock(JSContextRef ctx)
+{
+ if (!ctx) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
+ JSGlobalObject* globalObject = toJS(ctx);
+ globalObject->vm().apiLock().lock();
+}
+
+void JSUnlock(JSContextRef ctx)
+{
+ if (!ctx) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
+ JSGlobalObject* globalObject = toJS(ctx);
+ globalObject->vm().apiLock().unlock();
+}
Added: trunk/Source/_javascript_Core/API/JSLockRefPrivate.h (0 => 270659)
--- trunk/Source/_javascript_Core/API/JSLockRefPrivate.h (rev 0)
+++ trunk/Source/_javascript_Core/API/JSLockRefPrivate.h 2020-12-10 23:10:36 UTC (rev 270659)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <_javascript_Core/JSBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+ @function
+ @abstract Acquire the API lock for the given JSContextRef.
+ @param ctx The execution context to be locked.
+ @discussion The lock has to be held to perform any interactions with the JSContextRef. This function allows holding the lock across multiple interactions to amortize the cost. This lock is a recursive lock.
+ */
+JS_EXPORT void JSLock(JSContextRef ctx);
+
+/*!
+ @function
+ @abstract Release the API lock for the given JSContextRef.
+ @param ctx The execution context to be unlocked.
+ @discussion Releases the lock that was previously acquired using JSLock.
+ */
+JS_EXPORT void JSUnlock(JSContextRef ctx);
+
+#ifdef __cplusplus
+}
+#endif
Modified: trunk/Source/_javascript_Core/API/JSValueRef.cpp (270658 => 270659)
--- trunk/Source/_javascript_Core/API/JSValueRef.cpp 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/Source/_javascript_Core/API/JSValueRef.cpp 2020-12-10 23:10:36 UTC (rev 270659)
@@ -29,6 +29,7 @@
#include "APICast.h"
#include "APIUtils.h"
#include "DateInstance.h"
+#include "JSAPIWrapperObject.h"
#include "JSCInlines.h"
#include "JSCallbackObject.h"
#include "JSONObject.h"
Modified: trunk/Source/_javascript_Core/ChangeLog (270658 => 270659)
--- trunk/Source/_javascript_Core/ChangeLog 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/Source/_javascript_Core/ChangeLog 2020-12-10 23:10:36 UTC (rev 270659)
@@ -1,3 +1,22 @@
+2020-12-10 Tadeu Zagallo <[email protected]>
+
+ Add a JSC API to allow acquiring the JSLock
+ https://bugs.webkit.org/show_bug.cgi?id=219663
+
+ Reviewed by Filip Pizlo.
+
+ Introduce two new functions to the C API: JSLock and JSUnlock. These
+ functions allow users to take control of the JSContext's lock, which
+ can greatly reduce the overhead of bridging between JS and native.
+
+ * API/JSLockRef.cpp: Added.
+ (JSLock):
+ (JSUnlock):
+ * API/JSLockRefPrivate.h: Added.
+ * API/JSValueRef.cpp:
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * Sources.txt:
+
2020-12-10 Don Olmstead <[email protected]>
[CMake] Determine when to use $<TARGET_OBJECTS> for executables
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (270658 => 270659)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2020-12-10 23:10:36 UTC (rev 270659)
@@ -809,6 +809,7 @@
1478297B1379E8A800A7C2A3 /* HandleTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 146FA5A81378F6B0003627A3 /* HandleTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
147B83AC0E6DB8C9004775A4 /* BatchedTransitionOptimizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 147B83AA0E6DB8C9004775A4 /* BatchedTransitionOptimizer.h */; settings = {ATTRIBUTES = (Private, ); }; };
147B84630E6DE6B1004775A4 /* PutPropertySlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 147B84620E6DE6B1004775A4 /* PutPropertySlot.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 1486A8C024ABED480073922D /* JSLockRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1486A8BF24ABED3C0073922D /* JSLockRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
14874AE615EBDE4A002E3587 /* JSScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 14874AE215EBDE4A002E3587 /* JSScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
148A7BF01B82975A002D9157 /* InlineCallFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 148A7BEE1B82975A002D9157 /* InlineCallFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
148CD1D8108CF902008163C6 /* JSContextRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 148CD1D7108CF902008163C6 /* JSContextRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -3415,6 +3416,8 @@
1482B78A0A4305AB00517CFC /* APICast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APICast.h; sourceTree = "<group>"; };
1482B7E10A43076000517CFC /* JSObjectRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSObjectRef.h; sourceTree = "<group>"; };
1482B7E20A43076000517CFC /* JSObjectRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSObjectRef.cpp; sourceTree = "<group>"; };
+ 1486A8BE24ABED3B0073922D /* JSLockRef.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSLockRef.cpp; sourceTree = "<group>"; };
+ 1486A8BF24ABED3C0073922D /* JSLockRefPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSLockRefPrivate.h; sourceTree = "<group>"; };
14874AE115EBDE4A002E3587 /* JSScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScope.cpp; sourceTree = "<group>"; };
14874AE215EBDE4A002E3587 /* JSScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScope.h; sourceTree = "<group>"; };
1487CE16237741000044429C /* WasmGeneratorTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WasmGeneratorTraits.h; sourceTree = "<group>"; };
@@ -6485,6 +6488,8 @@
86E3C60A167BAB87006D760A /* JSExport.h */,
0F0CAEF91EC4DA6200970D12 /* JSHeapFinalizerPrivate.cpp */,
0F0CAEFA1EC4DA6200970D12 /* JSHeapFinalizerPrivate.h */,
+ 1486A8BE24ABED3B0073922D /* JSLockRef.cpp */,
+ 1486A8BF24ABED3C0073922D /* JSLockRefPrivate.h */,
C25D709A16DE99F400FCA6BC /* JSManagedValue.h */,
C25D709916DE99F400FCA6BC /* JSManagedValue.mm */,
2A4BB7F218A41179008A0FCD /* JSManagedValueInternal.h */,
@@ -10042,6 +10047,7 @@
A503FA1E188E0FB000110F14 /* JSJavaScriptCallFramePrototype.h in Headers */,
BC18C4160E16F5CD00B34460 /* JSLexicalEnvironment.h in Headers */,
BC18C4230E16F5CD00B34460 /* JSLock.h in Headers */,
+ 1486A8C024ABED480073922D /* JSLockRefPrivate.h in Headers */,
C25D709C16DE99F400FCA6BC /* JSManagedValue.h in Headers */,
2A4BB7F318A41179008A0FCD /* JSManagedValueInternal.h in Headers */,
A700874217CBE8EB00C3E643 /* JSMap.h in Headers */,
Modified: trunk/Source/_javascript_Core/Sources.txt (270658 => 270659)
--- trunk/Source/_javascript_Core/Sources.txt 2020-12-10 22:56:33 UTC (rev 270658)
+++ trunk/Source/_javascript_Core/Sources.txt 2020-12-10 23:10:36 UTC (rev 270659)
@@ -31,6 +31,7 @@
API/JSClassRef.cpp
API/JSContextRef.cpp
API/JSHeapFinalizerPrivate.cpp
+API/JSLockRef.cpp
API/JSMarkingConstraintPrivate.cpp
API/JSObjectRef.cpp
API/JSTypedArray.cpp