Don't hoist typeguards that are guaranteed to bail. (bug 818791, r=dvander) (also fix a comment for mrbkap)
authorMarty Rosenberg <mrosenberg@mozilla.com>
Fri, 07 Dec 2012 11:12:16 -0500
changeset 115358 ae6f5e7ddef3312814264c42009cd1eb1cccad65
parent 115357 d6d585622ca7cae4d9c77bff6fd6c16441915e28
child 115359 eede2ac054bf047d3a3beee9734fda34f03eaba3
push id24003
push usereakhgari@mozilla.com
push dateSun, 09 Dec 2012 18:17:18 +0000
treeherdermozilla-central@725eb8792d27 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs818791
milestone20.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
Don't hoist typeguards that are guaranteed to bail. (bug 818791, r=dvander) (also fix a comment for mrbkap)
js/src/ion/LICM.cpp
js/src/ion/LICM.h
js/src/ion/MIR.h
js/src/jsapi.h
--- a/js/src/ion/LICM.cpp
+++ b/js/src/ion/LICM.cpp
@@ -200,18 +200,21 @@ Loop::isInLoop(MDefinition *ins)
 bool
 Loop::isLoopInvariant(MInstruction *ins)
 {
     if (!isHoistable(ins))
         return false;
 
     // Don't hoist if this instruction depends on a store inside the loop.
     if (ins->dependency() && isInLoop(ins->dependency())) {
-        if (IonSpewEnabled(IonSpew_LICM))
-            fprintf(IonSpewFile, "depends on store inside loop.\n");
+        if (IonSpewEnabled(IonSpew_LICM)) {
+            fprintf(IonSpewFile, "depends on store inside loop: ");
+            ins->dependency()->printName(IonSpewFile);
+            fprintf(IonSpewFile, "\n");
+        }
         return false;
     }
 
     // An instruction is only loop invariant if it and all of its operands can
     // be safely hoisted into the loop preheader.
     for (size_t i = 0; i < ins->numOperands(); i ++) {
         if (isInLoop(ins->getOperand(i)) &&
             !ins->getOperand(i)->isLoopInvariant()) {
--- a/js/src/ion/LICM.h
+++ b/js/src/ion/LICM.h
@@ -83,16 +83,16 @@ class Loop
     bool checkHotness(MBasicBlock *block);
 
     // Worklist and worklist usage methods
     InstructionQueue worklist_;
     bool insertInWorklist(MInstruction *ins);
     MInstruction* popFromWorklist();
 
     inline bool isHoistable(const MDefinition *ins) const {
-        return ins->isMovable() && !ins->isEffectful();
+        return ins->isMovable() && !ins->isEffectful() && !ins->neverHoist();
     }
 };
 
 } // namespace ion
 } // namespace js
 
 #endif // jsion_licm_h__
--- a/js/src/ion/MIR.h
+++ b/js/src/ion/MIR.h
@@ -260,17 +260,17 @@ class MDefinition : public MNode
         return (flags_ & flags) == flags;
     }
     void removeFlags(uint32_t flags) {
         flags_ &= ~flags;
     }
     void setFlags(uint32_t flags) {
         flags_ |= flags;
     }
-
+    virtual bool neverHoist() const { return false; }
   public:
     MDefinition()
       : id_(0),
         valueNumber_(NULL),
         range_(),
         resultType_(MIRType_None),
         flags_(0),
         dependency_(NULL),
@@ -5460,16 +5460,20 @@ class MTypeBarrier : public MUnaryInstru
         return bailoutKind_;
     }
     const types::TypeSet *typeSet() const {
         return typeSet_;
     }
     AliasSet getAliasSet() const {
         return AliasSet::None();
     }
+    virtual bool neverHoist() const {
+        return typeSet()->empty();
+    }
+
 };
 
 // Like MTypeBarrier, guard that the value is in the given type set. This is
 // used after some VM calls (like GetElement) to avoid the slower calls to
 // TypeScript::Monitor inside these stubs.
 class MMonitorTypes : public MUnaryInstruction
 {
     const types::TypeSet *typeSet_;
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -587,17 +587,17 @@ class Value
 #elif JS_BITS_PER_WORD == 64
         return &data.asUIntPtr;
 #endif
     }
 
 #if !defined(_MSC_VER) && !defined(__sparc)
   /* To make jsval binary compatible when linking across C and C++ with MSVC,
    * JS::Value needs to be POD. Otherwise, jsval will be passed in memory
-   * in C++ but by value in C (bug 645111).
+   * in C++ but by value in C (bug 689101).
    * Same issue for SPARC ABI. (bug 737344).
    */
   private:
 #endif
 
     jsval_layout data;
 
   private: