Post Squirrelfish there is no longer a performance gain in having separate nodes for inc and dec – merging these will simplify & reduce code duplication in the parse tree. Patch following.
Created attachment 21908 [details] Patch to merge inc/dec halves of PrefixResolveNode and PostfixResolveNode
Comment on attachment 21908 [details] Patch to merge inc/dec halves of PrefixResolveNode and PostfixResolveNode I think this is unnecessary: + RegisterID* (CodeGenerator::*emitPostIncOrDec)(RegisterID* dst, RegisterID* srcDst) = (m_operator == OpPlusPlus) ? &CodeGenerator::emitPostInc : &CodeGenerator::emitPostDec; + RegisterID* (CodeGenerator::*emitPreIncOrDec)(RegisterID* srcDst) = (m_operator == OpPlusPlus) ? &CodeGenerator::emitPreInc : &CodeGenerator::emitPreDec; Use CodeGenerator::emitUnaryOp() and CodeGenerator::emitUnaryNoDstOp() with an inline conditional expression, or make a helper function. You don't need parentheses around the entire conditional expression here: + RefPtr<RegisterID> r0 = generator.emitLoad(generator.finalDestination(dst), ((m_operator == OpPlusPlus) ? 1.0 : -1.0)); Also, rewrite the FIXME comment in PostfixResolveNode::emitCode() so it is still correct.
Created attachment 21930 [details] No method pointers, fewer parentheses, fixed fixme. Cameron, I've replaced the method pointers with simple static helper methods in nodes.cpp – if you could have a look & see what you think that'd be great. cheers, G.
Comment on attachment 21930 [details] No method pointers, fewer parentheses, fixed fixme. r=me
Sending JavaScriptCore/ChangeLog Sending JavaScriptCore/kjs/grammar.y Sending JavaScriptCore/kjs/nodes.cpp Sending JavaScriptCore/kjs/nodes.h Sending JavaScriptCore/kjs/nodes2string.cpp Transmitting file data ..... Committed revision 35222.