Ignore:
Timestamp:
Jun 13, 2008, 9:40:45 PM (17 years ago)
Author:
[email protected]
Message:

2008-06-13 Cameron Zwarich <[email protected]>

Reviewed by Maciej.

Eliminate the use of temporaries to store the left hand side of an
expression when the right hand side is a constant. This slightly
improves the generated bytecode for a few SunSpider tests, but it is
mostly in preparation for fixing

Bug 19484: More instructions needs to use temporary registers
<https://bugs.webkit.org/show_bug.cgi?id=19484>

  • VM/CodeGenerator.h: (KJS::CodeGenerator::leftHandSideNeedsCopy): (KJS::CodeGenerator::emitNodeForLeftHandSide):
  • kjs/nodes.cpp: (KJS::BracketAccessorNode::emitCode): (KJS::ReadModifyResolveNode::emitCode): (KJS::AssignDotNode::emitCode): (KJS::ReadModifyDotNode::emitCode): (KJS::AssignBracketNode::emitCode): (KJS::ReadModifyBracketNode::emitCode):
  • kjs/nodes.h: (KJS::ExpressionNode::): (KJS::FalseNode::): (KJS::TrueNode::): (KJS::NumberNode::): (KJS::StringNode::):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/CodeGenerator.h

    r34510 r34528  
    172172        }
    173173
    174         ALWAYS_INLINE bool leftHandSideNeedsCopy(bool rightHasAssignments)
    175         {
    176             return m_codeType != FunctionCode || m_codeBlock->needsFullScopeChain || rightHasAssignments;
    177         }
    178 
    179         ALWAYS_INLINE PassRefPtr<RegisterID> emitNodeForLeftHandSide(ExpressionNode* n, bool rightHasAssignments)
    180         {
    181             if (leftHandSideNeedsCopy(rightHasAssignments)) {
     174        ALWAYS_INLINE bool leftHandSideNeedsCopy(bool rightHasAssignments, bool rightIsConstant)
     175        {
     176            return (m_codeType != FunctionCode || m_codeBlock->needsFullScopeChain || rightHasAssignments) && !rightIsConstant;
     177        }
     178
     179        ALWAYS_INLINE PassRefPtr<RegisterID> emitNodeForLeftHandSide(ExpressionNode* n, bool rightHasAssignments, bool rightIsConstant)
     180        {
     181            if (leftHandSideNeedsCopy(rightHasAssignments, rightIsConstant)) {
    182182                PassRefPtr<RegisterID> dst = newTemporary();
    183183                emitNode(dst.get(), n);
Note: See TracChangeset for help on using the changeset viewer.