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 11:58:53 Branch: rpm-5_4 Handle: 2017070309585200 Modified files: (Branch: rpm-5_4) rpm/rpmio rpmjs45.cpp rpmjss.inp Log: - rpmjs45: WIP. Summary: Revision Changes Path 1.1.2.19 +69 -47 rpm/rpmio/rpmjs45.cpp 1.1.2.8 +2 -2 rpm/rpmio/rpmjss.inp ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/rpmio/rpmjs45.cpp ============================================================================ $ cvs diff -u -r1.1.2.18 -r1.1.2.19 rpmjs45.cpp --- rpm/rpmio/rpmjs45.cpp 3 Jul 2017 08:06:01 -0000 1.1.2.18 +++ rpm/rpmio/rpmjs45.cpp 3 Jul 2017 09:58:52 -0000 1.1.2.19 @@ -113,7 +113,7 @@ /*==============================================================*/ static void -rpmjssReportError(JSContext *cx, const char *message, JSErrorReport *report) +my_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report) { fprintf(stderr, "%s:%u:%s\n", report->filename ? report->filename : "<no filename=\"filename\">", @@ -1390,7 +1390,6 @@ return Evaluate(cx, options, src, srcLen, &rv); } -#ifdef NOTYET static bool GetLoaderObject(JSContext* cx, MutableHandleObject resultOut) { @@ -1409,7 +1408,6 @@ resultOut.set(&value.toObject()); return true; } -#endif static bool GetImportMethod(JSContext* cx, HandleObject loader, MutableHandleFunction resultOut) @@ -1428,7 +1426,6 @@ return true; } -#ifdef NOTYET static void RunModule(JSContext* cx, const char* filename, FILE* file, bool compileOnly) { @@ -1452,7 +1449,6 @@ return; } } -#endif static bool EvalAndPrint(JSContext* cx, const char* bytes, size_t length, @@ -1489,7 +1485,6 @@ return true; } -#ifdef NOTYET static void ReadEvalPrintLoop(JSContext* cx, FILE* in, FILE* out, bool compileOnly) { @@ -1545,7 +1540,6 @@ fprintf(out, "\n"); } -#endif enum FileKind { @@ -1553,7 +1547,6 @@ FileModule }; -#ifdef NOTYET static void Process(JSContext* cx, const char* filename, bool forceTTY, FileKind kind = FileScript) { @@ -1568,7 +1561,7 @@ return; } } - AutoCloseFile autoClose(file); + js::shell::AutoCloseFile autoClose(file); if (!forceTTY && !isatty(fileno(file))) { // It's not interactive - just execute it. @@ -1582,7 +1575,6 @@ ReadEvalPrintLoop(cx, file, gOutFile, compileOnly); } } -#endif static bool Version(JSContext* cx, unsigned argc, Value* vp) @@ -1884,7 +1876,6 @@ return true; } -#ifndef NOTYET class AutoNewContext { private: @@ -1927,7 +1918,6 @@ } } }; -#endif static void my_LargeAllocFailCallback(void* data) @@ -2042,7 +2032,7 @@ } }; -#ifdef NOTYET +#ifndef NOTYET static bool Evaluate(JSContext* cx, unsigned argc, Value* vp) { @@ -2168,9 +2158,15 @@ } } +#ifdef FIXME AutoStableStringChars codeChars(cx); if (!codeChars.initTwoByte(cx, code)) return false; +#else + JSAutoByteString chars(cx, code); + if (!chars) + return false; +#endif AutoNewContext ancx; if (newContext) { @@ -2185,7 +2181,9 @@ ScopedJSFreePtr<uint8_t> saveBuffer; if (loadBytecode) { +#ifdef FIXME loadBuffer = CacheEntry_getBytecode(cacheEntry, &loadLength); +#endif if (!loadBuffer) return false; } @@ -2213,14 +2211,19 @@ if (loadBytecode) { script = JS_DecodeScript(cx, loadBuffer, loadLength); } else { +#ifdef FIXME mozilla::Range<const char16_t> chars = codeChars.twoByteRange(); (void) JS::Compile(cx, options, chars.start().get(), chars.length(), &script); +#else + (void) JS::Compile(cx, options, chars.ptr(), chars.length(), &script); +#endif } if (!script) return false; } +#ifdef FIXME if (displayURL && !script->scriptSource()->hasDisplayURL()) { JSFlatString* flat = displayURL->ensureFlat(cx); if (!flat) @@ -2247,6 +2250,7 @@ if (!script->scriptSource()->setSourceMapURL(cx, smurl)) return false; } +#endif if (!JS_ExecuteScript(cx, script, args.rval())) { if (catchTermination && !JS_IsExceptionPending(cx)) { JSAutoCompartment ac1(cx, callerGlobal); @@ -2288,8 +2292,10 @@ } } +#ifdef FIXME if (!CacheEntry_setBytecode(cx, cacheEntry, saveBuffer, saveLength)) return false; +#endif saveBuffer.forget(); } @@ -2349,7 +2355,7 @@ * are closely modelled after the equivalent function in WebKit, as this is used * to produce benchmark timings by SunSpider. */ -#ifdef NOTYET +#ifndef NOTYET static bool Run(JSContext* cx, unsigned argc, Value* vp) { @@ -2371,12 +2377,21 @@ if (!str) return false; +#ifdef FIXME AutoStableStringChars chars(cx); if (!chars.initTwoByte(cx, str)) return false; const char16_t* ucbuf = chars.twoByteRange().start().get(); size_t buflen = str->length(); +#else + JSAutoByteString chars(cx, str); + if (!chars) + return false; + + const char * buf = chars.ptr(); + size_t buflen = chars.length(); +#endif RootedScript script(cx); #ifdef FIXME @@ -2392,8 +2407,13 @@ .setFileAndLine(filename.ptr(), 1) .setIsRunOnce(true) .setNoScriptRval(true); +#ifdef FIXME if (!JS_CompileUCScript(cx, ucbuf, buflen, options, &script)) return false; +#else + if (!JS_CompileScript(cx, buf, buflen, options, &script)) + return false; +#endif } if (!JS_ExecuteScript(cx, script)) @@ -3394,7 +3414,7 @@ #endif /* DEBUG */ -#ifdef NOTYET +#ifndef NOTYET static bool Intern(JSContext* cx, unsigned argc, Value* vp) { @@ -3417,7 +3437,7 @@ } #endif -#ifdef NOTYET +#ifndef NOTYET static bool Clone(JSContext* cx, unsigned argc, Value* vp) { @@ -3469,7 +3489,7 @@ } #endif -#ifdef NOTYET +#ifndef NOTYET static bool GetSLX(JSContext* cx, unsigned argc, Value* vp) { @@ -3660,7 +3680,7 @@ static void SetWorkerRuntimeOptions(JSRuntime* rt); -#ifdef NOTYET +#ifndef NOTYET static void WorkerMain(void* arg) { @@ -3732,7 +3752,7 @@ Vector<PRThread*, 0, SystemAllocPolicy> workerThreads; -#ifdef NOTYET +#ifndef NOTYET static bool EvalInWorker(JSContext* cx, unsigned argc, Value* vp) { @@ -3771,7 +3791,7 @@ } #endif -#ifdef NOTYET +#ifndef NOTYET static bool ShapeOf(JSContext* cx, unsigned argc, JS::Value* vp) { @@ -4024,7 +4044,7 @@ return true; } -#ifdef NOTYET +#ifndef NOTYET static bool Timeout(JSContext* cx, unsigned argc, Value* vp) { @@ -4133,7 +4153,7 @@ } #endif -#ifdef NOTYET +#ifndef NOTYET static bool EnableLastWarning(JSContext* cx, unsigned argc, Value* vp) { @@ -4148,7 +4168,7 @@ } #endif -#ifdef NOTYET +#ifndef NOTYET static bool DisableLastWarning(JSContext* cx, unsigned argc, Value* vp) { @@ -4163,7 +4183,7 @@ } #endif -#ifdef NOTYET +#ifndef NOTYET static bool GetLastWarning(JSContext* cx, unsigned argc, Value* vp) { @@ -4183,7 +4203,7 @@ } #endif -#ifdef NOTYET +#ifndef NOTYET static bool ClearLastWarning(JSContext* cx, unsigned argc, Value* vp) { @@ -4202,7 +4222,7 @@ } #endif -#ifdef NOTYET +#ifndef NOTYET static bool StackDump(JSContext* cx, unsigned argc, Value* vp) { @@ -4390,7 +4410,7 @@ return true; } -#ifdef NOTYET +#ifndef NOTYET static bool Parse(JSContext* cx, unsigned argc, Value* vp) { @@ -4667,7 +4687,7 @@ return true; } -#ifdef NOTYET +#ifndef NOTYET static bool runOffThreadScript(JSContext* cx, unsigned argc, Value* vp) { @@ -4879,7 +4899,7 @@ return true; } -#ifdef NOTYET +#ifndef NOTYET static bool DecompileFunction(JSContext* cx, unsigned argc, Value* vp) { @@ -4897,7 +4917,7 @@ } #endif -#ifdef NOTYET +#ifndef NOTYET static bool DecompileThisScript(JSContext* cx, unsigned argc, Value* vp) { @@ -5029,7 +5049,7 @@ } #endif -#ifdef NOTYET +#ifndef NOTYET static bool NukeCCW(JSContext* cx, unsigned argc, Value* vp) { @@ -5338,7 +5358,7 @@ PR_DestroyLock(sharedArrayBufferMailboxLock); } -#ifdef NOTYET +#ifndef NOTYET static bool GetSharedArrayBuffer(JSContext* cx, unsigned argc, Value* vp) { @@ -5363,7 +5383,7 @@ } #endif -#ifdef NOTYET +#ifndef NOTYET static bool SetSharedArrayBuffer(JSContext* cx, unsigned argc, Value* vp) { @@ -5393,7 +5413,7 @@ } #endif -#ifdef NOTYET +#ifndef NOTYET class SprintOptimizationTypeInfoOp : public JS::ForEachTrackedOptimizationTypeInfoOp { Sprinter* sp; @@ -5442,7 +5462,7 @@ }; #endif -#ifdef NOTYET +#ifndef NOTYET class SprintOptimizationAttemptsOp : public JS::ForEachTrackedOptimizationAttemptOp { Sprinter* sp; @@ -5459,7 +5479,7 @@ }; #endif -#ifdef NOTYET +#ifndef NOTYET static bool ReflectTrackedOptimizations(JSContext* cx, unsigned argc, Value* vp) { @@ -5569,7 +5589,7 @@ } #endif -#ifdef NOTYET +#ifndef NOTYET #ifdef DEBUG static bool DumpStaticScopeChain(JSContext* cx, unsigned argc, Value* vp) @@ -5687,7 +5707,7 @@ } // namespace shell } // namespace js -#ifdef NOTYET +#ifndef NOTYET static bool EntryPoints(JSContext* cx, unsigned argc, Value* vp) { @@ -5820,10 +5840,8 @@ JS_FN("options", Options, 0,0), JS_FN("load", Load, 1,0), JS_FN("loadRelativeToScript", LoadScriptRelativeToScript, 1,0), -#ifdef NOTYET JS_FN("evaluate", Evaluate, 2,0), JS_FN("run", Run, 1,0), -#endif /* NOTYET */ JS_FN("readline", ReadLine, 0,0), JS_FN("print", Print, 0,0), JS_FN("printErr", PrintErr, 0,0), @@ -6303,7 +6321,7 @@ #endif /* NOTYET */ /*==============================================================*/ -#ifdef NOTYET +#ifndef NOTYET static const JSFunctionSpecWithHelp console_functions[] = { JS_FN_HELP("log", Print, 0, 0, "log([exp ...])", @@ -6313,7 +6331,7 @@ }; #endif -#ifdef NOTYET +#ifndef NOTYET bool DefineConsole(JSContext* cx, HandleObject global) { @@ -6324,7 +6342,7 @@ } #endif -#ifdef NOTYET +#ifndef NOTYET #ifdef MOZ_PROFILING # define PROFILING_FUNCTION_COUNT 5 # ifdef MOZ_CALLGRIND @@ -7160,14 +7178,18 @@ #ifdef FIXME if (!js::DefineTestingFunctions(cx, glob, fuzzingSafe, disableOOMFunctions)) return nullptr; +#endif if (!fuzzingSafe) { +#ifdef FIXME if (!JS_DefineFunctionsWithHelp(cx, glob, fuzzing_unsafe_functions)) return nullptr; +#endif if (!DefineConsole(cx, glob)) return nullptr; } +#ifdef FIXME if (!DefineOS(cx, glob, fuzzingSafe)) return nullptr; #endif @@ -7867,7 +7889,7 @@ /*==============================================================*/ -#ifdef NOTYET +#ifndef NOTYET static bool BindScriptArgs(JSContext* cx, OptionParser* op) { @@ -7915,7 +7937,7 @@ return false; } -#ifdef NOTYET +#ifndef NOTYET static int ProcessArgs(JSContext* cx, OptionParser* op) { @@ -8269,7 +8291,7 @@ JS_SetNativeStackQuota(rt, gMaxStackSize); } -#ifdef NOTYET +#ifndef NOTYET static int Shell(JSContext* cx, OptionParser* op, char** envp) { @@ -8397,7 +8419,7 @@ JS_SetRuntimePrivate(rt, (void *)jss); I->rt = rt; - JS_SetErrorReporter(rt, rpmjssReportError); + JS_SetErrorReporter(rt, my_ErrorReporter); JS::SetOutOfMemoryCallback(rt, my_OOMCallback, nullptr); // XXX SetRuntimeOptions(rt, op); @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmjss.inp ============================================================================ $ cvs diff -u -r1.1.2.7 -r1.1.2.8 rpmjss.inp --- rpm/rpmio/rpmjss.inp 3 Jul 2017 08:06:01 -0000 1.1.2.7 +++ rpm/rpmio/rpmjss.inp 3 Jul 2017 09:58:52 -0000 1.1.2.8 @@ -13,8 +13,8 @@ options() load("js/hello.js") loadRelativeToScript("js/hello.js") -//evaluate("evaluate") -//run("js/hello.js") +evaluate("version();") +run("js/hello.js") //var foo = readline() print("foo") var foo = "bar" @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org