Bug 713944 - Move some declarations down to uses in fill(). r=sparky
authorJeff Walden <jwalden@mit.edu>
Thu, 29 Dec 2011 05:44:08 -0600
changeset 83595 656af9b2d4817739d1eed19c6ef3e6f1d022f95c
parent 83594 35124605e1a3bb588ce15a28af9ef27b64e61a4a
child 83596 a258a0b2d9e4093ae1844ba4733e1010054b5fa7
push id4490
push userjwalden@mit.edu
push dateSat, 31 Dec 2011 01:48:10 +0000
treeherdermozilla-inbound@a258a0b2d9e4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssparky
bugs713944
milestone12.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 713944 - Move some declarations down to uses in fill(). r=sparky
js/src/jspropertycache.cpp
--- a/js/src/jspropertycache.cpp
+++ b/js/src/jspropertycache.cpp
@@ -45,20 +45,16 @@
 #include "jspropertycacheinlines.h"
 
 using namespace js;
 
 JS_REQUIRES_STACK PropertyCacheEntry *
 PropertyCache::fill(JSContext *cx, JSObject *obj, uintN scopeIndex, JSObject *pobj,
                     const Shape *shape)
 {
-    JSOp op;
-    const JSCodeSpec *cs;
-    PropertyCacheEntry *entry;
-
     JS_ASSERT(this == &JS_PROPERTY_CACHE(cx));
     JS_ASSERT(!cx->runtime->gcRunning);
 
     /*
      * Check for fill from js_SetPropertyHelper where the setter removed shape
      * from pobj (via unwatch or delete, e.g.).
      */
     if (!pobj->nativeContains(cx, *shape)) {
@@ -80,17 +76,16 @@ PropertyCache::fill(JSContext *cx, JSObj
     JS_ASSERT_IF(obj == pobj, scopeIndex == 0);
 
     JSObject *tmp = obj;
     for (uintN i = 0; i < scopeIndex; i++)
         tmp = tmp->internalScopeChain();
 
     uintN protoIndex = 0;
     while (tmp != pobj) {
-
         /*
          * Don't cache entries across prototype lookups which can mutate in
          * arbitrary ways without a shape change.
          */
         if (tmp->hasUncacheableProto()) {
             PCMETER(noprotos++);
             return JS_NO_PROP_CACHE_FILL;
         }
@@ -116,18 +111,18 @@ PropertyCache::fill(JSContext *cx, JSObj
     }
 
     /*
      * Optimize the cached vword based on our parameters and the current pc's
      * opcode format flags.
      */
     jsbytecode *pc;
     (void) cx->stack.currentScript(&pc);
-    op = JSOp(*pc);
-    cs = &js_CodeSpec[op];
+    JSOp op = JSOp(*pc);
+    const JSCodeSpec *cs = &js_CodeSpec[op];
 
     if ((cs->format & JOF_SET) && obj->watched())
         return JS_NO_PROP_CACHE_FILL;
 
     if (obj == pobj) {
         JS_ASSERT(scopeIndex == 0 && protoIndex == 0);
     } else {
 #ifdef DEBUG
@@ -142,17 +137,17 @@ PropertyCache::fill(JSContext *cx, JSObj
              * Make sure that a later shadowing assignment will enter
              * PurgeProtoChain and invalidate this entry, bug 479198.
              */
             if (!obj->isDelegate())
                 return JS_NO_PROP_CACHE_FILL;
         }
     }
 
-    entry = &table[hash(pc, obj->lastProperty())];
+    PropertyCacheEntry *entry = &table[hash(pc, obj->lastProperty())];
     PCMETER(entry->vword.isNull() || recycles++);
     entry->assign(pc, obj->lastProperty(), pobj->lastProperty(), shape, scopeIndex, protoIndex);
 
     empty = false;
     PCMETER(fills++);
 
     /*
      * The modfills counter is not exact. It increases if a getter or setter