Bug 979730 part 2 - Remove saveFrameChain option from evaluate(). r=luke
authorJan de Mooij <jdemooij@mozilla.com>
Fri, 27 May 2016 17:57:39 +0200
changeset 340369 d835e1ad42221c0d52aa434c8efdcc06d17813cd
parent 340368 d2f18efe44a37ee8746041c3f4aaa59bfef217c8
child 340370 b1a9f082d0ae4a34f63f27202ff8c146bd38a54c
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs979730
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 979730 part 2 - Remove saveFrameChain option from evaluate(). r=luke
js/src/jit-test/tests/basic/bug876226.js
js/src/jit-test/tests/basic/bug877378.js
js/src/jit-test/tests/basic/bug882416.js
js/src/jit-test/tests/basic/save-frame-chain.js
js/src/shell/js.cpp
--- a/js/src/jit-test/tests/basic/bug876226.js
+++ b/js/src/jit-test/tests/basic/bug876226.js
@@ -1,11 +1,8 @@
 // |jit-test| error: SyntaxError
 try {
     evaluate("throw 3", {
 	newContext: new Set,
-	saveFrameChain: true
     });
 } catch(e) {}
 
-evaluate("()", {
-    saveFrameChain: true
-});
+evaluate("()", {});
--- a/js/src/jit-test/tests/basic/bug877378.js
+++ b/js/src/jit-test/tests/basic/bug877378.js
@@ -1,19 +1,18 @@
 evalcx("\
     let z = 'x';\
     for (var v of z) {\
         y = evaluate(\"Object.defineProperty(this,\\\"y\\\",\
                          {get:  function() {}}\
                     );\",\
-               {catchTermination: true, saveFrameChain: true}\
+               {catchTermination: true}\
         );\
     }",
     newGlobal('')
 )
 
 evalcx("\
     for (x = 0; x < 1; ++x) { \
         v = evaluate(\"gc\",{ \
-            saveFrameChain: true \
         })\
     }\
 ", newGlobal(''));
--- a/js/src/jit-test/tests/basic/bug882416.js
+++ b/js/src/jit-test/tests/basic/bug882416.js
@@ -1,6 +1,5 @@
 // |jit-test| error: SyntaxError
 Error.prototype.toString = Function;
 evaluate("n f", {
     noScriptRval: true,
-    saveFrameChain: true
 });
deleted file mode 100644
--- a/js/src/jit-test/tests/basic/save-frame-chain.js
+++ /dev/null
@@ -1,15 +0,0 @@
-// Error().stack (ScriptFrameIter) should see through JS_SaveFrameChain.
-function gamma() {
-    stack = Error().stack;
-}
-function beta() {
-    evaluate("gamma()", {saveFrameChain: true});
-}
-function alpha() {
-    beta();
-}
-alpha();
-
-assertEq(/alpha/.test(stack), true);
-assertEq(/beta/.test(stack), true);
-assertEq(/gamma/.test(stack), true);
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -1329,40 +1329,16 @@ CacheEntry_setBytecode(JSContext* cx, Ha
     Rooted<ArrayBufferObject*> arrayBuffer(cx, ArrayBufferObject::create(cx, length, contents));
     if (!arrayBuffer)
         return false;
 
     SetReservedSlot(cache, CacheEntry_BYTECODE, ObjectValue(*arrayBuffer));
     return true;
 }
 
-class AutoSaveFrameChain
-{
-    JSContext* cx_;
-    bool saved_;
-
-  public:
-    explicit AutoSaveFrameChain(JSContext* cx)
-      : cx_(cx),
-        saved_(false)
-    {}
-
-    bool save() {
-        if (!JS_SaveFrameChain(cx_))
-            return false;
-        saved_ = true;
-        return true;
-    }
-
-    ~AutoSaveFrameChain() {
-        if (saved_)
-            JS_RestoreFrameChain(cx_);
-    }
-};
-
 static bool
 Evaluate(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     if (args.length() < 1 || args.length() > 2) {
         JS_ReportErrorNumber(cx, my_GetErrorMessage, nullptr,
                              args.length() < 1 ? JSSMSG_NOT_ENOUGH_ARGS : JSSMSG_TOO_MANY_ARGS,
@@ -1386,17 +1362,16 @@ Evaluate(JSContext* cx, unsigned argc, V
 
     CompileOptions options(cx);
     JSAutoByteString fileNameBytes;
     bool newContext = false;
     RootedString displayURL(cx);
     RootedString sourceMapURL(cx);
     RootedObject global(cx, nullptr);
     bool catchTermination = false;
-    bool saveFrameChain = false;
     bool loadBytecode = false;
     bool saveBytecode = false;
     bool assertEqBytecode = false;
     RootedObject callerGlobal(cx, cx->global());
 
     options.setIntroductionType("js shell evaluate")
            .setFileAndLine("@evaluate", 1);
 
@@ -1447,21 +1422,16 @@ Evaluate(JSContext* cx, unsigned argc, V
             }
         }
 
         if (!JS_GetProperty(cx, opts, "catchTermination", &v))
             return false;
         if (!v.isUndefined())
             catchTermination = ToBoolean(v);
 
-        if (!JS_GetProperty(cx, opts, "saveFrameChain", &v))
-            return false;
-        if (!v.isUndefined())
-            saveFrameChain = ToBoolean(v);
-
         if (!JS_GetProperty(cx, opts, "loadBytecode", &v))
             return false;
         if (!v.isUndefined())
             loadBytecode = ToBoolean(v);
 
         if (!JS_GetProperty(cx, opts, "saveBytecode", &v))
             return false;
         if (!v.isUndefined())
@@ -1501,20 +1471,16 @@ Evaluate(JSContext* cx, unsigned argc, V
 
     if (loadBytecode) {
         loadBuffer = CacheEntry_getBytecode(cacheEntry, &loadLength);
         if (!loadBuffer)
             return false;
     }
 
     {
-        AutoSaveFrameChain asfc(cx);
-        if (saveFrameChain && !asfc.save())
-            return false;
-
         JSAutoCompartment ac(cx, global);
         RootedScript script(cx);
 
         {
             if (saveBytecode) {
                 if (!JS::CompartmentCreationOptionsRef(cx).cloneSingletons()) {
                     JS_ReportErrorNumber(cx, my_GetErrorMessage, nullptr,
                                          JSSMSG_CACHE_SINGLETON_FAILED);
@@ -5295,18 +5261,16 @@ static const JSFunctionSpecWithHelp shel
 "  options is an optional object that may have these properties:\n"
 "      isRunOnce: use the isRunOnce compiler option (default: false)\n"
 "      noScriptRval: use the no-script-rval compiler option (default: false)\n"
 "      fileName: filename for error messages and debug info\n"
 "      lineNumber: starting line number for error messages and debug info\n"
 "      columnNumber: starting column number for error messages and debug info\n"
 "      global: global in which to execute the code\n"
 "      newContext: if true, create and use a new cx (default: false)\n"
-"      saveFrameChain: if true, save the frame chain before evaluating code\n"
-"         and restore it afterwards\n"
 "      catchTermination: if true, catch termination (failure without\n"
 "         an exception value, as for slow scripts or out-of-memory)\n"
 "         and return 'terminated'\n"
 "      element: if present with value |v|, convert |v| to an object |o| and\n"
 "         mark the source as being attached to the DOM element |o|. If the\n"
 "         property is omitted or |v| is null, don't attribute the source to\n"
 "         any DOM element.\n"
 "      elementAttributeName: if present and not undefined, the name of\n"