Skip to content
Permalink
Browse files
Convert markstack to a slot visitor API
https://bugs.webkit.org/show_bug.cgi?id=53219

rolling r77006 and r77020 back in.

Canonical link: https://commits.webkit.org/67251@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@77098 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
ojhunt committed Jan 31, 2011
1 parent 93b03eb commit c92a12075a9fd7b9ed98f3b731205af420483d02
Showing 127 changed files with 1,313 additions and 695 deletions.
@@ -54,11 +54,11 @@ struct JSCallbackObjectData {
return m_privateProperties->getPrivateProperty(propertyName);
}

void setPrivateProperty(const Identifier& propertyName, JSValue value)
void setPrivateProperty(JSGlobalData& globalData, JSCell* owner, const Identifier& propertyName, JSValue value)
{
if (!m_privateProperties)
m_privateProperties = adoptPtr(new JSPrivatePropertyMap);
m_privateProperties->setPrivateProperty(propertyName, value);
m_privateProperties->setPrivateProperty(globalData, owner, propertyName, value);
}

void deletePrivateProperty(const Identifier& propertyName)
@@ -83,12 +83,13 @@ struct JSCallbackObjectData {
PrivatePropertyMap::const_iterator location = m_propertyMap.find(propertyName.impl());
if (location == m_propertyMap.end())
return JSValue();
return location->second;
return location->second.get();
}

void setPrivateProperty(const Identifier& propertyName, JSValue value)
void setPrivateProperty(JSGlobalData& globalData, JSCell* owner, const Identifier& propertyName, JSValue value)
{
m_propertyMap.set(propertyName.impl(), value);
WriteBarrier<Unknown> empty;
m_propertyMap.add(propertyName.impl(), empty).first->second.set(globalData, owner, value);
}

void deletePrivateProperty(const Identifier& propertyName)
@@ -100,12 +101,12 @@ struct JSCallbackObjectData {
{
for (PrivatePropertyMap::iterator ptr = m_propertyMap.begin(); ptr != m_propertyMap.end(); ++ptr) {
if (ptr->second)
markStack.append(ptr->second);
markStack.append(&ptr->second);
}
}

private:
typedef HashMap<RefPtr<StringImpl>, JSValue, IdentifierRepHash> PrivatePropertyMap;
typedef HashMap<RefPtr<StringImpl>, WriteBarrier<Unknown>, IdentifierRepHash> PrivatePropertyMap;
PrivatePropertyMap m_propertyMap;
};
OwnPtr<JSPrivatePropertyMap> m_privateProperties;
@@ -137,9 +138,9 @@ class JSCallbackObject : public Base {
return m_callbackObjectData->getPrivateProperty(propertyName);
}

void setPrivateProperty(const Identifier& propertyName, JSValue value)
void setPrivateProperty(JSGlobalData& globalData, const Identifier& propertyName, JSValue value)
{
m_callbackObjectData->setPrivateProperty(propertyName, value);
m_callbackObjectData->setPrivateProperty(globalData, this, propertyName, value);
}

void deletePrivateProperty(const Identifier& propertyName)
@@ -238,7 +238,7 @@ void JSCallbackObject<Base>::put(ExecState* exec, const Identifier& propertyName
if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.impl())) {
if (entry->attributes & kJSPropertyAttributeReadOnly)
return;
JSCallbackObject<Base>::putDirect(propertyName, value); // put as override property
JSCallbackObject<Base>::putDirect(exec->globalData(), propertyName, value); // put as override property
return;
}
}
@@ -565,7 +565,7 @@ JSValue JSCallbackObject<Base>::staticFunctionGetter(ExecState* exec, JSValue sl
if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) {

JSObject* o = new (exec) JSCallbackFunction(exec, asGlobalObject(thisObj->getAnonymousValue(0)), callAsFunction, propertyName);
thisObj->putDirect(propertyName, o, entry->attributes);
thisObj->putDirect(exec->globalData(), propertyName, o, entry->attributes);
return o;
}
}
@@ -108,7 +108,7 @@ JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObje
jsPrototype = exec->lexicalGlobalObject()->objectPrototype();

JSCallbackConstructor* constructor = new (exec) JSCallbackConstructor(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackConstructorStructure(), jsClass, callAsConstructor);
constructor->putDirect(exec->propertyNames().prototype, jsPrototype, DontEnum | DontDelete | ReadOnly);
constructor->putDirect(exec->globalData(), exec->propertyNames().prototype, jsPrototype, DontEnum | DontDelete | ReadOnly);
return toRef(constructor);
}

@@ -385,11 +385,11 @@ bool JSObjectSetPrivateProperty(JSContextRef ctx, JSObjectRef object, JSStringRe
JSValue jsValue = value ? toJS(exec, value) : JSValue();
Identifier name(propertyName->identifier(&exec->globalData()));
if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::info)) {
static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivateProperty(name, jsValue);
static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivateProperty(exec->globalData(), name, jsValue);
return true;
}
if (jsObject->inherits(&JSCallbackObject<JSObjectWithGlobalObject>::info)) {
static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->setPrivateProperty(name, jsValue);
static_cast<JSCallbackObject<JSObjectWithGlobalObject>*>(jsObject)->setPrivateProperty(exec->globalData(), name, jsValue);
return true;
}
return false;
@@ -37,7 +37,7 @@ class JSObject;

typedef void (*JSWeakMapDestroyedCallback)(struct OpaqueJSWeakObjectMap*, void*);

typedef JSC::WeakGCMap<void*, JSC::JSObject*> WeakMapType;
typedef JSC::WeakGCMap<void*, JSC::JSObject> WeakMapType;

struct OpaqueJSWeakObjectMap : public RefCounted<OpaqueJSWeakObjectMap> {
public:

0 comments on commit c92a120

Please sign in to comment.