Changeset 2783 in webkit for trunk/JavaScriptCore/kjs/object.cpp


Ignore:
Timestamp:
Nov 20, 2002, 1:12:14 PM (23 years ago)
Author:
darin
Message:
  • decrease ref/deref -- 5% speedup in iBench
  • JavaScriptCore.pbproj/project.pbxproj: Added array_instance.h
  • kjs/array_instance.h: Added so it can be shared by function.h.
  • kjs/array_object.cpp:
  • kjs/array_object.h:
  • kjs/bool_object.cpp:
  • kjs/bool_object.h:
  • kjs/collector.cpp:
  • kjs/date_object.cpp:
  • kjs/date_object.h:
  • kjs/error_object.cpp:
  • kjs/function.cpp:
  • kjs/function.h:
  • kjs/function_object.cpp:
  • kjs/internal.cpp:
  • kjs/internal.h:
  • kjs/math_object.cpp:
  • kjs/nodes.cpp:
  • kjs/number_object.cpp:
  • kjs/object.cpp:
  • kjs/object.h:
  • kjs/object_object.cpp:
  • kjs/property_map.cpp:
  • kjs/reference.cpp:
  • kjs/reference.h:
  • kjs/regexp_object.cpp:
  • kjs/string_object.cpp:
  • kjs/string_object.h:
  • kjs/value.cpp:
  • kjs/value.h: Switched lots of interfaces so they don't require ref/deref.
File:
1 edited

Legend:

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

    r2772 r2783  
    5959}
    6060
     61ObjectImp::ObjectImp(ObjectImp *proto)
     62  : _proto(proto), _internalValue(0L), _scope(true)
     63{
     64  //fprintf(stderr,"ObjectImp::ObjectImp %p\n",(void*)this);
     65}
     66
    6167ObjectImp::ObjectImp() :
    6268  _scope(true)
     
    153159}
    154160
    155 // This get method only looks at the property map.
    156 // A bit like hasProperty(recursive=false), this doesn't go to the prototype.
    157 // This is used e.g. by lookupOrCreateFunction (to cache a function, we don't want
    158 // to look up in the prototype, it might already exist there)
    159 ValueImp* ObjectImp::getDirect(const Identifier& propertyName) const
    160 {
    161   return _prop.get(propertyName);
    162 }
    163 
    164161// ECMA 8.6.2.2
    165162void ObjectImp::put(ExecState *exec, const Identifier &propertyName,
     
    168165  assert(!value.isNull());
    169166  assert(value.type() != ListType);
     167
     168  // non-standard netscape extension
     169  if (propertyName == specialPrototypePropertyName) {
     170    setPrototype(value);
     171    return;
     172  }
    170173
    171174  /* TODO: check for write permissions directly w/o this call */
     
    178181    fprintf( stderr, "WARNING: canPut %s said NO\n", propertyName.ascii() );
    179182#endif
    180     return;
    181   }
    182 
    183   // non-standard netscape extension
    184   if (propertyName == specialPrototypePropertyName) {
    185     setPrototype(value);
    186183    return;
    187184  }
     
    395392      for (int i = 0; i < size; ++i, ++e) {
    396393        if ( e->s && !(e->attr & DontEnum) )
    397           list.append(Reference(Object(this), e->s)); /// ######### check for duplicates with the propertymap
     394          list.append(Reference(this, e->s)); /// ######### check for duplicates with the propertymap
    398395      }
    399396    }
     
    412409{
    413410  _internalValue = v.imp();
     411}
     412
     413void ObjectImp::setInternalValue(ValueImp *v)
     414{
     415  v->setGcAllowed();
     416  _internalValue = v;
    414417}
    415418
     
    445448}
    446449
     450void ObjectImp::putDirect(const Identifier &propertyName, ValueImp *value, int attr)
     451{
     452    value->setGcAllowed();
     453    _prop.put(propertyName, value, attr);
     454}
     455
     456void ObjectImp::putDirect(const Identifier &propertyName, int value, int attr)
     457{
     458    _prop.put(propertyName, NumberImp::create(value), attr);
     459}
    447460
    448461// ------------------------------ Error ----------------------------------------
Note: See TracChangeset for help on using the changeset viewer.