Bug 686009 - Clean up some comments in jstracer.cpp which refer to js_InitClass uses which are now mostly removed. Also remove an obsolete comment in JSObject::makeDenseArraySlow that referred to use of js_InitClass to initialize Array. r=bhackett
authorJeff Walden <jwalden@mit.edu>
Wed, 04 May 2011 16:54:24 -0400
changeset 78326 2c064df91e2f3d0f59940188d14e51c31fad9922
parent 78325 66db4ae2f2c714d4c156879c76f4efcc00e5aa57
child 78327 718c6db1280477b3435e7f61c88e65f632cd1be1
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett
bugs686009
milestone9.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 686009 - Clean up some comments in jstracer.cpp which refer to js_InitClass uses which are now mostly removed. Also remove an obsolete comment in JSObject::makeDenseArraySlow that referred to use of js_InitClass to initialize Array. r=bhackett
js/src/jsarray.cpp
js/src/jstracer.cpp
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -1200,22 +1200,16 @@ JSObject::makeDenseArraySlow(JSContext *
             return false;
         }
 
         next++;
     }
 
     clearSlotRange(next, capacity - next);
 
-    /*
-     * Finally, update class. If |this| is Array.prototype, then js_InitClass
-     * will create an emptyShape whose class is &SlowArrayClass, to ensure
-     * that delegating instances can share shapes in the tree rooted at the
-     * proto's empty shape.
-     */
     return true;
 }
 
 #if JS_HAS_TOSOURCE
 class ArraySharpDetector
 {
     JSContext *cx;
     jschar *chars;
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -11043,43 +11043,51 @@ TraceRecorder::record_JSOP_OBJTOP()
     Value& v = stackval(-1);
     RETURN_IF_XML_A(v);
     return ARECORD_CONTINUE;
 }
 
 RecordingStatus
 TraceRecorder::getClassPrototype(JSObject* ctor, LIns*& proto_ins)
 {
-    // ctor must be a function created via js_InitClass.
+    /*
+     * This function requires that |ctor| be a built-in class function in order
+     * to have an immutable |ctor.prototype| that can be burned into the trace
+     * below.
+     */
 #ifdef DEBUG
     Class *clasp = ctor->getFunctionPrivate()->getConstructorClass();
     JS_ASSERT(clasp);
 
     TraceMonitor &localtm = *traceMonitor;
 #endif
 
     Value pval;
     if (!ctor->getProperty(cx, ATOM_TO_JSID(cx->runtime->atomState.classPrototypeAtom), &pval))
         RETURN_ERROR("error getting prototype from constructor");
 
-    // ctor.prototype is a permanent data property, so this lookup cannot have
-    // deep-aborted.
+    /*
+     * |ctor.prototype| is a non-configurable, non-writable data property, so
+     * this lookup cannot have deep-aborted.
+     */
     JS_ASSERT(localtm.recorder);
 
 #ifdef DEBUG
     JSBool ok, found;
     uintN attrs;
     ok = JS_GetPropertyAttributes(cx, ctor, js_class_prototype_str, &attrs, &found);
     JS_ASSERT(ok);
     JS_ASSERT(found);
     JS_ASSERT((~attrs & (JSPROP_READONLY | JSPROP_PERMANENT)) == 0);
 #endif
 
-    // Since ctor was built by js_InitClass, we can assert (rather than check)
-    // that pval is usable.
+    /*
+     * Per requirements noted at the start of this function, pval must be
+     * usable.
+     */
     JS_ASSERT(!pval.isPrimitive());
     JSObject *proto = &pval.toObject();
     JS_ASSERT(!proto->isDenseArray());
     JS_ASSERT_IF(clasp != &ArrayClass, proto->getNewType(cx)->emptyShapes[0]->getClass() == clasp);
 
     proto_ins = w.immpObjGC(proto);
     return RECORD_CONTINUE;
 }