]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - debugger/DebuggerActivation.cpp
JavaScriptCore-7600.1.4.17.5.tar.gz
[apple/javascriptcore.git] / debugger / DebuggerActivation.cpp
index 9d4dcbf9ff187cedee5736534b1ed7b18c9aa7f1..1340ff7f9e1818661ea4f16fe669dad445948949 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include "DebuggerActivation.h"
 
 #include "JSActivation.h"
+#include "JSCInlines.h"
 
 namespace JSC {
 
-DebuggerActivation::DebuggerActivation(JSObject* activation)
-    : JSObject(DebuggerActivation::createStructure(jsNull()))
-{
-    ASSERT(activation);
-    ASSERT(activation->isActivationObject());
-    m_activation = static_cast<JSActivation*>(activation);
-}
+STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(DebuggerActivation);
 
-void DebuggerActivation::mark()
-{
-    JSObject::mark();
-    if (m_activation && !m_activation->marked())
-        m_activation->mark();
-}
+const ClassInfo DebuggerActivation::s_info = { "DebuggerActivation", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(DebuggerActivation) };
 
-UString DebuggerActivation::className() const
+DebuggerActivation::DebuggerActivation(VM& vm)
+    : JSNonFinalObject(vm, vm.debuggerActivationStructure.get())
 {
-    return m_activation->className();
 }
 
-bool DebuggerActivation::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+void DebuggerActivation::finishCreation(VM& vm, JSObject* activation)
 {
-    return m_activation->getOwnPropertySlot(exec, propertyName, slot);
-}
-
-void DebuggerActivation::put(ExecState* exec, const Identifier& propertyName, JSValuePtr value, PutPropertySlot& slot)
-{
-    m_activation->put(exec, propertyName, value, slot);
+    Base::finishCreation(vm);
+    ASSERT(activation);
+    ASSERT(activation->isActivationObject());
+    m_activation.set(vm, this, jsCast<JSActivation*>(activation));
 }
 
-void DebuggerActivation::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValuePtr value, unsigned attributes)
+void DebuggerActivation::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
-    m_activation->putWithAttributes(exec, propertyName, value, attributes);
-}
+    DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
+    ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
 
-bool DebuggerActivation::deleteProperty(ExecState* exec, const Identifier& propertyName)
-{
-    return m_activation->deleteProperty(exec, propertyName);
+    JSObject::visitChildren(thisObject, visitor);
+    visitor.append(&thisObject->m_activation);
 }
 
-void DebuggerActivation::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
+String DebuggerActivation::className(const JSObject* object)
 {
-    m_activation->getPropertyNames(exec, propertyNames);
+    const DebuggerActivation* thisObject = jsCast<const DebuggerActivation*>(object);
+    return thisObject->m_activation->methodTable()->className(thisObject->m_activation.get());
 }
 
-bool DebuggerActivation::getPropertyAttributes(JSC::ExecState* exec, const Identifier& propertyName, unsigned& attributes) const
+bool DebuggerActivation::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
 {
-    return m_activation->getPropertyAttributes(exec, propertyName, attributes);
+    DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object);
+    return thisObject->m_activation->methodTable()->getOwnPropertySlot(thisObject->m_activation.get(), exec, propertyName, slot);
 }
 
-void DebuggerActivation::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction)
+void DebuggerActivation::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
 {
-    m_activation->defineGetter(exec, propertyName, getterFunction);
+    DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(cell);
+    thisObject->m_activation->methodTable()->put(thisObject->m_activation.get(), exec, propertyName, value, slot);
 }
 
-void DebuggerActivation::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction)
+bool DebuggerActivation::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
 {
-    m_activation->defineSetter(exec, propertyName, setterFunction);
+    DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(cell);
+    return thisObject->m_activation->methodTable()->deleteProperty(thisObject->m_activation.get(), exec, propertyName);
 }
 
-JSValuePtr DebuggerActivation::lookupGetter(ExecState* exec, const Identifier& propertyName)
+void DebuggerActivation::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
 {
-    return m_activation->lookupGetter(exec, propertyName);
+    DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object);
+    thisObject->m_activation->methodTable()->getPropertyNames(thisObject->m_activation.get(), exec, propertyNames, mode);
 }
 
-JSValuePtr DebuggerActivation::lookupSetter(ExecState* exec, const Identifier& propertyName)
+bool DebuggerActivation::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool shouldThrow)
 {
-    return m_activation->lookupSetter(exec, propertyName);
+    DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object);
+    return thisObject->m_activation->methodTable()->defineOwnProperty(thisObject->m_activation.get(), exec, propertyName, descriptor, shouldThrow);
 }
 
 } // namespace JSC