Bug 897875 - Add IsCallPC(). (r=h4writer)
authorEric Faust <efaustbmo@gmail.com>
Thu, 25 Jul 2013 03:49:48 -0700
changeset 152216 fb1a587df374450b5167efd1aad1e28384f975fb
parent 152215 d0282b81e0cc15e33595ca442e172034e4963ba3
child 152217 2acba061b8492e4db1f07a74fdb075728a7e23f0
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersh4writer
bugs897875
milestone25.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 897875 - Add IsCallPC(). (r=h4writer)
js/src/ion/BaselineBailouts.cpp
js/src/ion/BaselineCompiler.cpp
js/src/ion/Ion.h
js/src/ion/IonFrames.cpp
js/src/jsinfer.cpp
js/src/jsopcode.h
--- a/js/src/ion/BaselineBailouts.cpp
+++ b/js/src/ion/BaselineBailouts.cpp
@@ -377,17 +377,17 @@ IsInlinableFallback(ICFallbackStub *icEn
 static inline void*
 GetStubReturnAddress(JSContext *cx, jsbytecode *pc)
 {
     if (IsGetterPC(pc))
         return cx->compartment()->ionCompartment()->baselineGetPropReturnAddr();
     if (IsSetterPC(pc))
         return cx->compartment()->ionCompartment()->baselineSetPropReturnAddr();
     // This should be a call op of some kind, now.
-    JS_ASSERT(js_CodeSpec[JSOp(*pc)].format & JOF_INVOKE);
+    JS_ASSERT(IsCallPC(pc));
     return cx->compartment()->ionCompartment()->baselineCallReturnAddr();
 }
 
 // For every inline frame, we write out the following data:
 //
 //                      |      ...      |
 //                      +---------------+
 //                      |  Descr(???)   |  --- Descr size here is (PREV_FRAME_SIZE)
@@ -764,17 +764,17 @@ InitFromBailout(JSContext *cx, HandleScr
             else if (op == JSOP_LOOPENTRY || op == JSOP_NOP || op == JSOP_LOOPHEAD)
                 pc = GetNextPc(pc);
             else
                 break;
         }
     }
 
     uint32_t pcOff = pc - script->code;
