[INFER] Fix build breaks, orange.
authorBrian Hackett <bhackett1024@gmail.com>
Thu, 21 Jul 2011 17:17:25 -0700
changeset 76051 cdb452875184636ecea5f5daa8fad5d539931652
parent 76050 dd84f621ca258b452d0df583b036efa7e47c87cb
child 76052 40b7b08eaa123caee88b3e7c59b8c4e811a50898
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
milestone8.0a1
[INFER] Fix build breaks, orange.
js/src/jsinfer.cpp
js/src/jsinferinlines.h
js/src/jstypedarray.cpp
js/src/methodjit/FastOps.cpp
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -2240,23 +2240,25 @@ ScriptAnalysis::addTypeBarrier(JSContext
               TypeString(type));
 
     barrier = ArenaNew<TypeBarrier>(cx->compartment->pool, target, type);
 
     barrier->next = code.typeBarriers;
     code.typeBarriers = barrier;
 }
 
+#ifdef DEBUG
 static void
 PrintObjectCallback(JSContext *cx, void *data, void *thing,
                     size_t traceKind, size_t thingSize)
 {
     TypeObject *object = (TypeObject *) thing;
     object->print(cx);
 }
+#endif
 
 void
 TypeCompartment::print(JSContext *cx)
 {
     JSCompartment *compartment = this->compartment();
 
     if (!InferSpewActive(ISpewResult) || JS_CLIST_IS_EMPTY(&compartment->scripts))
         return;
@@ -2264,17 +2266,20 @@ TypeCompartment::print(JSContext *cx)
     for (JSScript *script = (JSScript *)compartment->scripts.next;
          &script->links != &compartment->scripts;
          script = (JSScript *)script->links.next) {
         if (script->hasAnalysis() && script->analysis(cx)->ranInference())
             script->analysis(cx)->printTypes(cx);
     }
 
 #ifdef DEBUG
-    IterateCells(cx, compartment, gc::FINALIZE_TYPE_OBJECT, NULL, PrintObjectCallback);
+    {
+        AutoUnlockGC unlock(cx->runtime);
+        IterateCells(cx, compartment, gc::FINALIZE_TYPE_OBJECT, NULL, PrintObjectCallback);
+    }
 #endif
 
     printf("Counts: ");
     for (unsigned count = 0; count < TYPE_COUNT_LIMIT; count++) {
         if (count)
             printf("/");
         printf("%u", typeCounts[count]);
     }
--- a/js/src/jsinferinlines.h
+++ b/js/src/jsinferinlines.h
@@ -570,17 +570,17 @@ struct AllocationSiteKey {
 
     static const uint32 OFFSET_LIMIT = (1 << 23);
 
     AllocationSiteKey() { PodZero(this); }
 
     typedef AllocationSiteKey Lookup;
 
     static inline uint32 hash(AllocationSiteKey key) {
-        return (uint32) (key.script->code + key.offset) ^ key.kind;
+        return (uint32) size_t(key.script->code + key.offset) ^ key.kind;
     }
 
     static inline bool match(const AllocationSiteKey &a, const AllocationSiteKey &b) {
         return a.script == b.script && a.offset == b.offset && a.kind == b.kind;
     }
 };
 
 inline TypeObject *
--- a/js/src/jstypedarray.cpp
+++ b/js/src/jstypedarray.cpp
@@ -1752,22 +1752,16 @@ do {                                    
     proto = js_InitClass(cx, obj, NULL,                                        \
                          &TypedArray::slowClasses[TypedArray::_type],          \
                          _typedArray::class_constructor, 3,                    \
                          _typedArray::jsprops,                                 \
                          _typedArray::jsfuncs,                                 \
                          NULL, NULL);                                          \
     if (!proto)                                                                \
         return NULL;                                                           \
-    AddTypePropertyId(cx, proto, JSID_VOID,                                    \
-                      types::Type::Int32Type());                               \
-    if (_typedArray::ArrayElementTypeMayBeDouble()) {                          \
-        AddTypePropertyId(cx, proto, JSID_VOID,                                \
-                          types::Type::DoubleType());                          \
-    }                                                                          \
     JSObject *ctor = JS_GetConstructor(cx, proto);                             \
     if (!ctor ||                                                               \
         !JS_DefineProperty(cx, ctor, "BYTES_PER_ELEMENT",                      \
                            INT_TO_JSVAL(sizeof(_typedArray::ThisType)),        \
                            JS_PropertyStub, JS_StrictPropertyStub,             \
                            JSPROP_PERMANENT | JSPROP_READONLY) ||              \
         !JS_DefineProperty(cx, proto, "BYTES_PER_ELEMENT",                     \
                            INT_TO_JSVAL(sizeof(_typedArray::ThisType)),        \
--- a/js/src/methodjit/FastOps.cpp
+++ b/js/src/methodjit/FastOps.cpp
@@ -1864,36 +1864,34 @@ mjit::Compiler::jsop_getelem_typed(int a
     RegisterID objReg = frame.copyDataIntoReg(obj);
 
     // We can load directly into an FP-register if the following conditions
     // are met:
     // 1) The array is an Uint32Array or a float array (loadFromTypedArray
     //    can't load into an FP-register for other arrays).
     // 2) The result is definitely a double (the result type set can include
     //    other types after reading out-of-bound values).
-    // 3) There's no type barrier (we need separate type and data regs for
-    //    type barriers).
     AnyRegisterID dataReg;
     MaybeRegisterID typeReg, tempReg;
     JSValueType type = knownPushedType(0);
     bool maybeReadFloat = (atype == TypedArray::TYPE_FLOAT32 ||
                            atype == TypedArray::TYPE_FLOAT64 ||
                            atype == TypedArray::TYPE_UINT32);
-    if (maybeReadFloat && type == JSVAL_TYPE_DOUBLE && !hasTypeBarriers(PC)) {
+    if (maybeReadFloat && type == JSVAL_TYPE_DOUBLE) {
         dataReg = frame.allocFPReg();
         // Need an extra reg to convert uint32 to double.
         if (atype == TypedArray::TYPE_UINT32)
             tempReg = frame.allocReg();
     } else {
         dataReg = frame.allocReg();
         // loadFromTypedArray expects a type register for Uint32Array or
         // float arrays. Also allocate a type register if the result may not
         // be int32 (due to reading out-of-bound values) or if there's a
         // type barrier.
-        if (maybeReadFloat || type != JSVAL_TYPE_INT32 || hasTypeBarriers(PC))
+        if (maybeReadFloat || type != JSVAL_TYPE_INT32)
             typeReg = frame.allocReg();
     }
 
     // Get the internal typed array.
     masm.loadPtr(Address(objReg, offsetof(JSObject, privateData)), objReg);
 
     // Bounds check.
     Jump lengthGuard = masm.guardArrayExtent(TypedArray::lengthOffset(),
@@ -1964,17 +1962,18 @@ mjit::Compiler::jsop_getelem(bool isCall
             // Inline dense array path.
             bool packed = !types->hasObjectFlags(cx, types::OBJECT_FLAG_NON_PACKED_ARRAY);
             jsop_getelem_dense(packed);
             return true;
         }
 
 #ifdef JS_METHODJIT_TYPED_ARRAY
         if (obj->mightBeType(JSVAL_TYPE_OBJECT) &&
-            !types->hasObjectFlags(cx, types::OBJECT_FLAG_NON_TYPED_ARRAY)) {
+            !types->hasObjectFlags(cx, types::OBJECT_FLAG_NON_TYPED_ARRAY) &&
+            pushedTypeSet(0)->baseFlags() != 0) {
             // Inline typed array path.
             int atype = types->getTypedArrayType(cx);
             if (atype != TypedArray::TYPE_MAX) {
                 jsop_getelem_typed(atype);
                 return true;
             }
         }
 #endif