Changeset 9145 in webkit for trunk/JavaScriptCore/kjs/object.h


Ignore:
Timestamp:
May 9, 2005, 4:57:33 PM (20 years ago)
Author:
darin
Message:

Reviewed by John.

  • turn on conservative GC unconditionally and start on SPI changes to eliminate the now-unneeded smart pointers since we don't ref count any more
  • kjs/value.h: Removed macros to turn conservative GC on and off. Removed ref and deref functions. (KJS::ValueImp::ValueImp): Removed non-conservative-GC code path. (KJS::ValueImp::isUndefined): Added. New SPI to make it easier to deal with ValueImp directly. (KJS::ValueImp::isNull): Ditto. (KJS::ValueImp::isBoolean): Ditto. (KJS::ValueImp::isNumber): Ditto. (KJS::ValueImp::isString): Ditto. (KJS::ValueImp::isObject): Ditto. (KJS::Value::Value): Removed non-conservative-GC code path and made constructor no longer explicit so we can quietly create Value wrappers from ValueImp *; inexpensive with conservative GC and eases the transition. (KJS::Value::operator ValueImp *): Added. Quietly creates ValueImp * from Value. (KJS::ValueImp::marked): Removed non-conservative-GC code path.
  • kjs/value.cpp: (KJS::ValueImp::mark): Removed non-conservative-GC code path. (KJS::ValueImp::isUndefinedOrNull): Added. New SPI to make it easier to deal with ValueImp directly. (KJS::ValueImp::isBoolean): Ditto. (KJS::ValueImp::isNumber): Ditto. (KJS::ValueImp::isString): Ditto. (KJS::ValueImp::asString): Ditto. (KJS::ValueImp::isObject): Ditto. (KJS::undefined): Ditto. (KJS::null): Ditto. (KJS::boolean): Ditto. (KJS::string): Ditto. (KJS::zero): Ditto. (KJS::one): Ditto. (KJS::two): Ditto. (KJS::number): Ditto.
  • kjs/object.h: Made constructor no longer explicit so we can quietly create Object wrappers from ObjectImp *; inexpensive with conservative GC and eases the transition. (KJS::Object::operator ObjectImp *): Added. Quietly creates ObjectImp * from Object. (KJS::ValueImp::isObject): Added. Implementation of new object-related ValueImp function. (KJS::ValueImp::asObject): Ditto.
  • kjs/object.cpp: (KJS::ObjectImp::setInternalValue): Remove non-conservative-GC code path. (KJS::ObjectImp::putDirect): Ditto. (KJS::error): Added. Function in the new SPI style to create an error object.
  • kjs/internal.h: Added the new number-constructing functions as friends of NumberImp. There may be a more elegant way to do this later; what's important now is the new SPI.
  • kjs/collector.h: Remove non-conservative-GC code path and also take out some unneeded APPLE_CHANGES.
  • bindings/runtime_root.cpp: (KJS::Bindings::addNativeReference): Remove non-conservative-GC code path. (KJS::Bindings::removeNativeReference): Ditto. (RootObject::removeAllNativeReferences): Ditto.
  • bindings/runtime_root.h: (KJS::Bindings::RootObject::~RootObject): Ditto. (KJS::Bindings::RootObject::setRootObjectImp): Ditto.
  • kjs/collector.cpp: (KJS::Collector::allocate): Ditto. (KJS::Collector::collect): Ditto. (KJS::Collector::numGCNotAllowedObjects): Ditto. (KJS::Collector::numReferencedObjects): Ditto. (KJS::Collector::rootObjectClasses): Ditto.
  • kjs/internal.cpp: (NumberImp::create): Ditto. (InterpreterImp::globalInit): Ditto. (InterpreterImp::globalClear): Ditto.
  • kjs/list.cpp: (KJS::List::markProtectedLists): Ditto. (KJS::List::clear): Ditto. (KJS::List::append): Ditto.
  • kjs/list.h: (KJS::List::List): Ditto. (KJS::List::deref): Ditto. (KJS::List::operator=): Ditto.
  • kjs/protect.h: (KJS::gcProtect): Ditto. (KJS::gcUnprotect): Ditto.
File:
1 edited

Legend:

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

    r8453 r9145  
    9090  public:
    9191    Object() { }
    92     explicit Object(ObjectImp *v);
     92    Object(ObjectImp *);
     93    operator ObjectImp *() const { return imp(); }
    9394   
    9495    ObjectImp *imp() const;
     
    622623                   URIError       = 6};
    623624
     625  ObjectImp *error(ExecState *exec, ErrorType type = GeneralError,
     626    const char *message = 0, int lineno = -1, int sourceId = -1, const UString *sourceURL = 0);
     627
    624628  /**
    625629   * @short Factory methods for error objects.
     
    646650  };
    647651
    648   inline Object::Object(ObjectImp *v) : Value(v) { }
    649 
    650   inline ObjectImp *Object::imp() const { return static_cast<ObjectImp*>(rep); }
     652  inline bool ValueImp::isObject(const ClassInfo *info) const
     653    { return isObject() && static_cast<const ObjectImp *>(this)->inherits(info); }
     654
     655  inline ObjectImp *ValueImp::asObject()
     656    { return isObject() ? static_cast<ObjectImp *>(this) : 0; }
     657
     658  inline Object::Object(ObjectImp *o) : Value(o) { }
     659
     660  inline ObjectImp *Object::imp() const
     661    { return static_cast<ObjectImp *>(Value::imp()); }
    651662
    652663  inline const ClassInfo *Object::classInfo() const
     
    730741    { imp()->restoreProperties(p); }
    731742
    732 }; // namespace
     743} // namespace
    733744
    734745#endif // _KJS_OBJECT_H_
Note: See TracChangeset for help on using the changeset viewer.