WebKit Bugzilla
Attachment 341161 Details for
Bug 185932
: Make a memory test where we can validate JSCs mini memory mode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP
a-backup.diff (text/plain), 17.00 KB, created by
Saam Barati
on 2018-05-23 19:58:07 PDT
(
hide
)
Description:
WIP
Filename:
MIME Type:
Creator:
Saam Barati
Created:
2018-05-23 19:58:07 PDT
Size:
17.00 KB
patch
obsolete
>Index: Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj >=================================================================== >--- Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (revision 232121) >+++ Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (working copy) >@@ -36,6 +36,7 @@ > buildPhases = ( > ); > dependencies = ( >+ 7954BE0D20B63348009BC83A /* PBXTargetDependency */, > FE533CAF1F217EC60016A1FE /* PBXTargetDependency */, > 0F6183471C45F67A0072450B /* PBXTargetDependency */, > 0F93275D1C20BF3A00CF6564 /* PBXTargetDependency */, >@@ -1102,7 +1103,10 @@ > 79160DBE1C8E3EC8008C085A /* ProxyRevoke.h in Headers */ = {isa = PBXBuildFile; fileRef = 79160DBC1C8E3EC8008C085A /* ProxyRevoke.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 7919B7801E03559C005BEED8 /* B3Compile.h in Headers */ = {isa = PBXBuildFile; fileRef = 7919B77F1E03559C005BEED8 /* B3Compile.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 79233C2B1D34715700C5A834 /* JITMathIC.h in Headers */ = {isa = PBXBuildFile; fileRef = 79233C291D34715700C5A834 /* JITMathIC.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 79281BD120B62B3E002E2A60 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51F0EB6105C86C6B00E6DF1B /* Foundation.framework */; }; >+ 79281BD220B62B3E002E2A60 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 932F5BD90822A1C700736975 /* JavaScriptCore.framework */; }; > 792CB34A1C4EED5C00D13AF3 /* PCToCodeOriginMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 792CB3481C4EED5C00D13AF3 /* PCToCodeOriginMap.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 7954BE0B20B62D64009BC83A /* testmem.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7954BE0A20B62D63009BC83A /* testmem.mm */; }; > 795AC61820A2355E0052C76C /* JSVirtualMachinePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 795AC61720A2354B0052C76C /* JSVirtualMachinePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 7964656A1B952FF0003059EE /* GetPutInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 796465681B952FF0003059EE /* GetPutInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 7965C2171E5D799600B7591D /* AirAllocateRegistersByGraphColoring.h in Headers */ = {isa = PBXBuildFile; fileRef = 7965C2151E5D799600B7591D /* AirAllocateRegistersByGraphColoring.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -1908,6 +1912,13 @@ > remoteGlobalIDString = 65FB3F6609D11E9100F49DEB; > remoteInfo = "Generate Derived Sources"; > }; >+ 7954BE0C20B63348009BC83A /* PBXContainerItemProxy */ = { >+ isa = PBXContainerItemProxy; >+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; >+ proxyType = 1; >+ remoteGlobalIDString = 79281BBD20B62B3E002E2A60; >+ remoteInfo = testmem; >+ }; > 932F5BE60822A1C700736975 /* PBXContainerItemProxy */ = { > isa = PBXContainerItemProxy; > containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; >@@ -3621,8 +3632,10 @@ > 79160DBC1C8E3EC8008C085A /* ProxyRevoke.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyRevoke.h; sourceTree = "<group>"; }; > 7919B77F1E03559C005BEED8 /* B3Compile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3Compile.h; path = b3/B3Compile.h; sourceTree = "<group>"; }; > 79233C291D34715700C5A834 /* JITMathIC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITMathIC.h; sourceTree = "<group>"; }; >+ 79281BDC20B62B3E002E2A60 /* testmem */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testmem; sourceTree = BUILT_PRODUCTS_DIR; }; > 792CB3471C4EED5C00D13AF3 /* PCToCodeOriginMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PCToCodeOriginMap.cpp; sourceTree = "<group>"; }; > 792CB3481C4EED5C00D13AF3 /* PCToCodeOriginMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PCToCodeOriginMap.h; sourceTree = "<group>"; }; >+ 7954BE0A20B62D63009BC83A /* testmem.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = testmem.mm; path = testmem/testmem.mm; sourceTree = "<group>"; }; > 795AC61720A2354B0052C76C /* JSVirtualMachinePrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSVirtualMachinePrivate.h; sourceTree = "<group>"; }; > 795F099C1E03600500BBE37F /* B3Compile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = B3Compile.cpp; path = b3/B3Compile.cpp; sourceTree = "<group>"; }; > 796465681B952FF0003059EE /* GetPutInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetPutInfo.h; sourceTree = "<group>"; }; >@@ -4838,6 +4851,15 @@ > ); > runOnlyForDeploymentPostprocessing = 0; > }; >+ 79281BD020B62B3E002E2A60 /* Frameworks */ = { >+ isa = PBXFrameworksBuildPhase; >+ buildActionMask = 2147483647; >+ files = ( >+ 79281BD120B62B3E002E2A60 /* Foundation.framework in Frameworks */, >+ 79281BD220B62B3E002E2A60 /* JavaScriptCore.framework in Frameworks */, >+ ); >+ runOnlyForDeploymentPostprocessing = 0; >+ }; > 932F5BD20822A1C700736975 /* Frameworks */ = { > isa = PBXFrameworksBuildPhase; > buildActionMask = 2147483647; >@@ -4886,6 +4908,7 @@ > FE533CAC1F217DB40016A1FE /* testmasm */, > 6511230514046A4C002B101D /* testRegExp */, > 932F5BD90822A1C700736975 /* JavaScriptCore.framework */, >+ 79281BDC20B62B3E002E2A60 /* testmem */, > ); > name = Products; > sourceTree = "<group>"; >@@ -4932,6 +4955,7 @@ > 95AB831A0DA42C6900BC83F3 /* profiler */, > 932FC3C20824BB70005B3C75 /* Resources */, > 7EF6E0BB0EB7A1EC0079AFAF /* runtime */, >+ 79281C0020B62BBD002E2A60 /* testmem */, > 9959E9251BD17F1E001AA413 /* Scripts */, > 141211000A48772600480255 /* tests */, > 8603CEF014C753EF00AE59E3 /* tools */, >@@ -6242,6 +6266,14 @@ > name = ARM64; > sourceTree = "<group>"; > }; >+ 79281C0020B62BBD002E2A60 /* testmem */ = { >+ isa = PBXGroup; >+ children = ( >+ 7954BE0A20B62D63009BC83A /* testmem.mm */, >+ ); >+ name = testmem; >+ sourceTree = "<group>"; >+ }; > 7ACDDECF1E252ACA0097AFEB /* cocoa */ = { > isa = PBXGroup; > children = ( >@@ -9742,6 +9774,22 @@ > productReference = 6511230514046A4C002B101D /* testRegExp */; > productType = "com.apple.product-type.tool"; > }; >+ 79281BBD20B62B3E002E2A60 /* testmem */ = { >+ isa = PBXNativeTarget; >+ buildConfigurationList = 79281BD720B62B3E002E2A60 /* Build configuration list for PBXNativeTarget "testmem" */; >+ buildPhases = ( >+ 79281BBE20B62B3E002E2A60 /* Sources */, >+ 79281BD020B62B3E002E2A60 /* Frameworks */, >+ ); >+ buildRules = ( >+ ); >+ dependencies = ( >+ ); >+ name = testmem; >+ productName = testapi; >+ productReference = 79281BDC20B62B3E002E2A60 /* testmem */; >+ productType = "com.apple.product-type.tool"; >+ }; > 932F5B3E0822A1C700736975 /* JavaScriptCore */ = { > isa = PBXNativeTarget; > buildConfigurationList = 149C275D08902AFE008A9EFC /* Build configuration list for PBXNativeTarget "JavaScriptCore" */; >@@ -9845,6 +9893,7 @@ > 0F93274E1C20BCBA00CF6564 /* dynbench */, > 0F6183381C45F62A0072450B /* testair */, > FE533CA11F217DB30016A1FE /* testmasm */, >+ 79281BBD20B62B3E002E2A60 /* testmem */, > ); > }; > /* End PBXProject section */ >@@ -10153,6 +10202,14 @@ > ); > runOnlyForDeploymentPostprocessing = 0; > }; >+ 79281BBE20B62B3E002E2A60 /* Sources */ = { >+ isa = PBXSourcesBuildPhase; >+ buildActionMask = 2147483647; >+ files = ( >+ 7954BE0B20B62D64009BC83A /* testmem.mm in Sources */, >+ ); >+ runOnlyForDeploymentPostprocessing = 0; >+ }; > 932F5B910822A1C700736975 /* Sources */ = { > isa = PBXSourcesBuildPhase; > buildActionMask = 2147483647; >@@ -10417,6 +10474,11 @@ > target = 65FB3F6609D11E9100F49DEB /* Derived Sources */; > targetProxy = 65FB3F7D09D11EF300F49DEB /* PBXContainerItemProxy */; > }; >+ 7954BE0D20B63348009BC83A /* PBXTargetDependency */ = { >+ isa = PBXTargetDependency; >+ target = 79281BBD20B62B3E002E2A60 /* testmem */; >+ targetProxy = 7954BE0C20B63348009BC83A /* PBXContainerItemProxy */; >+ }; > 932F5BE70822A1C700736975 /* PBXTargetDependency */ = { > isa = PBXTargetDependency; > target = 932F5B3E0822A1C700736975 /* JavaScriptCore */; >@@ -10866,6 +10928,38 @@ > }; > name = Production; > }; >+ 79281BD820B62B3E002E2A60 /* Debug */ = { >+ isa = XCBuildConfiguration; >+ baseConfigurationReference = BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */; >+ buildSettings = { >+ PRODUCT_NAME = "$(TARGET_NAME)"; >+ }; >+ name = Debug; >+ }; >+ 79281BD920B62B3E002E2A60 /* Release */ = { >+ isa = XCBuildConfiguration; >+ baseConfigurationReference = BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */; >+ buildSettings = { >+ PRODUCT_NAME = "$(TARGET_NAME)"; >+ }; >+ name = Release; >+ }; >+ 79281BDA20B62B3E002E2A60 /* Profiling */ = { >+ isa = XCBuildConfiguration; >+ baseConfigurationReference = BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */; >+ buildSettings = { >+ PRODUCT_NAME = "$(TARGET_NAME)"; >+ }; >+ name = Profiling; >+ }; >+ 79281BDB20B62B3E002E2A60 /* Production */ = { >+ isa = XCBuildConfiguration; >+ baseConfigurationReference = BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */; >+ buildSettings = { >+ PRODUCT_NAME = "$(TARGET_NAME)"; >+ }; >+ name = Production; >+ }; > A761483D0E6402F700E357FA /* Profiling */ = { > isa = XCBuildConfiguration; > baseConfigurationReference = 1C9051440BA9E8A70081E9D0 /* DebugRelease.xcconfig */; >@@ -11128,6 +11222,17 @@ > defaultConfigurationIsVisible = 0; > defaultConfigurationName = Production; > }; >+ 79281BD720B62B3E002E2A60 /* Build configuration list for PBXNativeTarget "testmem" */ = { >+ isa = XCConfigurationList; >+ buildConfigurations = ( >+ 79281BD820B62B3E002E2A60 /* Debug */, >+ 79281BD920B62B3E002E2A60 /* Release */, >+ 79281BDA20B62B3E002E2A60 /* Profiling */, >+ 79281BDB20B62B3E002E2A60 /* Production */, >+ ); >+ defaultConfigurationIsVisible = 0; >+ defaultConfigurationName = Production; >+ }; > FE533CA71F217DB30016A1FE /* Build configuration list for PBXNativeTarget "testmasm" */ = { > isa = XCConfigurationList; > buildConfigurations = ( >Index: Source/JavaScriptCore/testmem/testmem.mm >=================================================================== >--- Source/JavaScriptCore/testmem/testmem.mm (nonexistent) >+++ Source/JavaScriptCore/testmem/testmem.mm (working copy) >@@ -0,0 +1,77 @@ >+/* >+ * Copyright (C) 2018 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. >+ */ >+ >+#import <JavaScriptCore/JavaScriptCore.h> >+#import <libproc.h> >+#import <mach/mach.h> >+#import <mach/task_info.h> >+ >+static void description() >+{ >+ fprintf(stderr, >+ "usage \ >+ testmem <path-to-file-to-run>\n"); >+} >+ >+struct Footprint { >+ size_t current; >+ size_t peak; >+ >+ static Footprint now() >+ { >+ rusage_info_current rusage; >+ if (proc_pid_rusage(getpid(), RUSAGE_INFO_CURRENT, (rusage_info_t *)&rusage) != 0) { >+ fprintf(stderr, "Going to crash: could not get rusage\n"); >+ exit(1); >+ } >+ >+ return { rusage.ri_phys_footprint, rusage.ri_lifetime_max_phys_footprint }; >+ } >+}; >+ >+int main(int argc, char* argv[]) >+{ >+ if (argc != 2) { >+ description(); >+ exit(1); >+ } >+ >+ >+ NSString *path = [NSString stringWithUTF8String:argv[1]]; >+ NSString *script = [[NSString alloc] initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; >+ >+ auto start = CFAbsoluteTimeGetCurrent(); >+ for (size_t i = 0; i < 10; ++i) { >+ JSContext *context = [[JSContext alloc] init]; >+ [context evaluateScript:script]; >+ } >+ auto time = CFAbsoluteTimeGetCurrent() - start; >+ fprintf(stdout, "time: %lf\n", time); >+ auto footprint = Footprint::now(); >+ fprintf(stdout, "peak footprint: %zu\n", footprint.peak); >+ fprintf(stdout, "footprint at end: %zu\n", footprint.current); >+ >+ return 0; >+} >Index: Tools/Scripts/run-testmem >=================================================================== >--- Tools/Scripts/run-testmem (nonexistent) >+++ Tools/Scripts/run-testmem (working copy) >@@ -0,0 +1,96 @@ >+#!/usr/bin/env ruby >+ >+# Copyright (C) 2018 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. >+ >+require 'fileutils' >+require 'pathname' >+require 'open3' >+require "JSON" >+ >+THIS_SCRIPT_PATH = Pathname.new(__FILE__).realpath >+SCRIPTS_PATH = THIS_SCRIPT_PATH.dirname >+ >+def getBuildDirectory >+ command = SCRIPTS_PATH.join("webkit-build-directory").to_s >+ command += " --release" >+ command += " --executablePath" >+ >+ output = `#{command}`.split("\n") >+ if !output.length >+ $stderr.puts "Error: must specify --jsc <path>" >+ exit 1 >+ end >+ output = output[0] >+ >+ return Pathname.new(output).to_s >+end >+ >+def getTestmemPath >+ return Pathname.new(getBuildDirectory()).join("testmem").to_s >+end >+ >+def getPathsOfSunspiderTests >+ path = Pathname.new(SCRIPTS_PATH).join("../../PerformanceTests/JetStream/sunspider") >+ files = [] >+ Dir.foreach(path) { >+ | filename | >+ next unless filename =~ /\.js$/ >+ files.push(path.join(filename).to_s) >+ } >+ >+ return files >+end >+ >+def run >+ paths = getPathsOfSunspiderTests >+ scores = {} >+ mempath = getTestmemPath >+ buildDir = getBuildDirectory >+ paths.each { | path | scores[path] = [] } >+ (0..3).to_a.each { >+ paths.each { | path | >+ command = mempath + " " + path >+ stdout, stderr, status = Open3.capture3({"DYLD_FRAMEWORK_PATH" => buildDir}, command) >+ exit 1 if status != 0 >+ time, peakFootprint, footprintAtEnd = stdout.split("\n") >+ raise unless time.slice!("time:") >+ raise unless peakFootprint.slice!("peak footprint:") >+ raise unless footprintAtEnd.slice!("footprint at end:") >+ time = time.to_f >+ peakFootprint = peakFootprint.to_f >+ footprintAtEnd = footprintAtEnd.to_f >+ >+ scores[path].push({"time"=>time, "peak"=>peakFootprint, "end"=>footprintAtEnd}) >+ >+ #print path, "\n" >+ #print "time: ", time, "\n" >+ #print "peak footprint: ", peakFootprint/1024/1024, "MB", "\n" >+ #print "end footprint: ", footprintAtEnd/1024/1024, "MB", "\n\n" >+ } >+ } >+ print JSON.pretty_generate(scores) >+ >+end >+ >+run > >Property changes on: Tools/Scripts/run-testmem >___________________________________________________________________ >Added: svn:executable >## -0,0 +1 ## >+* >\ No newline at end of property
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185932
:
341161
|
341236
|
341241
|
341242
|
341245
|
341246
|
341247
|
341248
|
341249
|
341297
|
341299
|
341300