-    bool isCall = js_CodeSpec[op].format & JOF_INVOKE;
+    bool isCall = IsCallPC(pc);
     BaselineScript *baselineScript = script->baselineScript();
 
 #ifdef DEBUG
     uint32_t expectedDepth = js_ReconstructStackDepth(cx, script,
                                                       resumeAfter ? GetNextPc(pc) : pc);
     if (op != JSOP_FUNAPPLY || !iter.moreFrames() || resumeAfter) {
         if (op == JSOP_FUNCALL) {
             // For fun.call(this, ...); the reconstructStackDepth will
--- a/js/src/ion/BaselineCompiler.cpp
+++ b/js/src/ion/BaselineCompiler.cpp
@@ -2183,17 +2183,17 @@ BaselineCompiler::emit_JSOP_SETARG()
 {
     uint32_t arg = GET_SLOTNO(pc);
     return emitFormalArgAccess(arg, /* get = */ false);
 }
 
 bool
 BaselineCompiler::emitCall()
 {
-    JS_ASSERT(js_CodeSpec[*pc].format & JOF_INVOKE);
+    JS_ASSERT(IsCallPC(pc));
 
     uint32_t argc = GET_ARGC(pc);
 
     frame.syncStack(0);
     masm.mov(Imm32(argc), R0.scratchReg());
 
     // Call IC
     ICCall_Fallback::Compiler stubCompiler(cx, /* isConstructing = */ JSOp(*pc) == JSOP_NEW);
--- a/js/src/ion/Ion.h
+++ b/js/src/ion/Ion.h
@@ -343,20 +343,20 @@ IsEnabled(JSContext *cx)
 {
     return cx->hasOption(JSOPTION_ION) &&
         cx->hasOption(JSOPTION_BASELINE) &&
         cx->typeInferenceEnabled();
 }
 
 inline bool
 IsIonInlinablePC(jsbytecode *pc) {
-    // CALL, FUNCALL, FUNAPPLY, EVAL, NEW (JOF_INVOKE callsites)
+    // CALL, FUNCALL, FUNAPPLY, EVAL, NEW (Normal Callsites)
     // GETPROP, CALLPROP, and LENGTH. (Inlined Getters)
     // SETPROP, SETNAME, SETGNAME (Inlined Setters)
-    return js_CodeSpec[*pc].format & JOF_INVOKE || IsGetterPC(pc) || IsSetterPC(pc);
+    return IsCallPC(pc) || IsGetterPC(pc) || IsSetterPC(pc);
 }
 
 void ForbidCompilation(JSContext *cx, JSScript *script);
 void ForbidCompilation(JSContext *cx, JSScript *script, ExecutionMode mode);
 uint32_t UsesBeforeIonRecompile(JSScript *script, jsbytecode *pc);
 
 void PurgeCaches(JSScript *script, JS::Zone *zone);
 size_t SizeOfIonData(JSScript *script, mozilla::MallocSizeOf mallocSizeOf);
--- a/js/src/ion/IonFrames.cpp
+++ b/js/src/ion/IonFrames.cpp
@@ -1389,17 +1389,17 @@ InlineFrameIteratorMaybeGC<allowGC>::isC
         InlineFrameIteratorMaybeGC<allowGC> parent(GetIonContext()->cx, this);
         ++parent;
 
         // Inlined Getters and Setters are never constructing.
         if (IsGetterPC(parent.pc()) || IsSetterPC(parent.pc()))
             return false;
 
         // In the case of a JS frame, look up the pc from the snapshot.
-        JS_ASSERT(js_CodeSpec[*parent.pc()].format & JOF_INVOKE);
+        JS_ASSERT(IsCallPC(parent.pc()));
 
         return (JSOp)*parent.pc() == JSOP_NEW;
     }
 
     return frame_->isConstructing();
 }
 template bool InlineFrameIteratorMaybeGC<NoGC>::isConstructing() const;
 template bool InlineFrameIteratorMaybeGC<CanGC>::isConstructing() const;
@@ -1417,30 +1417,30 @@ IonFrameIterator::isConstructing() const
     if (parent.isOptimizedJS()) {
         // In the case of a JS frame, look up the pc from the snapshot.
         InlineFrameIterator inlinedParent(GetIonContext()->cx, &parent);
 
         //Inlined Getters and Setters are never constructing.
         if (IsGetterPC(inlinedParent.pc()) || IsSetterPC(inlinedParent.pc()))
             return false;
 
-        JS_ASSERT(js_CodeSpec[*inlinedParent.pc()].format & JOF_INVOKE);
+        JS_ASSERT(IsCallPC(inlinedParent.pc()));
 
         return (JSOp)*inlinedParent.pc() == JSOP_NEW;
     }
 
     if (parent.isBaselineJS()) {
         jsbytecode *pc;
         parent.baselineScriptAndPc(NULL, &pc);
 
         //Inlined Getters and Setters are never constructing.
         if (IsGetterPC(pc) || IsSetterPC(pc))
             return false;
 
-        JS_ASSERT(js_CodeSpec[*pc].format & JOF_INVOKE);
+        JS_ASSERT(IsCallPC(pc));
 
         return JSOp(*pc) == JSOP_NEW;
     }
 
     JS_ASSERT(parent.done());
     return activation_->firstFrameIsConstructing();
 }
 
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -700,17 +700,17 @@ typedef TypeConstraintProp<PROPERTY_READ
 void
 StackTypeSet::addGetProperty(JSContext *cx, JSScript *script, jsbytecode *pc,
                              StackTypeSet *target, jsid id)
 {
     /*
      * GetProperty constraints are normally used with property read input type
      * sets, except for array_pop/array_shift special casing.
      */
-    JS_ASSERT(js_CodeSpec[*pc].format & JOF_INVOKE);
+    JS_ASSERT(IsCallPC(pc));
 
     add(cx, cx->analysisLifoAlloc().new_<TypeConstraintGetProperty>(script, pc, target, id));
 }
 
 void
 StackTypeSet::addSetProperty(JSContext *cx, JSScript *script, jsbytecode *pc,
                              StackTypeSet *target, jsid id)
 {
@@ -2852,28 +2852,28 @@ TypeCompartment::monitorBytecode(JSConte
                                  bool returnOnly)
 {
     if (!script->ensureRanInference(cx))
         return;
 
     ScriptAnalysis *analysis = script->analysis();
     jsbytecode *pc = script->code + offset;
 
-    JS_ASSERT_IF(returnOnly, js_CodeSpec[*pc].format & JOF_INVOKE);
+    JS_ASSERT_IF(returnOnly, IsCallPC(pc));
 
     Bytecode &code = analysis->getCode(pc);
 
     if (returnOnly ? code.monitoredTypesReturn : code.monitoredTypes)
         return;
 
     InferSpew(ISpewOps, "addMonitorNeeded:%s #%u:%05u",
               returnOnly ? " returnOnly" : "", script->id(), offset);
 
     /* Dynamically monitor this call to keep track of its result types. */
-    if (js_CodeSpec[*pc].format & JOF_INVOKE)
+    if (IsCallPC(pc))
         code.monitoredTypesReturn = true;
 
     if (returnOnly)
         return;
 
     code.monitoredTypes = true;
 
     AddPendingRecompile(cx, script);
--- a/js/src/jsopcode.h
+++ b/js/src/jsopcode.h
@@ -77,17 +77,18 @@ typedef enum JSOp {
 /* (1U<<13) is unused*/
 #define JOF_DETECTING    (1U<<14) /* object detection for warning-quelling */
 /* (1U<<15) is unused*/
 #define JOF_LEFTASSOC    (1U<<16) /* left-associative operator */
 /* (1U<<17) is unused */
 /* (1U<<18) is unused */
 /* (1U<<19) is unused*/
 /* (1U<<20) is unused*/
-#define JOF_INVOKE       (1U<<21) /* JSOP_CALL, JSOP_NEW, JSOP_EVAL */
+#define JOF_INVOKE       (1U<<21) /* JSOP_CALL, JSOP_FUNCALL, JSOP_FUNAPPLY,
+                                     JSOP_NEW, JSOP_EVAL */
 #define JOF_TMPSLOT      (1U<<22) /* interpreter uses extra temporary slot
                                      to root intermediate objects besides
                                      the slots opcode uses */
 #define JOF_TMPSLOT2     (2U<<22) /* interpreter uses extra 2 temporary slot
                                      besides the slots opcode uses */
 #define JOF_TMPSLOT3     (3U<<22) /* interpreter uses extra 3 temporary slot
                                      besides the slots opcode uses */
 #define JOF_TMPSLOT_SHIFT 22
@@ -611,16 +612,22 @@ IsGetterPC(jsbytecode *pc)
 
 inline bool
 IsSetterPC(jsbytecode *pc)
 {
     JSOp op = JSOp(*pc);
     return op == JSOP_SETPROP || op == JSOP_SETNAME || op == JSOP_SETGNAME;
 }
 
+inline bool
+IsCallPC(jsbytecode *pc)
+{
+    return js_CodeSpec[*pc].format & JOF_INVOKE;
+}
+
 static inline int32_t
 GetBytecodeInteger(jsbytecode *pc)
 {
     switch (JSOp(*pc)) {
       case JSOP_ZERO:   return 0;
       case JSOP_ONE:    return 1;
       case JSOP_UINT16: return GET_UINT16(pc);
       case JSOP_UINT24: return GET_UINT24(pc);