Bug 1177318 - Add Ion support for JSOP_TOSTRING, to make template strings faster. r=jandem.

--HG--
extra : commitid : 5sBn3j0Ttil
extra : rebase_source : fa44a4dfc7cab12600e6eb41a684cc6cf7fbc718
This commit is contained in:
Jason Orendorff 2015-08-12 11:12:07 -05:00
Родитель 5e14a3b3a8
Коммит 15a26cce97
2 изменённых файлов: 21 добавлений и 0 удалений

Просмотреть файл

@ -699,6 +699,7 @@ IonBuilder::analyzeNewLoopTypes(MBasicBlock* entry, jsbytecode* start, jsbytecod
type = MIRType_Double; type = MIRType_Double;
break; break;
case JSOP_STRING: case JSOP_STRING:
case JSOP_TOSTRING:
case JSOP_TYPEOF: case JSOP_TYPEOF:
case JSOP_TYPEOFEXPR: case JSOP_TYPEOFEXPR:
type = MIRType_String; type = MIRType_String;
@ -1524,6 +1525,7 @@ IonBuilder::traverseBytecode()
case JSOP_POS: case JSOP_POS:
case JSOP_TOID: case JSOP_TOID:
case JSOP_TOSTRING:
// These ops may leave their input on the stack without setting // These ops may leave their input on the stack without setting
// the ImplicitlyUsed flag. If this value will be popped immediately, // the ImplicitlyUsed flag. If this value will be popped immediately,
// we may replace it with |undefined|, but the difference is // we may replace it with |undefined|, but the difference is
@ -1665,6 +1667,9 @@ IonBuilder::inspectOpcode(JSOp op)
case JSOP_NEG: case JSOP_NEG:
return jsop_neg(); return jsop_neg();
case JSOP_TOSTRING:
return jsop_tostring();
case JSOP_AND: case JSOP_AND:
case JSOP_OR: case JSOP_OR:
return jsop_andor(op); return jsop_andor(op);
@ -4548,6 +4553,7 @@ IonBuilder::jsop_bitnot()
MOZ_ASSERT(ins->isEffectful()); MOZ_ASSERT(ins->isEffectful());
return resumeAfter(ins); return resumeAfter(ins);
} }
bool bool
IonBuilder::jsop_bitop(JSOp op) IonBuilder::jsop_bitop(JSOp op)
{ {
@ -4865,6 +4871,20 @@ IonBuilder::jsop_neg()
return jsop_binary_arith(JSOP_MUL, negator, right); return jsop_binary_arith(JSOP_MUL, negator, right);
} }
bool
IonBuilder::jsop_tostring()
{
if (current->peek(-1)->type() == MIRType_String)
return true;
MDefinition* value = current->pop();
MToString* ins = MToString::New(alloc(), value);
current->add(ins);
current->push(ins);
MOZ_ASSERT(!ins->isEffectful());
return true;
}
class AutoAccumulateReturns class AutoAccumulateReturns
{ {
MIRGraph& graph_; MIRGraph& graph_;

Просмотреть файл

@ -649,6 +649,7 @@ class IonBuilder
bool jsop_pow(); bool jsop_pow();
bool jsop_pos(); bool jsop_pos();
bool jsop_neg(); bool jsop_neg();
bool jsop_tostring();
bool jsop_setarg(uint32_t arg); bool jsop_setarg(uint32_t arg);
bool jsop_defvar(uint32_t index); bool jsop_defvar(uint32_t index);
bool jsop_deffun(uint32_t index); bool jsop_deffun(uint32_t index);