From 112b8596063a21330ab474100e2cf310cc4304cc Mon Sep 17 00:00:00 2001 From: "barraclough@apple.com" Date: Fri, 30 Sep 2011 23:05:59 +0000 Subject: [PATCH] DFG JIT, Branch on integer can always be a 32-bit compare. https://bugs.webkit.org/show_bug.cgi?id=69174 Reviewed by Sam Weinig. if (shouldSpeculateInteger(node.child1()) && !isStrictInt32(node.child1())), the JSVALUE64 JIT will currently compare all 64bits in the register, but in these cases the DataFormat is always a JS boxed integer. In these cases we can just compare the low 32bits anyway - no need to check the tag. This allows the code to be unified with the JSVALUE32_64 JIT. * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96436 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/JavaScriptCore/ChangeLog | 18 +++++++++++++++ .../JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp | 2 +- Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp | 27 ++-------------------- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 1c4ea63..40f48345 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,21 @@ +2011-09-30 Gavin Barraclough + + DFG JIT, Branch on integer can always be a 32-bit compare. + https://bugs.webkit.org/show_bug.cgi?id=69174 + + Reviewed by Sam Weinig. + + if (shouldSpeculateInteger(node.child1()) && !isStrictInt32(node.child1())), + the JSVALUE64 JIT will currently compare all 64bits in the register, but in + these cases the DataFormat is always a JS boxed integer. In these cases we + can just compare the low 32bits anyway - no need to check the tag. + This allows the code to be unified with the JSVALUE32_64 JIT. + + * dfg/DFGSpeculativeJIT32_64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + 2011-09-30 Oliver Hunt Need a sensible GGC policy diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp index f4e7f2f..aa5d2f0 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp @@ -1270,7 +1270,7 @@ void SpeculativeJIT::compile(Node& node) case Branch: if (isStrictInt32(node.child1()) || shouldSpeculateInteger(node.child1())) { - SpeculateStrictInt32Operand op(this, node.child1()); + SpeculateIntegerOperand op(this, node.child1()); BlockIndex taken = m_jit.graph().blockIndexForBytecodeOffset(node.takenBytecodeOffset()); BlockIndex notTaken = m_jit.graph().blockIndexForBytecodeOffset(node.notTakenBytecodeOffset()); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp index 7d7a9aa..ceec934 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp @@ -1363,8 +1363,8 @@ void SpeculativeJIT::compile(Node& node) } case Branch: - if (isStrictInt32(node.child1())) { - SpeculateStrictInt32Operand op(this, node.child1()); + if (isStrictInt32(node.child1()) || shouldSpeculateInteger(node.child1())) { + SpeculateIntegerOperand op(this, node.child1()); BlockIndex taken = m_jit.graph().blockIndexForBytecodeOffset(node.takenBytecodeOffset()); BlockIndex notTaken = m_jit.graph().blockIndexForBytecodeOffset(node.notTakenBytecodeOffset()); @@ -1385,29 +1385,6 @@ void SpeculativeJIT::compile(Node& node) noResult(m_compileIndex); break; } - if (shouldSpeculateInteger(node.child1())) { - SpeculateIntegerOperand op(this, node.child1()); - - BlockIndex taken = m_jit.graph().blockIndexForBytecodeOffset(node.takenBytecodeOffset()); - BlockIndex notTaken = m_jit.graph().blockIndexForBytecodeOffset(node.notTakenBytecodeOffset()); - - MacroAssembler::RelationalCondition condition = MacroAssembler::NotEqual; - - if (taken == (m_block + 1)) { - condition = MacroAssembler::Equal; - BlockIndex tmp = taken; - taken = notTaken; - notTaken = tmp; - } - - addBranch(m_jit.branchPtr(condition, op.gpr(), GPRInfo::tagTypeNumberRegister), taken); - - if (notTaken != (m_block + 1)) - addBranch(m_jit.jump(), notTaken); - - noResult(m_compileIndex); - break; - } emitBranch(node); break; -- 2.7.4