Groundwork for reimplementing the slow script dialog
[WebKit-https.git] / JavaScriptCore / VM / CodeGenerator.cpp
index b5f3e5a..bfab3ee 100644 (file)
@@ -420,6 +420,7 @@ void CodeGenerator::rewindBinaryOp()
 
 PassRefPtr<LabelID> CodeGenerator::emitJump(LabelID* target)
 {
+    ASSERT(target->isForwardLabel());
     emitOpcode(op_jmp);
     instructions().append(target->offsetFrom(instructions().size()));
     return target;
@@ -436,7 +437,7 @@ PassRefPtr<LabelID> CodeGenerator::emitJumpIfTrueMayCombine(RegisterID* cond, La
         
         if (cond->index() == dstIndex) {
             rewindBinaryOp();
-            emitOpcode(op_jless);
+            emitOpcode(target->isForwardLabel() ? op_jless : op_loop_if_less);
             instructions().append(src1Index);
             instructions().append(src2Index);
             instructions().append(target->offsetFrom(instructions().size()));
@@ -449,7 +450,7 @@ PassRefPtr<LabelID> CodeGenerator::emitJumpIfTrueMayCombine(RegisterID* cond, La
 
 PassRefPtr<LabelID> CodeGenerator::emitJumpIfTrue(RegisterID* cond, LabelID* target)
 {
-    emitOpcode(op_jtrue);
+    emitOpcode(target->isForwardLabel() ? op_jtrue : op_loop_if_true);
     instructions().append(cond->index());
     instructions().append(target->offsetFrom(instructions().size()));
     return target;
@@ -457,6 +458,7 @@ PassRefPtr<LabelID> CodeGenerator::emitJumpIfTrue(RegisterID* cond, LabelID* tar
 
 PassRefPtr<LabelID> CodeGenerator::emitJumpIfFalse(RegisterID* cond, LabelID* target)
 {
+    ASSERT(target->isForwardLabel());
     emitOpcode(op_jfalse);
     instructions().append(cond->index());
     instructions().append(target->offsetFrom(instructions().size()));
@@ -1031,6 +1033,7 @@ PassRefPtr<LabelID> CodeGenerator::emitComplexJumpScopes(LabelID* target, Contro
 PassRefPtr<LabelID> CodeGenerator::emitJumpScopes(LabelID* target, int targetScopeDepth)
 {
     ASSERT(scopeDepth() - targetScopeDepth >= 0);
+    ASSERT(target->isForwardLabel());
 
     size_t scopeDelta = scopeDepth() - targetScopeDepth;
     ASSERT(scopeDelta <= m_scopeContextStack.size());