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


Ignore:
Timestamp:
Nov 18, 2002, 11:57:11 PM (23 years ago)
Author:
darin
Message:

JavaScriptCore:

  • reduced the creation of Value objects and hoisted the property map into Object for another gain of about 6%
  • JavaScriptCore.pbproj/project.pbxproj: Made property_map.h public.
  • kjs/array_object.cpp: (compareWithCompareFunctionForQSort): Don't wrap the ValueImp * in a Value just to add it to a list. (ArrayProtoFuncImp::call): Pass the globalObject directly so we don't have to ref/deref.
  • kjs/function.cpp: (FunctionImp::call): Use a reference for the global object to avoid ref/deref. (GlobalFuncImp::call): Ditto.
  • kjs/internal.cpp: (BooleanImp::toObject): Put the object directly into the list, don't create a Value. (StringImp::toObject): Ditto. (NumberImp::toObject): Ditto. (InterpreterImp::evaluate): Use a reference for the global object.
  • kjs/internal.h: Return a reference for the global object.
  • kjs/interpreter.cpp: (Interpreter::globalObject): Ditto.
  • kjs/interpreter.h: Ditto.
  • kjs/object.cpp: Use _prop directly in the object, not a separate pointer.
  • kjs/object.h: Ditto.
  • kjs/types.cpp: Added List methods that work directly with ValueImp. (List::append): Added a ValueImp version. (List::prepend): Ditto. (List::appendList): Work directly with the ValueImp's. (List::prependList): Ditto. (List::copy): Use appendList. (List::empty): Use a shared global List.
  • kjs/types.h: Update for above changes.

WebCore:

  • force-js-clean-timestamp: Another Object change.
File:
1 edited

Legend:

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

    r2741 r2753  
    3838#include "error_object.h"
    3939#include "nodes.h"
    40 #include "property_map.h"
    4140
    4241namespace KJS {
     
    6261
    6362ObjectImp::ObjectImp(const Object &proto)
    64   : _prop(0), _proto(static_cast<ObjectImp*>(proto.imp())), _internalValue(0L), _scope(true)
     63  : _proto(static_cast<ObjectImp*>(proto.imp())), _internalValue(0L), _scope(true)
    6564{
    6665  //fprintf(stderr,"ObjectImp::ObjectImp %p\n",(void*)this);
    67   _prop = new PropertyMap();
    6866}
    6967
     
    7270{
    7371  //fprintf(stderr,"ObjectImp::ObjectImp %p\n",(void*)this);
    74   _prop = 0;
    7572  _proto = NullImp::staticNull;
    7673  _internalValue = 0L;
    77   _prop = new PropertyMap();
    7874}
    7975
     
    8177{
    8278  //fprintf(stderr,"ObjectImp::~ObjectImp %p\n",(void*)this);
    83   delete _prop;
    8479}
    8580
     
    9287    _proto->mark();
    9388
    94   _prop->mark();
     89  _prop.mark();
    9590
    9691  if (_internalValue && !_internalValue->marked())
     
    171166ValueImp* ObjectImp::getDirect(const UString& propertyName) const
    172167{
    173   return _prop->get(propertyName);
     168  return _prop.get(propertyName);
    174169}
    175170
     
    199194  }
    200195
    201   _prop->put(propertyName,value.imp(),attr);
     196  _prop.put(propertyName,value.imp(),attr);
    202197}
    203198
     
    212207{
    213208  int attributes;
    214   ValueImp *v = _prop->get(propertyName, attributes);
     209  ValueImp *v = _prop.get(propertyName, attributes);
    215210  if (v)
    216211    return!(attributes & ReadOnly);
     
    229224bool ObjectImp::hasProperty(ExecState *exec, const UString &propertyName) const
    230225{
    231   if (_prop->get(propertyName))
     226  if (_prop.get(propertyName))
    232227    return true;
    233228
     
    254249{
    255250  int attributes;
    256   ValueImp *v = _prop->get(propertyName, attributes);
     251  ValueImp *v = _prop.get(propertyName, attributes);
    257252  if (v) {
    258253    if ((attributes & DontDelete))
    259254      return false;
    260     _prop->remove(propertyName);
     255    _prop.remove(propertyName);
    261256    return true;
    262257  }
     
    276271void ObjectImp::deleteAllProperties( ExecState * )
    277272{
    278   _prop->clear();
     273  _prop.clear();
    279274}
    280275
     
    397392    list = static_cast<ObjectImp*>(_proto)->propList(exec,recursive);
    398393
    399   _prop->addEnumerablesToReferenceList(list, Object(this));
     394  _prop.addEnumerablesToReferenceList(list, Object(this));
    400395
    401396  // Add properties from the static hashtable of properties
Note: See TracChangeset for help on using the changeset viewer.