Bug 916914 - Remove ScriptAnalysis::ionInlineable(), r=jandem.

This commit is contained in:
Brian Hackett 2013-09-17 08:39:01 -06:00
parent c39b834022
commit 74105e653d
4 changed files with 23 additions and 151 deletions

View File

@ -226,12 +226,15 @@ IonBuilder::getPolyCallTargets(types::TemporaryTypeSet *calleeTypes, bool constr
bool
IonBuilder::canEnterInlinedFunction(JSFunction *target)
{
if (target->isHeavyweight())
return false;
RootedScript targetScript(cx, target->nonLazyScript());
if (!targetScript->ensureRanAnalysis(cx))
return false;
if (!targetScript->analysis()->ionInlineable())
if (targetScript->uninlineable)
return false;
if (targetScript->needsArgsObj())
@ -1110,6 +1113,8 @@ IonBuilder::traverseBytecode()
break;
if (status == ControlStatus_Error)
return false;
if (status == ControlStatus_Abort)
return abort("Aborted while processing control flow");
if (!current)
return maybeAddOsrTypeBarriers();
}
@ -3359,6 +3364,10 @@ IonBuilder::jsop_try()
if (script()->analysis()->hasTryFinally())
return abort("Has try-finally");
// Try-catch within inline frames is not yet supported.
if (callerBuilder_)
return abort("try-catch within inline frame");
graph().setHasTryBlock();
jssrcnote *sn = info().getNote(cx, pc);
@ -3462,6 +3471,10 @@ IonBuilder::processReturn(JSOp op)
IonBuilder::ControlStatus
IonBuilder::processThrow()
{
// JSOP_THROW can't be compiled within inlined frames.
if (callerBuilder_)
return ControlStatus_Abort;
MDefinition *def = current->pop();
if (graph().hasTryBlock()) {
@ -3774,14 +3787,15 @@ IonBuilder::inlineScriptedCall(CallInfo &callInfo, JSFunction *target)
return false;
}
// Inlining the callee failed. Disable inlining the function
// Inlining the callee failed. Mark the callee as uninlineable only if
// the inlining was aborted for a non-exception reason.
if (inlineBuilder.abortReason_ == AbortReason_Disable) {
// Only mark callee as un-inlineable only if the inlining was aborted
// for a non-exception reason.
calleeScript->analysis()->setIonUninlineable();
calleeScript->uninlineable = true;
abortReason_ = AbortReason_Inlining;
} else if (inlineBuilder.abortReason_ == AbortReason_Inlining) {
abortReason_ = AbortReason_Inlining;
}
abortReason_ = AbortReason_Inlining;
return false;
}
@ -3804,7 +3818,7 @@ IonBuilder::inlineScriptedCall(CallInfo &callInfo, JSFunction *target)
MIRGraphExits &exits = *inlineBuilder.graph().exitAccumulator();
if (exits.length() == 0) {
// Inlining of functions that have no exit is not supported.
calleeScript->analysis()->setIonUninlineable();
calleeScript->uninlineable = true;
abortReason_ = AbortReason_Inlining;
return false;
}

View File

@ -132,12 +132,6 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
escapedSlots[LocalSlot(script_, bi.frameIndex())] = allVarsAliased || bi->aliased();
}
bool heavyweight = script_->function() && script_->function()->isHeavyweight();
isIonInlineable = true;
if (heavyweight || cx->compartment()->debugMode())
isIonInlineable = false;
canTrackVars = true;
/*
@ -214,10 +208,8 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
code->analyzed = true;
if (script_->hasBreakpointsAt(pc)) {
if (script_->hasBreakpointsAt(pc))
canTrackVars = false;
isIonInlineable = false;
}
unsigned stackDepth = code->stackDepth;
@ -238,11 +230,6 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
numReturnSites_++;
break;
case JSOP_SETRVAL:
case JSOP_POPV:
isIonInlineable = false;
break;
case JSOP_NAME:
case JSOP_CALLNAME:
case JSOP_BINDNAME:
@ -261,29 +248,15 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
case JSOP_SETCONST:
usesScopeChain_ = true; // Requires access to VarObj via ScopeChain.
canTrackVars = false;
isIonInlineable = false;
break;
case JSOP_EVAL:
case JSOP_SPREADEVAL:
canTrackVars = false;
isIonInlineable = false;
break;
case JSOP_ENTERWITH:
canTrackVars = false;
isIonInlineable = false;
break;
case JSOP_ENTERLET0:
case JSOP_ENTERLET1:
case JSOP_ENTERBLOCK:
case JSOP_LEAVEBLOCK:
isIonInlineable = false;
break;
case JSOP_TABLESWITCH: {
isIonInlineable = false;
unsigned defaultOffset = offset + GET_JUMP_OFFSET(pc);
jsbytecode *pc2 = pc + JUMP_OFFSET_LEN;
int32_t low = GET_JUMP_OFFSET(pc2);
@ -312,7 +285,6 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
* exception but is not caught by a later handler in the same function:
* no more code will execute, and it does not matter what is defined.
*/
isIonInlineable = false;
JSTryNote *tn = script_->trynotes()->vector;
JSTryNote *tnlimit = tn + script_->trynotes()->length;
for (; tn < tnlimit; tn++) {
@ -369,122 +341,11 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
numPropertyReads_++;
break;
case JSOP_THROW:
case JSOP_EXCEPTION:
case JSOP_DEBUGGER:
isIonInlineable = false;
break;
case JSOP_FINALLY:
hasTryFinally_ = true;
break;
/* Additional opcodes which can be both compiled both normally and inline. */
case JSOP_ARGUMENTS:
case JSOP_CALL:
case JSOP_NEW:
case JSOP_FUNCALL:
case JSOP_FUNAPPLY:
case JSOP_CALLEE:
case JSOP_NOP:
case JSOP_UNDEFINED:
case JSOP_GOTO:
case JSOP_DEFAULT:
case JSOP_IFEQ:
case JSOP_IFNE:
case JSOP_ITERNEXT:
case JSOP_DUP:
case JSOP_DUP2:
case JSOP_SWAP:
case JSOP_PICK:
case JSOP_BITOR:
case JSOP_BITXOR:
case JSOP_BITAND:
case JSOP_LT:
case JSOP_LE:
case JSOP_GT:
case JSOP_GE:
case JSOP_EQ:
case JSOP_NE:
case JSOP_LSH:
case JSOP_RSH:
case JSOP_URSH:
case JSOP_ADD:
case JSOP_SUB:
case JSOP_MUL:
case JSOP_DIV:
case JSOP_MOD:
case JSOP_NOT:
case JSOP_BITNOT:
case JSOP_NEG:
case JSOP_POS:
case JSOP_DELPROP:
case JSOP_DELELEM:
case JSOP_TYPEOF:
case JSOP_TYPEOFEXPR:
case JSOP_VOID:
case JSOP_TOID:
case JSOP_SETELEM:
case JSOP_IMPLICITTHIS:
case JSOP_DOUBLE:
case JSOP_STRING:
case JSOP_ZERO:
case JSOP_ONE:
case JSOP_NULL:
case JSOP_FALSE:
case JSOP_TRUE:
case JSOP_OR:
case JSOP_AND:
case JSOP_CASE:
case JSOP_STRICTEQ:
case JSOP_STRICTNE:
case JSOP_ITER:
case JSOP_MOREITER:
case JSOP_ENDITER:
case JSOP_POP:
case JSOP_GETARG:
case JSOP_SETARG:
case JSOP_CALLARG:
case JSOP_BINDGNAME:
case JSOP_UINT16:
case JSOP_NEWINIT:
case JSOP_NEWARRAY:
case JSOP_NEWOBJECT:
case JSOP_ENDINIT:
case JSOP_INITPROP:
case JSOP_INITELEM:
case JSOP_INITELEM_ARRAY:
case JSOP_SETPROP:
case JSOP_IN:
case JSOP_INSTANCEOF:
case JSOP_LINENO:
case JSOP_ENUMELEM:
case JSOP_CONDSWITCH:
case JSOP_LABEL:
case JSOP_RETRVAL:
case JSOP_GETGNAME:
case JSOP_CALLGNAME:
case JSOP_GETINTRINSIC:
case JSOP_SETINTRINSIC:
case JSOP_BINDINTRINSIC:
case JSOP_CALLINTRINSIC:
case JSOP_SETGNAME:
case JSOP_REGEXP:
case JSOP_OBJECT:
case JSOP_UINT24:
case JSOP_GETXPROP:
case JSOP_INT8:
case JSOP_INT32:
case JSOP_HOLE:
case JSOP_LOOPHEAD:
case JSOP_LOOPENTRY:
case JSOP_NOTEARG:
case JSOP_REST:
case JSOP_THIS:
break;
default:
isIonInlineable = false;
break;
}

View File

@ -633,7 +633,6 @@ class ScriptAnalysis
bool usesScopeChain_:1;
bool localsAliasStack_:1;
bool isIonInlineable:1;
bool canTrackVars:1;
bool hasLoops_:1;
bool hasTryFinally_:1;
@ -664,9 +663,6 @@ class ScriptAnalysis
bool OOM() const { return outOfMemory; }
bool failed() const { return hadFailure; }
bool ionInlineable() const { return isIonInlineable; }
bool ionInlineable(uint32_t argc) const { return isIonInlineable && argc == script_->function()->nargs; }
void setIonUninlineable() { isIonInlineable = false; }
/* Whether the script has a |finally| block. */
bool hasTryFinally() const { return hasTryFinally_; }

View File

@ -592,6 +592,7 @@ class JSScript : public js::gc::Cell
bool shouldCloneAtCallsite:1;
bool isCallsiteClone:1; /* is a callsite clone; has a link to the original function */
bool shouldInline:1; /* hint to inline when possible */
bool uninlineable:1; /* explicitly marked as uninlineable */
#ifdef JS_ION
bool failedBoundsCheck:1; /* script has had hoisted bounds checks fail */
bool failedShapeGuard:1; /* script has had hoisted shape guard fail */