Ignore:
Timestamp:
Jan 11, 2007, 4:46:36 PM (18 years ago)
Author:
ggaren
Message:

Reviewed by Anders Carlsson.

Even more cleanup in preparation for fixing <rdar://problem/4608404>
WebScriptObject's _executionContext lack of ownership policy causes
crashes (e.g., in Dashcode)


Layout tests pass.


Renames:

ReferencesSet | ProtectCounts => ProtectCountSet (because it's a typename for a set of GC protect counts)
ReferencesByRootMap => RootObjectMap (because RootObjectToProtectCountSetMap would have been confusing)
pv => protectedValues
rootObjectForImp => getRootObject (overloaded for JSObject* and Interpreter*)
rootObjectForInterpreter => getRootObject (ditto)
findReferenceSet => getProtectCountSet
imp => jsObject


(KJS::Bindings::getRootObjectMap): Changed to take advantage of built-in
facility for initializing static variables.

(KJS::Bindings::getProtectCountSet):
(KJS::Bindings::destroyProtectCountSet): Added. Helps encapsulate the fact
that getting a ProtectCountSet entails adding a RootObject to a hash table,
and destroying one entails the reverse.

(KJS::Bindings::getRootObject): Removed spurious NULL check.


(KJS::Bindings::findReferenceSet): Renamed. Changed to use getRootObject()
instead of iterating on its own.

(KJS::Bindings::addNativeReference): Changed to use an early return instead
of indenting the whole function.
(KJS::Bindings::removeNativeReference): Ditto.

File:
1 edited

Legend:

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

    r17566 r18786  
    418418}
    419419
    420 typedef HashCountedSet<JSCell *> ProtectCounts;
    421 
    422 static ProtectCounts& protectedValues()
    423 {
    424     static ProtectCounts pv;
    425     return pv;
     420typedef HashCountedSet<JSCell*> ProtectCountSet;
     421
     422static ProtectCountSet& protectedValues()
     423{
     424    static ProtectCountSet staticProtectCountSet;
     425    return staticProtectCountSet;
    426426}
    427427
     
    450450void Collector::markProtectedObjects()
    451451{
    452   ProtectCounts& pv = protectedValues();
    453   ProtectCounts::iterator end = pv.end();
    454   for (ProtectCounts::iterator it = pv.begin(); it != end; ++it) {
     452  ProtectCountSet& protectedValues = KJS::protectedValues();
     453  ProtectCountSet::iterator end = protectedValues.end();
     454  for (ProtectCountSet::iterator it = protectedValues.begin(); it != end; ++it) {
    455455    JSCell *val = it->first;
    456456    if (!val->marked())
     
    670670    HashCountedSet<const char*>* counts = new HashCountedSet<const char*>;
    671671
    672     ProtectCounts& pv = protectedValues();
    673     ProtectCounts::iterator end = pv.end();
    674     for (ProtectCounts::iterator it = pv.begin(); it != end; ++it)
     672    ProtectCountSet& protectedValues = KJS::protectedValues();
     673    ProtectCountSet::iterator end = protectedValues.end();
     674    for (ProtectCountSet::iterator it = protectedValues.begin(); it != end; ++it)
    675675        counts->add(typeName(it->first));
    676676
Note: See TracChangeset for help on using the changeset viewer.