Fixup kludge, don't clone global object, bug 608746.
authorBrian Hackett <bhackett1024@gmail.com>
Mon, 01 Nov 2010 10:09:04 -0700
changeset 74603 d4258341de5ce74ac382429c6ee473d5657efbe7
parent 74602 a2e6ee94f4bfa85ac6e30d7f9f828483bcb0bc14
child 74604 5cc1cd687ef9f35ffc30efafa5c49c40ee29d323
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
bugs608746
milestone2.0b8pre
Fixup kludge, don't clone global object, bug 608746.
js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -448,33 +448,21 @@ Process(JSContext *cx, JSObject *obj, ch
         script = JS_CompileFileHandle(cx, obj, filename, file);
         JS_SetOptions(cx, oldopts);
         if (script) {
             if (!compileOnly) {
 #ifdef JS_TYPE_INFERENCE
                 if (enableTraceJit || enableMethodJit) {
                     /*
                      * Disable the jits and run the script under the interpreter
-                     * first to pick up any dynamic types.  This is code is temporary
+                     * first to pick up any dynamic types.  This only works if the
+                     * global script is idempotent.  This is code is temporary
                      * until recompilation works :FIXME: bug 608746
                      */
 
-                    /* Clone the global object for the second run. */
-                    JSObject *nobj = JS_NewGlobalObject(cx, obj->getJSClass());
-                    if (!nobj || !nobj->ensureSlots(cx, obj->numSlots()))
-                        return;
-                    memcpy(nobj->getSlots(), obj->getSlots(), obj->numSlots() * sizeof(Value));
-                    nobj->lastProp = obj->lastProp;
-                    nobj->objShape = obj->objShape;
-                    nobj->proto = obj->proto;
-                    JS_ASSERT(nobj->flags == obj->flags);
-                    JS_ASSERT(!nobj->parent && !obj->parent);
-                    JS_ASSERT(!nobj->privateData && !obj->privateData);
-                    JS_ASSERT(obj == cx->globalObject);
-
                     if (enableTraceJit)
                         JS_ToggleOptions(cx, JSOPTION_JIT);
                     if (enableMethodJit)
                         JS_ToggleOptions(cx, JSOPTION_METHODJIT);
 
                     printf("Running interpreter...\n");
 
                     (void)JS_ExecuteScript(cx, obj, script, NULL);