Bug 1090491 part 4 - Refactor InterpreterFrame::markValues to be more like the BaselineFrame code. r=wingo
authorJan de Mooij <jdemooij@mozilla.com>
Tue, 04 Nov 2014 14:44:38 +0100
changeset 213921 e3a2c467103bc84efca6a5331d910416705f2461
parent 213920 1dd40ce6fc5a3774ecf69536b9b240135ffd6f2f
child 213922 0c13267c53abb10c9a5d863f88ea8fea321c2229
push id27768
push userkwierso@gmail.com
push dateWed, 05 Nov 2014 02:19:03 +0000
treeherdermozilla-central@a1823d3c7365 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswingo
bugs1090491
milestone36.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 1090491 part 4 - Refactor InterpreterFrame::markValues to be more like the BaselineFrame code. r=wingo
js/src/jit/BaselineFrame.cpp
js/src/vm/Stack.cpp
--- a/js/src/jit/BaselineFrame.cpp
+++ b/js/src/jit/BaselineFrame.cpp
@@ -56,20 +56,19 @@ BaselineFrame::trace(JSTracer *trc, JitF
 
     // Mark locals and stack values.
     JSScript *script = this->script();
     size_t nfixed = script->nfixed();
     size_t nlivefixed = script->nbodyfixed();
 
     if (nfixed != nlivefixed) {
         jsbytecode *pc;
-        NestedScopeObject *staticScope;
+        frameIterator.baselineScriptAndPc(nullptr, &pc);
 
-        frameIterator.baselineScriptAndPc(nullptr, &pc);
-        staticScope = script->getStaticScope(pc);
+        NestedScopeObject *staticScope = script->getStaticScope(pc);
         while (staticScope && !staticScope->is<StaticBlockObject>())
             staticScope = staticScope->enclosingNestedScope();
 
         if (staticScope) {
             StaticBlockObject &blockObj = staticScope->as<StaticBlockObject>();
             nlivefixed = blockObj.localOffset() + blockObj.numVariables();
         }
     }
--- a/js/src/vm/Stack.cpp
+++ b/js/src/vm/Stack.cpp
@@ -338,31 +338,33 @@ InterpreterFrame::markValues(JSTracer *t
         gc::MarkValueRootRange(trc, end - start, slots() + start, "vm_stack");
 }
 
 void
 InterpreterFrame::markValues(JSTracer *trc, Value *sp, jsbytecode *pc)
 {
     MOZ_ASSERT(sp >= slots());
 
-    NestedScopeObject *staticScope;
+    JSScript *script = this->script();
+    size_t nfixed = script->nfixed();
+    size_t nlivefixed = script->nbodyfixed();
 
-    staticScope = script()->getStaticScope(pc);
-    while (staticScope && !staticScope->is<StaticBlockObject>())
-        staticScope = staticScope->enclosingNestedScope();
+    if (nfixed != nlivefixed) {
+        NestedScopeObject *staticScope = script->getStaticScope(pc);
+        while (staticScope && !staticScope->is<StaticBlockObject>())
+            staticScope = staticScope->enclosingNestedScope();
 
-    size_t nfixed = script()->nfixed();
-    size_t nlivefixed;
+        if (staticScope) {
+            StaticBlockObject &blockObj = staticScope->as<StaticBlockObject>();
+            nlivefixed = blockObj.localOffset() + blockObj.numVariables();
+        }
+    }
 
-    if (staticScope) {
-        StaticBlockObject &blockObj = staticScope->as<StaticBlockObject>();
-        nlivefixed = blockObj.localOffset() + blockObj.numVariables();
-    } else {
-        nlivefixed = script()->nbodyfixed();
-    }
+    MOZ_ASSERT(nlivefixed <= nfixed);
+    MOZ_ASSERT(nlivefixed >= script->nbodyfixed());
 
     if (nfixed == nlivefixed) {
         // All locals are live.
         markValues(trc, 0, sp - slots());
     } else {
         // Mark operand stack.
         markValues(trc, nfixed, sp - slots());