Modified: releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (248219 => 248220)
--- releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2019-08-04 03:22:38 UTC (rev 248219)
+++ releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2019-08-04 03:22:41 UTC (rev 248220)
@@ -1388,6 +1388,7 @@
template<typename BinOp, typename JmpOp>
bool BytecodeGenerator::fuseCompareAndJump(RegisterID* cond, Label& target, bool swapOperands)
{
+ ASSERT(canDoPeepholeOptimization());
auto binop = m_lastInstruction->as<BinOp>();
if (cond->index() == binop.m_dst.offset() && cond->isTemporary() && !cond->refCount()) {
rewind();
@@ -1404,6 +1405,7 @@
template<typename UnaryOp, typename JmpOp>
bool BytecodeGenerator::fuseTestAndJmp(RegisterID* cond, Label& target)
{
+ ASSERT(canDoPeepholeOptimization());
auto unop = m_lastInstruction->as<UnaryOp>();
if (cond->index() == unop.m_dst.offset() && cond->isTemporary() && !cond->refCount()) {
rewind();
@@ -1416,43 +1418,44 @@
void BytecodeGenerator::emitJumpIfTrue(RegisterID* cond, Label& target)
{
-
- if (m_lastOpcodeID == op_less) {
- if (fuseCompareAndJump<OpLess, OpJless>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_lesseq) {
- if (fuseCompareAndJump<OpLesseq, OpJlesseq>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_greater) {
- if (fuseCompareAndJump<OpGreater, OpJgreater>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_greatereq) {
- if (fuseCompareAndJump<OpGreatereq, OpJgreatereq>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_eq) {
- if (fuseCompareAndJump<OpEq, OpJeq>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_stricteq) {
- if (fuseCompareAndJump<OpStricteq, OpJstricteq>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_neq) {
- if (fuseCompareAndJump<OpNeq, OpJneq>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_nstricteq) {
- if (fuseCompareAndJump<OpNstricteq, OpJnstricteq>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_below) {
- if (fuseCompareAndJump<OpBelow, OpJbelow>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_beloweq) {
- if (fuseCompareAndJump<OpBeloweq, OpJbeloweq>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_eq_null && target.isForward()) {
- if (fuseTestAndJmp<OpEqNull, OpJeqNull>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_neq_null && target.isForward()) {
- if (fuseTestAndJmp<OpNeqNull, OpJneqNull>(cond, target))
- return;
+ if (canDoPeepholeOptimization()) {
+ if (m_lastOpcodeID == op_less) {
+ if (fuseCompareAndJump<OpLess, OpJless>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_lesseq) {
+ if (fuseCompareAndJump<OpLesseq, OpJlesseq>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_greater) {
+ if (fuseCompareAndJump<OpGreater, OpJgreater>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_greatereq) {
+ if (fuseCompareAndJump<OpGreatereq, OpJgreatereq>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_eq) {
+ if (fuseCompareAndJump<OpEq, OpJeq>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_stricteq) {
+ if (fuseCompareAndJump<OpStricteq, OpJstricteq>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_neq) {
+ if (fuseCompareAndJump<OpNeq, OpJneq>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_nstricteq) {
+ if (fuseCompareAndJump<OpNstricteq, OpJnstricteq>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_below) {
+ if (fuseCompareAndJump<OpBelow, OpJbelow>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_beloweq) {
+ if (fuseCompareAndJump<OpBeloweq, OpJbeloweq>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_eq_null && target.isForward()) {
+ if (fuseTestAndJmp<OpEqNull, OpJeqNull>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_neq_null && target.isForward()) {
+ if (fuseTestAndJmp<OpNeqNull, OpJneqNull>(cond, target))
+ return;
+ }
}
OpJtrue::emit(this, cond, target.bind(this));
@@ -1460,45 +1463,47 @@
void BytecodeGenerator::emitJumpIfFalse(RegisterID* cond, Label& target)
{
- if (m_lastOpcodeID == op_less && target.isForward()) {
- if (fuseCompareAndJump<OpLess, OpJnless>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_lesseq && target.isForward()) {
- if (fuseCompareAndJump<OpLesseq, OpJnlesseq>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_greater && target.isForward()) {
- if (fuseCompareAndJump<OpGreater, OpJngreater>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_greatereq && target.isForward()) {
- if (fuseCompareAndJump<OpGreatereq, OpJngreatereq>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_eq && target.isForward()) {
- if (fuseCompareAndJump<OpEq, OpJneq>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_stricteq && target.isForward()) {
- if (fuseCompareAndJump<OpStricteq, OpJnstricteq>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_neq && target.isForward()) {
- if (fuseCompareAndJump<OpNeq, OpJeq>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_nstricteq && target.isForward()) {
- if (fuseCompareAndJump<OpNstricteq, OpJstricteq>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_below && target.isForward()) {
- if (fuseCompareAndJump<OpBelow, OpJbeloweq>(cond, target, true))
- return;
- } else if (m_lastOpcodeID == op_beloweq && target.isForward()) {
- if (fuseCompareAndJump<OpBeloweq, OpJbelow>(cond, target, true))
- return;
- } else if (m_lastOpcodeID == op_not) {
- if (fuseTestAndJmp<OpNot, OpJtrue>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_eq_null && target.isForward()) {
- if (fuseTestAndJmp<OpEqNull, OpJneqNull>(cond, target))
- return;
- } else if (m_lastOpcodeID == op_neq_null && target.isForward()) {
- if (fuseTestAndJmp<OpNeqNull, OpJeqNull>(cond, target))
- return;
+ if (canDoPeepholeOptimization()) {
+ if (m_lastOpcodeID == op_less && target.isForward()) {
+ if (fuseCompareAndJump<OpLess, OpJnless>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_lesseq && target.isForward()) {
+ if (fuseCompareAndJump<OpLesseq, OpJnlesseq>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_greater && target.isForward()) {
+ if (fuseCompareAndJump<OpGreater, OpJngreater>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_greatereq && target.isForward()) {
+ if (fuseCompareAndJump<OpGreatereq, OpJngreatereq>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_eq && target.isForward()) {
+ if (fuseCompareAndJump<OpEq, OpJneq>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_stricteq && target.isForward()) {
+ if (fuseCompareAndJump<OpStricteq, OpJnstricteq>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_neq && target.isForward()) {
+ if (fuseCompareAndJump<OpNeq, OpJeq>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_nstricteq && target.isForward()) {
+ if (fuseCompareAndJump<OpNstricteq, OpJstricteq>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_below && target.isForward()) {
+ if (fuseCompareAndJump<OpBelow, OpJbeloweq>(cond, target, true))
+ return;
+ } else if (m_lastOpcodeID == op_beloweq && target.isForward()) {
+ if (fuseCompareAndJump<OpBeloweq, OpJbelow>(cond, target, true))
+ return;
+ } else if (m_lastOpcodeID == op_not) {
+ if (fuseTestAndJmp<OpNot, OpJtrue>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_eq_null && target.isForward()) {
+ if (fuseTestAndJmp<OpEqNull, OpJneqNull>(cond, target))
+ return;
+ } else if (m_lastOpcodeID == op_neq_null && target.isForward()) {
+ if (fuseTestAndJmp<OpNeqNull, OpJeqNull>(cond, target))
+ return;
+ }
}
OpJfalse::emit(this, cond, target.bind(this));
@@ -1707,6 +1712,9 @@
template<typename EqOp>
RegisterID* BytecodeGenerator::emitEqualityOp(RegisterID* dst, RegisterID* src1, RegisterID* src2)
{
+ if (!canDoPeepholeOptimization())
+ return false;
+
if (m_lastInstruction->is<OpTypeof>()) {
auto op = m_lastInstruction->as<OpTypeof>();
if (src1->index() == op.m_dst.offset()