[CVS] RPM: rpm-5_4: rpm/rpmio/ rpmjs45.cpp
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 03-Jul-2017 06:08:54 Branch: rpm-5_4 Handle: 2017070304085400 Modified files: (Branch: rpm-5_4) rpm/rpmio rpmjs45.cpp Log: - rpmjs45: WIP. Summary: RevisionChanges Path 1.1.2.17+659 -65rpm/rpmio/rpmjs45.cpp patch -p0 <<'@@ .' Index: rpm/rpmio/rpmjs45.cpp $ cvs diff -u -r1.1.2.16 -r1.1.2.17 rpmjs45.cpp --- rpm/rpmio/rpmjs45.cpp 3 Jul 2017 03:41:36 - 1.1.2.16 +++ rpm/rpmio/rpmjs45.cpp 3 Jul 2017 04:08:54 - 1.1.2.17 @@ -27,6 +27,7 @@ #include "jswrapper.h" +#include "vm/StringBuffer.h" #include "vm/TypedArrayObject.h" using namespace JS; @@ -141,9 +142,8 @@ using namespace JS; -#else/* NOTYET */ +#endif /* NOTYET */ -#ifdef NOTYET /* --- shell/jsshell.h */ class AutoCloseFile { @@ -162,9 +162,6 @@ return success; } }; -#endif - -#endif /* NOTYET */ #ifdef XP_WIN const char PathSeparator = '\\'; @@ -268,9 +265,7 @@ JS_ReportError(cx, "can't open %s: %s", pathname, strerror(errno)); return nullptr; } -#ifdef FIXME AutoCloseFile autoClose(file); -#endif RootedObject obj(cx); if (fseek(file, 0, SEEK_END) != 0) { @@ -282,12 +277,8 @@ } else { obj = JS_NewUint8Array(cx, len); if (!obj) { -#if !defined(FIXME) - if (file && fileno(file) > 2) (void) fclose(file); -#endif return nullptr; } -#if defined(FIXME) js::TypedArrayObject& ta = obj->as(); if (ta.isSharedMemory()) { // Must opt in to use shared memory. For now, don't. @@ -300,13 +291,9 @@ // race-safe primitive to copy memory into the // buffer.) JS_ReportError(cx, "can't read %s: shared memory buffer", pathname); - if (file) (void) fclose(file); return nullptr; } char* buf = static_cast(ta.viewDataUnshared()); -#else/* FIMXME */ - char buf[len]; -#endif /* FIMXME */ size_t cc = fread(buf, 1, len, file); if (cc != len) { JS_ReportError(cx, "can't read %s: %s", pathname, @@ -315,9 +302,6 @@ } } } -#if !defined(FIXME) -if (file && fileno(file) > 2) (void) fclose(file); -#endif return obj; } @@ -415,9 +399,7 @@ JS_ReportError(cx, "can't open %s: %s", filename.ptr(), strerror(errno)); return false; } -#ifdef FIXME AutoCloseFile autoClose(file); -#endif TypedArrayObject* obj = [1].toObject().as(); @@ -426,28 +408,15 @@ // // See further comments in FileAsTypedArray, above. JS_ReportError(cx, "can't write %s: shared memory buffer", filename.ptr()); -#if !defined(FIXME) -if (file && fileno(file) > 2) (void) fclose(file); -#endif return false; } void* buf = obj->viewDataUnshared(); -#ifdef FIXME if (fwrite(buf, obj->bytesPerElement(), obj->length(), file) != obj->length() || !autoClose.release()) { JS_ReportError(cx, "can't write %s", filename.ptr()); return false; } -#else -size_t nw = fwrite(buf, obj->bytesPerElement(), obj->length(), file); -if (file && fileno(file) > 2) (void) fclose(file); -if (nw != obj->length()) -{ -JS_ReportError(cx, "can't write %s", filename.ptr()); -return false; -} -#endif args.rval().setUndefined(); return true; @@ -1590,9 +1559,7 @@ return; } } -#ifdef FIXME AutoCloseFile autoClose(file); -#endif if (!forceTTY && !isatty(fileno(file))) { // It's not interactive - just execute it. @@ -1605,9 +1572,6 @@ MOZ_ASSERT(kind == FileScript); ReadEvalPrintLoop(cx, file, gOutFile, compileOnly); } -#if !defined(FIXME) -if (file && fileno(file) > 2) (void) fclose(file); -#endif } #endif @@ -1691,9 +1655,7 @@ JSSMSG_CANT_OPEN, filename.ptr(), strerror(errno)); return false; } -#ifdef FIXME -AutoCloseFile
[CVS] RPM: rpm-5_4: rpm/rpmio/ rpmjs45.cpp
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 03-Jul-2017 05:41:37 Branch: rpm-5_4 Handle: 2017070303413600 Modified files: (Branch: rpm-5_4) rpm/rpmio rpmjs45.cpp Log: - rpmjs45: WOP. Summary: RevisionChanges Path 1.1.2.16+1007 -63 rpm/rpmio/rpmjs45.cpp patch -p0 <<'@@ .' Index: rpm/rpmio/rpmjs45.cpp $ cvs diff -u -r1.1.2.15 -r1.1.2.16 rpmjs45.cpp --- rpm/rpmio/rpmjs45.cpp 2 Jul 2017 13:58:09 - 1.1.2.15 +++ rpm/rpmio/rpmjs45.cpp 3 Jul 2017 03:41:36 - 1.1.2.16 @@ -8,6 +8,8 @@ #define JS_CODEGEN_X64 1 +#include + #include "mozilla/ArrayUtils.h" #include "mozilla/Atomics.h" #include "mozilla/DebugOnly.h" @@ -319,21 +321,25 @@ return obj; } -#ifdef NOTYET +#if !defined(FIXME) +JSString* +FileAsString(JSContext* cx, const char* pathname); +#endif + static bool ReadFile(JSContext* cx, unsigned argc, Value* vp, bool scriptRelative) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() < 1 || args.length() > 2) { -JS_ReportErrorNumber(cx, js::shell::my_GetErrorMessage, nullptr, +JS_ReportErrorNumber(cx, my_GetErrorMessage, nullptr, args.length() < 1 ? JSSMSG_NOT_ENOUGH_ARGS : JSSMSG_TOO_MANY_ARGS, "snarf"); return false; } if (!args[0].isString() || (args.length() == 2 && !args[1].isString())) { -JS_ReportErrorNumber(cx, js::shell::my_GetErrorMessage, nullptr, JSSMSG_INVALID_ARGS, "snarf"); +JS_ReportErrorNumber(cx, my_GetErrorMessage, nullptr, JSSMSG_INVALID_ARGS, "snarf"); return false; } @@ -367,23 +373,18 @@ args.rval().setString(str); return true; } -#endif -#ifdef NOTYET static bool osfile_readFile(JSContext* cx, unsigned argc, Value* vp) { return ReadFile(cx, argc, vp, false); } -#endif -#ifdef NOTYET static bool osfile_readRelativeToScript(JSContext* cx, unsigned argc, Value* vp) { return ReadFile(cx, argc, vp, true); } -#endif static bool osfile_writeTypedArrayToFile(JSContext* cx, unsigned argc, Value* vp) @@ -498,7 +499,6 @@ return true; } -#ifdef NOTYET static const JSFunctionSpecWithHelp osfile_functions[] = { JS_FN_HELP("readFile", osfile_readFile, 1, 0, "readFile(filename, [\"binary\"])", @@ -512,7 +512,6 @@ JS_FS_HELP_END }; -#endif static const JSFunctionSpecWithHelp osfile_unsafe_functions[] = { JS_FN_HELP("writeTypedArrayToFile", osfile_writeTypedArrayToFile, 2, 0, @@ -650,20 +649,18 @@ // other one returns an integer status code, and always writes the result into // the provided buffer. -#ifdef NOTYET inline char* strerror_message(int result, char* buffer) { return result == 0 ? buffer : nullptr; } -#endif inline char* strerror_message(char* result, char* buffer) { return result; } -#endif +#endif /* !XP_WIN */ static void ReportSysError(JSContext* cx, const char* prefix) @@ -969,7 +966,6 @@ static const double MAX_TIMEOUT_INTERVAL = 1800.0; // Per-runtime shell state. -#ifdef NOTYET struct ShellRuntime { ShellRuntime(); @@ -996,7 +992,6 @@ bool quitting; bool gotError; }; -#endif // Shell state set once at startup. static bool enableCodeCoverage = false; @@ -1119,7 +1114,6 @@ } // extern "C" #endif -#ifdef NOTYET ShellRuntime::ShellRuntime() : isWorker(false), timeoutInterval(-1.0), @@ -1135,9 +1129,7 @@ quitting(false), gotError(false) {} -#endif -#ifdef NOTYET static ShellRuntime* GetShellRuntime(JSRuntime *rt) { @@ -1145,7 +1137,6 @@ MOZ_ASSERT(sr); return sr; } -#endif #ifdef NOTYET static ShellRuntime* @@ -3801,9 +3792,7 @@ } #endif -#ifdef NOTYET VectorworkerThreads; -#endif #ifdef NOTYET static bool @@ -3925,7 +3914,6 @@ } #endif -#ifdef NOTYET static bool InitWatchdog(JSRuntime* rt) { @@ -3944,9 +3932,7 @@ } return false; } -#endif -#ifdef NOTYET static void KillWatchdog(JSRuntime* rt) { @@ -3970,9 +3956,7 @@
[CVS] RPM: rpm-5_4: rpm/rpmio/ rpmjss.inp
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 02-Jul-2017 15:59:58 Branch: rpm-5_4 Handle: 2017070213595700 Modified files: (Branch: rpm-5_4) rpm/rpmio rpmjss.inp Log: - orphan. Summary: RevisionChanges Path 1.1.2.6 +49 -49 rpm/rpmio/rpmjss.inp patch -p0 <<'@@ .' Index: rpm/rpmio/rpmjss.inp $ cvs diff -u -r1.1.2.5 -r1.1.2.6 rpmjss.inp --- rpm/rpmio/rpmjss.inp 2 Jul 2017 12:34:29 - 1.1.2.5 +++ rpm/rpmio/rpmjss.inp 2 Jul 2017 13:59:57 - 1.1.2.6 @@ -14,7 +14,7 @@ load("js/hello.js") loadRelativeToScript("js/hello.js") //evaluate("evaluate") -run("js/hello.js") +//run("js/hello.js") //var foo = readline() print("foo") var foo = "bar" @@ -23,58 +23,58 @@ var foo = "printErr"; printErr(foo) var foo = "putstr"; putstr(foo) dateNow() -//help +//help() var foo = 0; assertEq(foo, foo) -//startTimingMutator -//stopTimingMutator +//startTimingMutator() +//stopTimingMutator() throwError -//disassemble -//dis -//disfile -//dissrc -//notes -//stackDump -//intern -//getslx -//evalcx -//evalInWorker -//getSharedArrayBuffer -//setSharedArrayBuffer -//shapeOf -//arrayInfo -//sleep -//compile -//parseModule -//setModuleResolveHook -//getModuleLoadPath -//parse -//syntaxParse -//offThreadCompileScript -//runOffThreadScript -//timeout -//interruptIf -//invokeInterruptCallback -//setInterruptCallback -//enableLastWarnong -//disableLastWarnong -//clearLastWarnong -//elapsed -//decompileFunction -//decompileThis -//thisFilename -//newGlobal -//nukeCCW +//disassemble() +//dis() +//disfile() +//dissrc() +//notes() +stackDump() +intern("intern") +//getslx() +//evalcx() +//evalInWorker() +//getSharedArrayBuffer() +//setSharedArrayBuffer() +//shapeOf() +//arrayInfo() +//sleep() +//compile() +//parseModule() +//setModuleResolveHook() +//getModuleLoadPath() +//parse() +//syntaxParse() +//offThreadCompileScript() +//runOffThreadScript() +//timeout() +//interruptIf() +//invokeInterruptCallback() +//setInterruptCallback() +//enableLastWarnong() +//disableLastWarnong() +//clearLastWarnong() +elapsed() +//decompileFunction() +//decompileThis() +//thisFilename() +//newGlobal() +//nukeCCW() createMappedArrayBuffer("js/createMappedArrayBuffer") -//getMaxArgs -//objectEmulatingUndefined +getMaxArgs() +objectEmulatingUndefined() isCachingEnabled() -//setCachingEnabled +//setCachingEnabled() cacheEntry("cacheEntry") -//printProfilerEvents -//enableSingleStepProfiling -//disableSingleStepProfiling +//printProfilerEvents() +//enableSingleStepProfiling() +//disableSingleStepProfiling() isLatin1("isLatin1") -//stackPointerInfo -//entryPoints -//require +stackPointerInfo() +//entryPoints() +//require() quit @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: rpm-5_4: rpm/rpmio/ rpmjs45.cpp
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 02-Jul-2017 15:58:09 Branch: rpm-5_4 Handle: 2017070213580900 Modified files: (Branch: rpm-5_4) rpm/rpmio rpmjs45.cpp Log: - rpmjs45: WIP. Summary: RevisionChanges Path 1.1.2.15+115 -124 rpm/rpmio/rpmjs45.cpp patch -p0 <<'@@ .' Index: rpm/rpmio/rpmjs45.cpp $ cvs diff -u -r1.1.2.14 -r1.1.2.15 rpmjs45.cpp --- rpm/rpmio/rpmjs45.cpp 2 Jul 2017 12:34:29 - 1.1.2.14 +++ rpm/rpmio/rpmjs45.cpp 2 Jul 2017 13:58:09 - 1.1.2.15 @@ -25,6 +25,8 @@ #include "jswrapper.h" +#include "vm/TypedArrayObject.h" + using namespace JS; using namespace js; #ifdef NOTYET @@ -61,6 +63,51 @@ }; /*==*/ +static void +rpmjssReportError(JSContext *cx, const char *message, JSErrorReport *report) +{ +fprintf(stderr, "%s:%u:%s\n", + report->filename ? report->filename : "", + (unsigned int) report->lineno, message); +} + +static void +rpmjssOOMCallback(JSContext* cx, void* data) +{ +#ifdef NOTYET +// If a script is running, the engine is about to throw the string "out of +// memory", which may or may not be caught. Otherwise the engine will just +// unwind and return null/false, with no exception set. +if (!JS_IsRunning(cx)) +GetShellRuntime(cx)->gotError = true; +#endif +} + +enum JSShellErrNum { +#define MSG_DEF(name, count, exception, format) \ +name, +#include "jsshell.msg" +#undef MSG_DEF +JSShellErr_Limit +}; + +static const JSErrorFormatString jsShell_ErrorFormatString[JSShellErr_Limit] = { +#define MSG_DEF(name, count, exception, format) \ +{ format, count, JSEXN_ERR } , +#include "jsshell.msg" +#undef MSG_DEF +}; + +const JSErrorFormatString* +my_GetErrorMessage(void* userRef, const unsigned errorNumber) +{ +if (errorNumber == 0 || errorNumber >= JSShellErr_Limit) +return nullptr; + +return _ErrorFormatString[errorNumber]; +} + +/*==*/ enum PathResolutionMode {/* XXX shell/OSObject.h */ RootRelative, ScriptRelative @@ -161,7 +208,6 @@ * command line.) Otherwise, it will be relative to the current working * directory. */ -#ifndef NOTYET JSString* ResolvePath(JSContext* cx, HandleString filenameStr, PathResolutionMode resolveMode) { @@ -211,9 +257,7 @@ return JS_NewStringCopyZ(cx, buffer); } -#endif -#ifdef NOTYET static JSObject* FileAsTypedArray(JSContext* cx, const char* pathname) { @@ -270,11 +314,10 @@ } } #if !defined(FIXME) -if (file) (void) fclose(file); +if (file && fileno(file) > 2) (void) fclose(file); #endif return obj; } -#endif #ifdef NOTYET static bool @@ -283,18 +326,14 @@ CallArgs args = CallArgsFromVp(argc, vp); if (args.length() < 1 || args.length() > 2) { -#ifdef FIXME JS_ReportErrorNumber(cx, js::shell::my_GetErrorMessage, nullptr, args.length() < 1 ? JSSMSG_NOT_ENOUGH_ARGS : JSSMSG_TOO_MANY_ARGS, "snarf"); -#endif return false; } if (!args[0].isString() || (args.length() == 2 && !args[1].isString())) { -#ifdef FIXME JS_ReportErrorNumber(cx, js::shell::my_GetErrorMessage, nullptr, JSSMSG_INVALID_ARGS, "snarf"); -#endif return false; } @@ -346,7 +385,6 @@ } #endif -#ifdef NOTYET static bool osfile_writeTypedArrayToFile(JSContext* cx, unsigned argc, Value* vp) { @@ -376,7 +414,9 @@ JS_ReportError(cx, "can't open %s: %s", filename.ptr(), strerror(errno)); return false; } +#ifdef FIXME AutoCloseFile autoClose(file); +#endif TypedArrayObject* obj = [1].toObject().as(); @@ -385,22 +425,33 @@ // // See further comments in FileAsTypedArray, above. JS_ReportError(cx, "can't write %s: shared memory buffer", filename.ptr()); +#if !defined(FIXME) +if (file && fileno(file) > 2) (void) fclose(file); +#endif return false; } void* buf = obj->viewDataUnshared(); +#ifdef FIXME if (fwrite(buf,
[CVS] RPM: rpm-5_4: rpm/rpmio/ Makefile.am rpmjs45.cpp rpmjss.inp
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 02-Jul-2017 14:34:30 Branch: rpm-5_4 Handle: 2017070212342900 Modified files: (Branch: rpm-5_4) rpm/rpmio Makefile.am rpmjs45.cpp rpmjss.inp Log: - r[pmjs45: WIP. Summary: RevisionChanges Path 1.293.2.103 +1 -1 rpm/rpmio/Makefile.am 1.1.2.14+4263 -183 rpm/rpmio/rpmjs45.cpp 1.1.2.5 +64 -2 rpm/rpmio/rpmjss.inp patch -p0 <<'@@ .' Index: rpm/rpmio/Makefile.am $ cvs diff -u -r1.293.2.102 -r1.293.2.103 Makefile.am --- rpm/rpmio/Makefile.am 28 Jun 2017 09:54:15 - 1.293.2.102 +++ rpm/rpmio/Makefile.am 2 Jul 2017 12:34:29 - 1.293.2.103 @@ -575,7 +575,7 @@ rpmjs38_LDADD = -L/usr/lib64 -lmozjs-38 $(RPMIO_LDADD_COMMON) rpmjs45_SOURCES = rpmjs45.cpp -rpmjs45_CPPFLAGS = -include /usr/include/mozjs-45/js/RequiredDefines.h -I/usr/include/mozjs-45 -I/F/mozjs45/firefox-45.9.0esr/js/src -fPIC -DRPMJSS_SELF_TEST +rpmjs45_CPPFLAGS = -include /usr/include/mozjs-45/js/RequiredDefines.h -I/usr/include/mozjs-45 -I./js45/src/shell -I./js45/src -DXP_UNIX -fPIC -DRPMJSS_SELF_TEST rpmjs45_LDADD = -L/usr/lib64 -lmozjs-45 $(RPMIO_LDADD_COMMON) mozjs: rpmjs185 rpmjs17 rpmjs24 rpmjs31 rpmjs38 rpmjs45 @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmjs45.cpp $ cvs diff -u -r1.1.2.13 -r1.1.2.14 rpmjs45.cpp --- rpm/rpmio/rpmjs45.cpp 1 Jul 2017 04:00:07 - 1.1.2.13 +++ rpm/rpmio/rpmjs45.cpp 2 Jul 2017 12:34:29 - 1.1.2.14 @@ -46,84 +46,6 @@ #include "debug.h" -/*==*/ -typedef struct JSI_s * JSI_t; -struct JSI_s { -JSRuntime*rt; -JSContext*cx; -JSObject *global; -}; - -// Shell state set once at startup. -static bool enableCodeCoverage = false; -static bool enableDisassemblyDumps = false; -static bool offthreadCompilation = false; -static bool enableBaseline = false; -static bool enableIon = false; -static bool enableAsmJS = false; -static bool enableNativeRegExp = false; -static bool enableUnboxedArrays = false; -#ifdef JS_GC_ZEAL -static char gZealStr[128]; -#endif -static bool printTiming = false; -static const char* jsCacheDir = nullptr; -static const char* jsCacheAsmJSPath = nullptr; -static bool reportWarnings = true; -static bool compileOnly = false; -static bool fuzzingSafe = false; -static bool disableOOMFunctions = false; -static const char* moduleLoadPath = "."; - -#ifdef DEBUG -static bool dumpEntrainedVariables = false; -static bool OOM_printAllocationCount = false; -#endif - -/*==*/ -static bool -global_enumerate(JSContext* cx, HandleObject obj) -{ -#ifdef LAZY_STANDARD_CLASSES -return JS_EnumerateStandardClasses(cx, obj); -#else -return true; -#endif -} - -static bool -global_resolve(JSContext* cx, HandleObject obj, HandleId id, bool* resolvedp) -{ -#ifdef LAZY_STANDARD_CLASSES -if (!JS_ResolveStandardClass(cx, obj, id, resolvedp)) -return false; -#endif -return true; -} - -static bool -global_mayResolve(const JSAtomState& names, jsid id, JSObject* maybeObj) -{ -return JS_MayResolveStandardClass(names, id, maybeObj); -} - -static JSClass global_class = { -"global", -JSCLASS_GLOBAL_FLAGS, -nullptr, -nullptr, -nullptr, -nullptr, -global_enumerate, -global_resolve, -global_mayResolve, -nullptr, -nullptr, -nullptr, -nullptr, -JS_GlobalObjectTraceHook -}; - static int rpmjss_nopens; static int _rpmjss45_debug; @@ -131,51 +53,13 @@ if (_rpmjss45_debug) \ fprintf(stderr, _fmt, __VA_ARGS__) -/*==*/ -static void -rpmjssReportError(JSContext *cx, const char *message, JSErrorReport *report) -{ -fprintf(stderr, "%s:%u:%s\n", - report->filename ? report->filename : "", - (unsigned int) report->lineno, message); -} - -static void -rpmjssOOMCallback(JSContext* cx, void* data) -{ -#ifdef NOTYET -// If a script is running, the engine is about to throw the string "out of -// memory", which may or may not be caught. Otherwise the engine will