From a6f672d070d352ad072e4beed8938700588b2016 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Wed, 17 Feb 2016 09:30:51 -0600 Subject: [PATCH] Bug 1248860 - Odin: remove Expr::InterruptCheck (r=bbouvier) MozReview-Commit-ID: CJqowKeSKmR --- js/src/asmjs/AsmJS.cpp | 32 +------------------------------- js/src/asmjs/WasmBinary.h | 3 --- js/src/asmjs/WasmIonCompile.cpp | 31 +++++++++++-------------------- 3 files changed, 12 insertions(+), 54 deletions(-) diff --git a/js/src/asmjs/AsmJS.cpp b/js/src/asmjs/AsmJS.cpp index ddbfe2c0c166..b5ecd66472fc 100644 --- a/js/src/asmjs/AsmJS.cpp +++ b/js/src/asmjs/AsmJS.cpp @@ -6082,26 +6082,6 @@ enum class InterruptCheckPosition { Loop }; -static bool -MaybeAddInterruptCheck(FunctionValidator& f, InterruptCheckPosition pos, ParseNode* pn) -{ - if (f.m().mg().args().useSignalHandlersForInterrupt) - return true; - - switch (pos) { - case InterruptCheckPosition::Head: - if (!f.encoder().writeExpr(Expr::InterruptCheckHead)) - return false; - break; - case InterruptCheckPosition::Loop: - if (!f.encoder().writeExpr(Expr::InterruptCheckLoop)) - return false; - break; - } - - return true; -} - static bool CheckWhile(FunctionValidator& f, ParseNode* whileStmt) { @@ -6118,8 +6098,7 @@ CheckWhile(FunctionValidator& f, ParseNode* whileStmt) if (!condType.isInt()) return f.failf(cond, "%s is not a subtype of int", condType.toChars()); - return MaybeAddInterruptCheck(f, InterruptCheckPosition::Loop, whileStmt) && - CheckStatement(f, body); + return CheckStatement(f, body); } static bool @@ -6154,9 +6133,6 @@ CheckFor(FunctionValidator& f, ParseNode* forStmt) return false; } - if (!MaybeAddInterruptCheck(f, InterruptCheckPosition::Loop, forStmt)) - return false; - if (!CheckStatement(f, body)) return false; @@ -6176,9 +6152,6 @@ CheckDoWhile(FunctionValidator& f, ParseNode* whileStmt) if (!f.encoder().writeExpr(Expr::DoWhile)) return false; - if (!MaybeAddInterruptCheck(f, InterruptCheckPosition::Loop, cond)) - return false; - if (!CheckStatement(f, body)) return false; @@ -6626,9 +6599,6 @@ CheckFunction(ModuleValidator& m) if (!CheckArguments(f, &stmtIter, &args)) return false; - if (!MaybeAddInterruptCheck(f, InterruptCheckPosition::Head, fn)) - return false; - if (!CheckVariables(f, &stmtIter)) return false; diff --git a/js/src/asmjs/WasmBinary.h b/js/src/asmjs/WasmBinary.h index 8347b219c207..091850c3cd85 100644 --- a/js/src/asmjs/WasmBinary.h +++ b/js/src/asmjs/WasmBinary.h @@ -255,9 +255,6 @@ enum class Expr : uint16_t Id, - InterruptCheckHead, - InterruptCheckLoop, - I32Min, I32Max, diff --git a/js/src/asmjs/WasmIonCompile.cpp b/js/src/asmjs/WasmIonCompile.cpp index eea95cb8d8ef..dfc7410c259b 100644 --- a/js/src/asmjs/WasmIonCompile.cpp +++ b/js/src/asmjs/WasmIonCompile.cpp @@ -145,6 +145,8 @@ class FunctionCompiler return false; } + addInterruptCheck(); + return true; } @@ -589,6 +591,9 @@ class FunctionCompiler void addInterruptCheck() { + if (mg_.args().useSignalHandlersForInterrupt) + return; + if (inDeadCode()) return; @@ -2361,22 +2366,6 @@ EmitSimdOp(FunctionCompiler& f, ExprType type, SimdOperation op, MDefinition** d MOZ_CRASH("unexpected opcode"); } -static bool -EmitInterruptCheck(FunctionCompiler& f) -{ - f.addInterruptCheck(); - return true; -} - -static bool -EmitInterruptCheckLoop(FunctionCompiler& f) -{ - if (!EmitInterruptCheck(f)) - return false; - MDefinition* _; - return EmitExprStmt(f, &_); -} - static bool EmitWhile(FunctionCompiler& f, const LabelVector* maybeLabels) { @@ -2394,6 +2383,8 @@ EmitWhile(FunctionCompiler& f, const LabelVector* maybeLabels) if (!f.branchAndStartLoopBody(condDef, &afterLoop)) return false; + f.addInterruptCheck(); + MDefinition* _; if (!EmitExprStmt(f, &_)) return false; @@ -2429,6 +2420,8 @@ EmitFor(FunctionCompiler& f, Expr expr, const LabelVector* maybeLabels) if (!f.branchAndStartLoopBody(condDef, &afterLoop)) return false; + f.addInterruptCheck(); + MDefinition* _; if (!EmitExprStmt(f, &_)) return false; @@ -2454,6 +2447,8 @@ EmitDoWhile(FunctionCompiler& f, const LabelVector* maybeLabels) if (!f.startPendingLoop(headId, &loopEntry)) return false; + f.addInterruptCheck(); + MDefinition* _; if (!EmitExprStmt(f, &_)) return false; @@ -2706,10 +2701,6 @@ EmitExpr(FunctionCompiler& f, ExprType type, MDefinition** def, LabelVector* may case Expr::AtomicsFence: f.memoryBarrier(MembarFull); return true; - case Expr::InterruptCheckHead: - return EmitInterruptCheck(f); - case Expr::InterruptCheckLoop: - return EmitInterruptCheckLoop(f); // Common case Expr::GetLocal: return EmitGetLocal(f, type, def);