Changeset 9676 in webkit for trunk/JavaScriptCore/kjs/function.h


Ignore:
Timestamp:
Jul 12, 2005, 9:48:29 AM (20 years ago)
Author:
ggaren
Message:

-fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3881
arguments object should share values with function parameters

Reviewed by mjs.

ArgumentsImp now uses a simple hash lookup to share values
with the activation object.

  • kjs/function.cpp: (KJS::FunctionImp::getParameterName): (KJS::IndexToNameMap::IndexToNameMap): (KJS::IndexToNameMap::~IndexToNameMap): (KJS::IndexToNameMap::isMapped): (KJS::IndexToNameMap::unMap): (KJS::IndexToNameMap::operator[]): (KJS::ArgumentsImp::ArgumentsImp): (KJS::ArgumentsImp::mark): (KJS::ArgumentsImp::get): (KJS::ArgumentsImp::put): (KJS::ArgumentsImp::deleteProperty): (KJS::ArgumentsImp::hasOwnProperty): (KJS::ActivationImp::createArgumentsObject):
  • kjs/function.h:
  • tests/mozilla/expected.html: updated results
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/function.h

    r9618 r9676  
    5151
    5252    void addParameter(const Identifier &n);
     53    Identifier getParameterName(int index);
    5354    // parameters in string representation, e.g. (a, b, c)
    5455    UString parameterString() const;
     
    8889  };
    8990
     91  class IndexToNameMap {
     92  public:
     93    IndexToNameMap(FunctionImp *func, const List &args);
     94    ~IndexToNameMap();
     95   
     96    Identifier& operator[](int index);
     97    Identifier& operator[](const Identifier &indexIdentifier);
     98    bool isMapped(const Identifier &index) const;
     99    void IndexToNameMap::unMap(const Identifier &index);
     100   
     101  private:
     102    IndexToNameMap(); // prevent construction w/o parameters
     103    int size;
     104    Identifier * _map;
     105  };
     106 
    90107  class ArgumentsImp : public ObjectImp {
    91108  public:
    92     ArgumentsImp(ExecState *exec, FunctionImp *func, const List &args);
    93 
     109    ArgumentsImp(ExecState *exec, FunctionImp *func, const List &args, ActivationImp *act);
     110    virtual void mark();
     111    virtual Value get(ExecState *exec, const Identifier &propertyName) const;
     112    virtual void put(ExecState *exec, const Identifier &propertyName,
     113                     const Value &value, int attr = None);
     114    virtual bool hasOwnProperty(ExecState *exec, const Identifier &propertyName) const;
     115    virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
    94116    virtual const ClassInfo *classInfo() const { return &info; }
    95117    static const ClassInfo info;
     118  private:
     119    ActivationImp *_activationObject;
     120    mutable IndexToNameMap indexToNameMap;
    96121  };
    97122
Note: See TracChangeset for help on using the changeset viewer.