Changeset 1850 in webkit for trunk/JavaScriptCore/kjs/value.cpp


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/value.cpp

    r1832 r1850  
    141141}
    142142
    143 // ECMA 8.7.1
    144 Value ValueImp::getBase(ExecState *exec) const
    145 {
    146   Object err = Error::create(exec, ReferenceError, I18N_NOOP("Invalid reference base"));
    147   exec->setException(err);
    148   return err;
    149 }
    150 
    151 // ECMA 8.7.2
    152 UString ValueImp::getPropertyName(ExecState * /*exec*/) const
    153 {
    154   // the spec wants a runtime error here. But getValue() and putValue()
    155   // will catch this case on their own earlier. When returning a Null
    156   // string we should be on the safe side.
    157   return UString();
    158 }
    159 
    160 // ECMA 8.7.1
    161 Value ValueImp::getValue(ExecState *exec) const
    162 {
    163   return Value(const_cast<ValueImp*>(this));
    164 }
    165 
    166 void ValueImp::putValue(ExecState *exec, const Value& w)
    167 {
    168   Object err = Error::create(exec,ReferenceError);
    169   exec->setException(err);
    170 }
    171 
    172 bool ValueImp::deleteValue(ExecState *exec)
    173 {
    174   Object err = Error::create(exec,ReferenceError);
    175   exec->setException(err);
    176   return false;
    177 }
    178 
    179143// Dispatchers for virtual functions, to special-case simple numbers which
    180144// won't be real pointers.
     
    234198}
    235199
    236 Value ValueImp::dispatchGetBase(ExecState *exec) const
    237 {
    238   if (SimpleNumber::is(this))
    239     return ValueImp::getBase(exec);
    240   return getBase(exec);
    241 }
    242 
    243 UString ValueImp::dispatchGetPropertyName(ExecState *exec) const
    244 {
    245   if (SimpleNumber::is(this))
    246     return ValueImp::getPropertyName(exec);
    247   return getPropertyName(exec);
    248 }
    249 
    250 void ValueImp::dispatchPutValue(ExecState *exec, const Value& w)
    251 {
    252   if (SimpleNumber::is(this))
    253     ValueImp::putValue(exec, w);
    254   putValue(exec, w);
    255 }
    256 
    257 bool ValueImp::dispatchDeleteValue(ExecState *exec)
    258 {
    259   if (SimpleNumber::is(this))
    260     return ValueImp::deleteValue(exec);
    261   return deleteValue(exec);
    262 }
    263 
    264 
    265200// ------------------------------ Value ----------------------------------------
    266201
Note: See TracChangeset for help on using the changeset viewer.