mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 559961 - Reorder jar files as part of PGO, r=bsmedberg a=blocking2.0
--HG-- extra : rebase_source : d8a75545714a131291c74dd79c966150544ff9d1
This commit is contained in:
parent
4e754fd28f
commit
cbf7b8bcd4
@ -51,6 +51,7 @@ from automation import Automation
|
||||
PORT = 8888
|
||||
SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0])))
|
||||
PROFILE_DIRECTORY = os.path.abspath(os.path.join(SCRIPT_DIR, "./pgoprofile"))
|
||||
MOZ_JAR_LOG_DIR = os.path.abspath(os.path.join(os.path.join(os.getenv("OBJDIR"), "dist"), "jarlog"))
|
||||
os.chdir(SCRIPT_DIR)
|
||||
|
||||
class EasyServer(SocketServer.TCPServer):
|
||||
@ -67,6 +68,7 @@ if __name__ == '__main__':
|
||||
automation.initializeProfile(PROFILE_DIRECTORY)
|
||||
browserEnv = automation.environment()
|
||||
browserEnv["XPCOM_DEBUG_BREAK"] = "warn"
|
||||
browserEnv["MOZ_JAR_LOG_DIR"] = MOZ_JAR_LOG_DIR
|
||||
|
||||
url = "http://localhost:%d/index.html" % PORT
|
||||
appPath = os.path.join(SCRIPT_DIR, automation.DEFAULT_APP)
|
||||
|
@ -845,3 +845,5 @@ ifdef TIERS
|
||||
DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_dirs))
|
||||
STATIC_DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_staticdirs))
|
||||
endif
|
||||
|
||||
OPTIMIZE_JARS_CMD = $(PYTHON) $(topsrcdir)/config/optimizejars.py
|
||||
|
@ -59,8 +59,9 @@
|
||||
#include "stdlib.h"
|
||||
#include "nsWildCard.h"
|
||||
#include "nsZipArchive.h"
|
||||
|
||||
#include "nsString.h"
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
#include "prenv.h"
|
||||
|
||||
/**
|
||||
* Global allocator used with zlib. Destroyed in module shutdown.
|
||||
@ -101,6 +102,8 @@ nsRecyclingAllocator *gZlibAllocator = NULL;
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
static const PRUint32 kMaxNameLength = PATH_MAX; /* Maximum name length */
|
||||
// For synthetic zip entries. Date/time corresponds to 1980-01-01 00:00.
|
||||
static const PRUint16 kSyntheticTime = 0;
|
||||
@ -219,7 +222,6 @@ nsZipHandle::~nsZipHandle()
|
||||
// nsZipArchive -- public methods
|
||||
//***********************************************************
|
||||
|
||||
|
||||
//---------------------------------------------
|
||||
// nsZipArchive::OpenArchive
|
||||
//---------------------------------------------
|
||||
@ -242,7 +244,28 @@ nsresult nsZipArchive::OpenArchive(nsIFile *aZipFile)
|
||||
PL_INIT_ARENA_POOL(&mArena, "ZipArena", ZIP_ARENABLOCKSIZE);
|
||||
|
||||
//-- get table of contents for archive
|
||||
return BuildFileList();
|
||||
rv = BuildFileList();
|
||||
char *env = PR_GetEnv("MOZ_JAR_LOG_DIR");
|
||||
if (env && NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsILocalFile> logFile;
|
||||
nsresult rv2 = NS_NewLocalFile(NS_ConvertUTF8toUTF16(env), PR_FALSE, getter_AddRefs(logFile));
|
||||
|
||||
if (!NS_SUCCEEDED(rv2))
|
||||
return rv;
|
||||
|
||||
// Create a directory for the log (in case it doesn't exist)
|
||||
logFile->Create(nsIFile::DIRECTORY_TYPE, 0700);
|
||||
|
||||
nsAutoString name;
|
||||
localFile->GetLeafName(name);
|
||||
name.Append(NS_LITERAL_STRING(".log"));
|
||||
logFile->Append(name);
|
||||
|
||||
rv2 = logFile->OpenNSPRFileDesc(PR_WRONLY|PR_CREATE_FILE|PR_APPEND, 0644, &fd);
|
||||
if (NS_SUCCEEDED(rv2))
|
||||
mLog = fd;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
//---------------------------------------------
|
||||
@ -319,8 +342,17 @@ nsZipItem* nsZipArchive::GetItem(const char * aEntryName)
|
||||
nsZipItem* item = mFiles[ HashName(aEntryName, len) ];
|
||||
while (item) {
|
||||
if ((len == item->nameLength) &&
|
||||
(!memcmp(aEntryName, item->Name(), len)))
|
||||
(!memcmp(aEntryName, item->Name(), len))) {
|
||||
|
||||
if (mLog) {
|
||||
// Successful GetItem() is a good indicator that the file is about to be read
|
||||
char *tmp = PL_strdup(aEntryName);
|
||||
tmp[len]='\n';
|
||||
PR_Write(mLog, tmp, len+1);
|
||||
PL_strfree(tmp);
|
||||
}
|
||||
return item; //-- found it
|
||||
}
|
||||
item = item->next;
|
||||
}
|
||||
}
|
||||
@ -533,14 +565,18 @@ nsresult nsZipArchive::BuildFileList()
|
||||
PRUint8* buf;
|
||||
PRUint8* startp = mFd->mFileData;
|
||||
PRUint8* endp = startp + mFd->mLen;
|
||||
|
||||
PRUint32 centralOffset = 0;
|
||||
for (buf = endp - ZIPEND_SIZE; buf > startp; buf--)
|
||||
{
|
||||
if (xtolong(buf) == ENDSIG) {
|
||||
centralOffset = xtolong(((ZipEnd *)buf)->offset_central_dir);
|
||||
break;
|
||||
}
|
||||
|
||||
PRUint32 centralOffset = 1;
|
||||
if (mFd->mLen > ZIPCENTRAL_SIZE && *(PRUint32*)(startp + centralOffset) == CENTRALSIG) {
|
||||
// Success means optimized jar layout from bug 559961 is in effect
|
||||
} else {
|
||||
for (buf = endp - ZIPEND_SIZE; buf > startp; buf--)
|
||||
{
|
||||
if (xtolong(buf) == ENDSIG) {
|
||||
centralOffset = xtolong(((ZipEnd *)buf)->offset_central_dir);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!centralOffset)
|
||||
@ -673,7 +709,6 @@ nsZipHandle* nsZipArchive::GetFD()
|
||||
PRUint8* nsZipArchive::GetData(nsZipItem* aItem)
|
||||
{
|
||||
PR_ASSERT (aItem);
|
||||
|
||||
//-- read local header to get variable length values and calculate
|
||||
//-- the real data offset
|
||||
PRUint32 len = mFd->mLen;
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "zipstruct.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "mozilla/FileUtils.h"
|
||||
|
||||
class nsZipFind;
|
||||
|
||||
@ -206,6 +207,10 @@ private:
|
||||
|
||||
// file handle
|
||||
nsRefPtr<nsZipHandle> mFd;
|
||||
|
||||
// logging handle
|
||||
mozilla::AutoFDClose mLog;
|
||||
|
||||
//--- private methods ---
|
||||
|
||||
nsZipArchive& operator=(const nsZipArchive& rhs); // prevent assignments
|
||||
|
@ -238,6 +238,7 @@ PACK_OMNIJAR = \
|
||||
rm -f omni.jar components/binary.manifest && \
|
||||
grep -h '^binary-component' components/*.manifest > binary.manifest ; \
|
||||
zip -r9m omni.jar $(OMNIJAR_FILES) -x $(NON_OMNIJAR_FILES) && \
|
||||
$(OPTIMIZE_JARS_CMD) $(DIST)/jarlog/ ./ ./ && \
|
||||
mv binary.manifest components && \
|
||||
printf "manifest components/binary.manifest\n" > chrome.manifest
|
||||
UNPACK_OMNIJAR = unzip -o omni.jar && rm -f components/binary.manifest
|
||||
@ -448,6 +449,7 @@ else
|
||||
endif # DMG
|
||||
endif # MOZ_PKG_MANIFEST
|
||||
endif # UNIVERSAL_BINARY
|
||||
$(OPTIMIZE_JARS_CMD) $(DIST)/jarlog/ $(DIST)/bin/chrome $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)/chrome
|
||||
ifndef PKG_SKIP_STRIP
|
||||
@echo "Stripping package directory..."
|
||||
@cd $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR); find . ! -type d \
|
||||
|
@ -132,6 +132,7 @@ EXPORTS_mozilla = \
|
||||
Mutex.h \
|
||||
SSE.h \
|
||||
unused.h \
|
||||
FileUtils.h \
|
||||
$(NULL)
|
||||
|
||||
SDK_LIBRARY = \
|
||||
|
@ -53,6 +53,7 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <mozilla/FileUtils.h>
|
||||
|
||||
// If we can't register <buildid>.conf, we try to create a unique filename
|
||||
// by looping through <buildid>_<int>.conf, but if something is seriously wrong
|
||||
@ -62,25 +63,6 @@
|
||||
static const char kRegFileGlobal[] = "global.reginfo";
|
||||
static const char kRegFileUser[] = "user.reginfo";
|
||||
|
||||
class AutoFDClose
|
||||
{
|
||||
public:
|
||||
AutoFDClose(PRFileDesc* fd = nsnull) : mFD(fd) { }
|
||||
~AutoFDClose() { if (mFD) PR_Close(mFD); }
|
||||
|
||||
PRFileDesc* operator= (PRFileDesc *fd) {
|
||||
if (mFD) PR_Close(mFD);
|
||||
mFD = fd;
|
||||
return fd;
|
||||
}
|
||||
|
||||
operator PRFileDesc* () { return mFD; }
|
||||
PRFileDesc** operator &() { *this = nsnull; return &mFD; }
|
||||
|
||||
private:
|
||||
PRFileDesc *mFD;
|
||||
};
|
||||
|
||||
static PRBool
|
||||
MakeConfFile(const char *regfile, const nsCString &greHome,
|
||||
const GREProperty *aProperties, PRUint32 aPropertiesLen,
|
||||
|
Loading…
Reference in New Issue
Block a user