Ignore:
Timestamp:
Aug 12, 2005, 12:36:00 AM (20 years ago)
Author:
mjs
Message:

Reviewed by hyatt.

  • refactor function calls, 3% speedup on JS iBench.
  • kjs/grammar.y:
  • kjs/nodes.cpp: (Node::throwError): Added new useful variants. (FunctionCallValueNode::evaluate): New node to handle calls on expressions that are strictly values, not references. (FunctionCallValueNode::ref): ditto (FunctionCallValueNode::deref): ditto (FunctionCallResolveNode::evaluate): New node to handle calls on identifier expressions, so that they are looked up in the scope chain. (FunctionCallResolveNode::ref): ditto (FunctionCallResolveNode::deref): ditto (FunctionCallBracketNode::evaluate): New node to handle calls on bracket dereferences, so that the expression before brackets is used as the this object. (FunctionCallBracketNode::ref): ditto (FunctionCallBracketNode::deref): ditto (FunctionCallDotNode::evaluate): New node to handle calls on dot dereferences, so that the expression before the dot is used as the this object. (FunctionCallDotNode::ref): ditto (FunctionCallDotNode::deref): ditto (dotExprNotAnObjectString): helper function to avoid global variable access. (dotExprDoesNotAllowCallsString): ditto
  • kjs/nodes.h: Declared new classes.
  • kjs/nodes2string.cpp: (FunctionCallValueNode::streamTo): Added - serializes the appropriate function call (FunctionCallResolveNode::streamTo): ditto (FunctionCallBracketNode::streamTo): ditto (FunctionCallParenBracketNode::streamTo): ditto (FunctionCallDotNode::streamTo): ditto (FunctionCallParenDotNode::streamTo): ditto
  • kjs/object.h: (KJS::ObjectImp::isActivation): Change how activation objects are detected in the scope chain, a virtual function is cheaper than the old inheritance test.
  • kjs/function.h: (KJS::ActivationImp::isActivation): Ditto.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/nodes2string.cpp

    r10135 r10148  
    196196}
    197197
    198 void FunctionCallNode::streamTo(SourceStream &s) const
     198void FunctionCallValueNode::streamTo(SourceStream &s) const
    199199{
    200200  s << expr << args;
     201}
     202
     203void FunctionCallResolveNode::streamTo(SourceStream &s) const
     204{
     205  s << ident << args;
     206}
     207
     208void FunctionCallBracketNode::streamTo(SourceStream &s) const
     209{
     210  s << base << "[" << subscript << "]" << args;
     211}
     212
     213void FunctionCallParenBracketNode::streamTo(SourceStream &s) const
     214{
     215  s << "(" << base << "[" << subscript << "])" << args;
     216}
     217
     218void FunctionCallDotNode::streamTo(SourceStream &s) const
     219{
     220  s << base << "." << ident << args;
     221}
     222
     223void FunctionCallParenDotNode::streamTo(SourceStream &s) const
     224{
     225  s << "(" << base << "." << ident << ")" << args;
    201226}
    202227
Note: See TracChangeset for help on using the changeset viewer.