Commit db79713c authored by cwzwarich@webkit.org's avatar cwzwarich@webkit.org

2008-06-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>

        Reviewed by Maciej.

        Make the conversion of the pair (less, jtrue) to jless use register
        reference counting information for safety instead of requiring callers
        to decide whether it is safe.

        No changes on SunSpider codegen.

        * VM/CodeGenerator.cpp:
        (KJS::CodeGenerator::emitJumpIfTrue):
        * VM/CodeGenerator.h:
        * kjs/nodes.cpp:
        (KJS::DoWhileNode::emitCode):
        (KJS::WhileNode::emitCode):
        (KJS::ForNode::emitCode):
        (KJS::CaseBlockNode::emitCodeForBlock):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34784 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8183796d
2008-06-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
Make the conversion of the pair (less, jtrue) to jless use register
reference counting information for safety instead of requiring callers
to decide whether it is safe.
No changes on SunSpider codegen.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitJumpIfTrue):
* VM/CodeGenerator.h:
* kjs/nodes.cpp:
(KJS::DoWhileNode::emitCode):
(KJS::WhileNode::emitCode):
(KJS::ForNode::emitCode):
(KJS::CaseBlockNode::emitCodeForBlock):
2008-06-24 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
......
......@@ -425,7 +425,7 @@ PassRefPtr<LabelID> CodeGenerator::emitJump(LabelID* target)
return target;
}
PassRefPtr<LabelID> CodeGenerator::emitJumpIfTrueMayCombine(RegisterID* cond, LabelID* target)
PassRefPtr<LabelID> CodeGenerator::emitJumpIfTrue(RegisterID* cond, LabelID* target)
{
if (m_lastOpcodeID == op_less) {
int dstIndex;
......@@ -434,7 +434,7 @@ PassRefPtr<LabelID> CodeGenerator::emitJumpIfTrueMayCombine(RegisterID* cond, La
retrieveLastBinaryOp(dstIndex, src1Index, src2Index);
if (cond->index() == dstIndex) {
if (cond->index() == dstIndex && !cond->refCount()) {
rewindBinaryOp();
emitOpcode(op_jless);
instructions().append(src1Index);
......@@ -444,11 +444,6 @@ PassRefPtr<LabelID> CodeGenerator::emitJumpIfTrueMayCombine(RegisterID* cond, La
}
}
return emitJumpIfTrue(cond, target);
}
PassRefPtr<LabelID> CodeGenerator::emitJumpIfTrue(RegisterID* cond, LabelID* target)
{
emitOpcode(op_jtrue);
instructions().append(cond->index());
instructions().append(target->offsetFrom(instructions().size()));
......
......@@ -245,7 +245,6 @@ namespace KJS {
PassRefPtr<LabelID> emitLabel(LabelID*);
PassRefPtr<LabelID> emitJump(LabelID* target);
PassRefPtr<LabelID> emitJumpIfTrueMayCombine(RegisterID* cond, LabelID* target);
PassRefPtr<LabelID> emitJumpIfTrue(RegisterID* cond, LabelID* target);
PassRefPtr<LabelID> emitJumpIfFalse(RegisterID* cond, LabelID* target);
PassRefPtr<LabelID> emitJumpScopes(LabelID* target, int targetScopeDepth);
......
......@@ -1200,7 +1200,7 @@ RegisterID* DoWhileNode::emitCode(CodeGenerator& generator, RegisterID* dst)
generator.emitLabel(continueTarget.get());
RegisterID* cond = generator.emitNode(m_expr.get());
generator.emitJumpIfTrueMayCombine(cond, topOfLoop.get());
generator.emitJumpIfTrue(cond, topOfLoop.get());
generator.emitLabel(breakTarget.get());
return result.get();
}
......@@ -1222,7 +1222,7 @@ RegisterID* WhileNode::emitCode(CodeGenerator& generator, RegisterID* dst)
generator.emitLabel(continueTarget.get());
RegisterID* cond = generator.emitNode(m_expr.get());
generator.emitJumpIfTrueMayCombine(cond, topOfLoop.get());
generator.emitJumpIfTrue(cond, topOfLoop.get());
generator.emitLabel(breakTarget.get());
......@@ -1254,7 +1254,7 @@ RegisterID* ForNode::emitCode(CodeGenerator& generator, RegisterID* dst)
generator.emitLabel(beforeCondition.get());
if (m_expr2) {
RegisterID* cond = generator.emitNode(m_expr2.get());
generator.emitJumpIfTrueMayCombine(cond, topOfLoop.get());
generator.emitJumpIfTrue(cond, topOfLoop.get());
} else {
generator.emitJump(topOfLoop.get());
}
......@@ -1422,14 +1422,14 @@ RegisterID* CaseBlockNode::emitCodeForBlock(CodeGenerator& generator, RegisterID
RegisterID* clauseVal = generator.emitNode(list->getClause()->expr());
generator.emitBinaryOp(op_stricteq, clauseVal, clauseVal, switchExpression);
labelVector.append(generator.newLabel());
generator.emitJumpIfTrueMayCombine(clauseVal, labelVector[labelVector.size() - 1].get());
generator.emitJumpIfTrue(clauseVal, labelVector[labelVector.size() - 1].get());
}
for (ClauseListNode* list = m_list2.get(); list; list = list->getNext()) {
RegisterID* clauseVal = generator.emitNode(list->getClause()->expr());
generator.emitBinaryOp(op_stricteq, clauseVal, clauseVal, switchExpression);
labelVector.append(generator.newLabel());
generator.emitJumpIfTrueMayCombine(clauseVal, labelVector[labelVector.size() - 1].get());
generator.emitJumpIfTrue(clauseVal, labelVector[labelVector.size() - 1].get());
}
RefPtr<LabelID> defaultLabel;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment