Changeset 1850 in webkit for trunk/JavaScriptCore/kjs/reference.h


Ignore:
Timestamp:
Aug 16, 2002, 12:07:48 PM (23 years ago)
Author:
mjs
Message:

Final step of the Reference change. Completely separate Reference
from Value, and eliminate ReferenceImp.

18% speedup on cvs-js-performance test.

  • kjs/internal.cpp, kjs/internal.h: Remove ReferenceImp.
  • kjs/nodes.cpp: (Node::evaluateReference): Use Reference::makeValueReference(), not ConstReference.
  • kjs/reference.cpp: (Reference::Reference): New implementation, handles both regular and value references. (Reference::makeValueReference): Incorporate functionality of ConstReference into this class. (Reference::getBase): New implementation (incorporates error vase for value references). (Reference::getPropertyName): New implementation (incorporates error case for value references). (Reference::putValue): New implementation (incorporates error case for value references). (Reference::deleteValue): New implementation (incorporates error case for value references). (Reference::getValue): New implementation (incorporates special case for value references). (Reference::isMutable): New implementation.
  • kjs/reference.h: New implementation that merges ReferenceImp into the stack object.
  • kjs/value.h, kjs/value.cpp: Removed all reference-related method.
File:
1 edited

Legend:

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

    r1841 r1850  
    3636    Reference(const Null& b, const UString& p);
    3737    Reference(const Null& b, unsigned p);
    38     Reference(ReferenceImp *v);
     38    static Reference makeValueReference(const Value& v);
    3939   
    40     /**
    41      * Converts a Value into an Reference. If the value's type is not
    42      * ReferenceType, a null object will be returned (i.e. one with it's
    43      * internal pointer set to 0). If you do not know for sure whether the
    44      * value is of type ReferenceType, you should check the @ref isNull()
    45      * methods afterwards before calling any methods on the returned value.
    46      *
    47      * @return The value converted to an Reference
    48      */
    49     static Reference dynamicCast(const Value &v);
    50 
    5140    /**
    5241     * Performs the GetBase type conversion operation on this value (ECMA 8.7)
     
    5544     * this method is guaranteed to return either Null() or an Object value.
    5645     */
    57     Value getBase(ExecState *exec) const { return rep->dispatchGetBase(exec); }
     46    Value getBase(ExecState *exec) const;
    5847
    5948    /**
     
    6150     * (ECMA 8.7)
    6251     */
    63     UString getPropertyName(ExecState *exec) const { return rep->dispatchGetPropertyName(exec); }
     52    UString getPropertyName(ExecState *exec) const;
    6453
    6554    /**
     
    6756     * (ECMA 8.7.1)
    6857     */
    69     Value getValue(ExecState *exec) const { return rep->dispatchGetValue(exec); }
     58    Value getValue(ExecState *exec) const;
    7059
    7160    /**
     
    7362     * (ECMA 8.7.1)
    7463     */
    75     void putValue(ExecState *exec, const Value &w) { rep->dispatchPutValue(exec, w); }
    76     bool deleteValue(ExecState *exec) { return rep->dispatchDeleteValue(exec); }
    77     bool isMutable() { return type() == ReferenceType; }
    78   };
     64    void putValue(ExecState *exec, const Value &w);
     65    bool deleteValue(ExecState *exec);
    7966
    80   class ConstReference : public Reference {
    81   public:
    82     ConstReference(ValueImp *v);
     67    bool isMutable();
     68
     69  private:
     70    Reference();
     71
     72    Value base;
     73    unsigned propertyNameAsNumber;
     74    bool baseIsValue;
     75    bool propertyNameIsNumber;
     76    mutable UString prop;
    8377  };
    8478}
Note: See TracChangeset for help on using the changeset viewer.