|
Lines 28-33
Source/JavaScriptCore/debugger/DebuggerScope.cpp_sec1
|
| 28 |
|
28 |
|
| 29 |
#include "JSActivation.h" |
29 |
#include "JSActivation.h" |
| 30 |
#include "JSCInlines.h" |
30 |
#include "JSCInlines.h" |
|
|
31 |
#include "JSWithScope.h" |
| 31 |
|
32 |
|
| 32 |
namespace JSC { |
33 |
namespace JSC { |
| 33 |
|
34 |
|
|
Lines 35-51
STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(
Source/JavaScriptCore/debugger/DebuggerScope.cpp_sec2
|
| 35 |
|
36 |
|
| 36 |
const ClassInfo DebuggerScope::s_info = { "DebuggerScope", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(DebuggerScope) }; |
37 |
const ClassInfo DebuggerScope::s_info = { "DebuggerScope", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(DebuggerScope) }; |
| 37 |
|
38 |
|
| 38 |
DebuggerScope::DebuggerScope(VM& vm) |
39 |
DebuggerScope::DebuggerScope(VM& vm, JSScope* scope) |
| 39 |
: JSNonFinalObject(vm, vm.debuggerScopeStructure.get()) |
40 |
: JSNonFinalObject(vm, scope->globalObject()->debuggerScopeStructure()) |
| 40 |
{ |
41 |
{ |
|
|
42 |
ASSERT(scope); |
| 43 |
m_scope.set(vm, this, scope); |
| 41 |
} |
44 |
} |
| 42 |
|
45 |
|
| 43 |
void DebuggerScope::finishCreation(VM& vm, JSObject* activation) |
46 |
void DebuggerScope::finishCreation(VM& vm) |
| 44 |
{ |
47 |
{ |
| 45 |
Base::finishCreation(vm); |
48 |
Base::finishCreation(vm); |
| 46 |
ASSERT(activation); |
|
|
| 47 |
ASSERT(activation->isActivationObject()); |
| 48 |
m_activation.set(vm, this, jsCast<JSActivation*>(activation)); |
| 49 |
} |
49 |
} |
| 50 |
|
50 |
|
| 51 |
void DebuggerScope::visitChildren(JSCell* cell, SlotVisitor& visitor) |
51 |
void DebuggerScope::visitChildren(JSCell* cell, SlotVisitor& visitor) |
|
Lines 56-98
void DebuggerScope::visitChildren(JSCell
Source/JavaScriptCore/debugger/DebuggerScope.cpp_sec3
|
| 56 |
ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren()); |
56 |
ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren()); |
| 57 |
|
57 |
|
| 58 |
JSObject::visitChildren(thisObject, visitor); |
58 |
JSObject::visitChildren(thisObject, visitor); |
| 59 |
visitor.append(&thisObject->m_activation); |
59 |
visitor.append(&thisObject->m_scope); |
|
|
60 |
visitor.append(&thisObject->m_next); |
| 60 |
} |
61 |
} |
| 61 |
|
62 |
|
| 62 |
String DebuggerScope::className(const JSObject* object) |
63 |
String DebuggerScope::className(const JSObject* object) |
| 63 |
{ |
64 |
{ |
| 64 |
const DebuggerScope* thisObject = jsCast<const DebuggerScope*>(object); |
65 |
const DebuggerScope* scope = jsCast<const DebuggerScope*>(object); |
| 65 |
return thisObject->m_activation->methodTable()->className(thisObject->m_activation.get()); |
66 |
ASSERT(scope->isValid()); |
|
|
67 |
if (!scope->isValid()) |
| 68 |
return String(); |
| 69 |
JSObject* thisObject = JSScope::objectAtScope(scope->jsScope()); |
| 70 |
return thisObject->methodTable()->className(thisObject); |
| 66 |
} |
71 |
} |
| 67 |
|
72 |
|
| 68 |
bool DebuggerScope::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot) |
73 |
bool DebuggerScope::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot) |
| 69 |
{ |
74 |
{ |
| 70 |
DebuggerScope* thisObject = jsCast<DebuggerScope*>(object); |
75 |
DebuggerScope* scope = jsCast<DebuggerScope*>(object); |
| 71 |
return thisObject->m_activation->methodTable()->getOwnPropertySlot(thisObject->m_activation.get(), exec, propertyName, slot); |
76 |
ASSERT(scope->isValid()); |
|
|
77 |
if (!scope->isValid()) |
| 78 |
return false; |
| 79 |
JSObject* thisObject = JSScope::objectAtScope(scope->jsScope()); |
| 80 |
return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, propertyName, slot); |
| 72 |
} |
81 |
} |
| 73 |
|
82 |
|
| 74 |
void DebuggerScope::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) |
83 |
void DebuggerScope::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) |
| 75 |
{ |
84 |
{ |
| 76 |
DebuggerScope* thisObject = jsCast<DebuggerScope*>(cell); |
85 |
DebuggerScope* scope = jsCast<DebuggerScope*>(cell); |
| 77 |
thisObject->m_activation->methodTable()->put(thisObject->m_activation.get(), exec, propertyName, value, slot); |
86 |
ASSERT(scope->isValid()); |
|
|
87 |
if (!scope->isValid()) |
| 88 |
return; |
| 89 |
JSObject* thisObject = JSScope::objectAtScope(scope->jsScope()); |
| 90 |
thisObject->methodTable()->put(thisObject, exec, propertyName, value, slot); |
| 78 |
} |
91 |
} |
| 79 |
|
92 |
|
| 80 |
bool DebuggerScope::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) |
93 |
bool DebuggerScope::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) |
| 81 |
{ |
94 |
{ |
| 82 |
DebuggerScope* thisObject = jsCast<DebuggerScope*>(cell); |
95 |
DebuggerScope* scope = jsCast<DebuggerScope*>(cell); |
| 83 |
return thisObject->m_activation->methodTable()->deleteProperty(thisObject->m_activation.get(), exec, propertyName); |
96 |
ASSERT(scope->isValid()); |
|
|
97 |
if (!scope->isValid()) |
| 98 |
return false; |
| 99 |
JSObject* thisObject = JSScope::objectAtScope(scope->jsScope()); |
| 100 |
return thisObject->methodTable()->deleteProperty(thisObject, exec, propertyName); |
| 84 |
} |
101 |
} |
| 85 |
|
102 |
|
| 86 |
void DebuggerScope::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) |
103 |
void DebuggerScope::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) |
| 87 |
{ |
104 |
{ |
| 88 |
DebuggerScope* thisObject = jsCast<DebuggerScope*>(object); |
105 |
DebuggerScope* scope = jsCast<DebuggerScope*>(object); |
| 89 |
thisObject->m_activation->methodTable()->getPropertyNames(thisObject->m_activation.get(), exec, propertyNames, mode); |
106 |
ASSERT(scope->isValid()); |
|
|
107 |
if (!scope->isValid()) |
| 108 |
return; |
| 109 |
JSObject* thisObject = JSScope::objectAtScope(scope->jsScope()); |
| 110 |
thisObject->methodTable()->getPropertyNames(thisObject, exec, propertyNames, mode); |
| 90 |
} |
111 |
} |
| 91 |
|
112 |
|
| 92 |
bool DebuggerScope::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool shouldThrow) |
113 |
bool DebuggerScope::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool shouldThrow) |
| 93 |
{ |
114 |
{ |
| 94 |
DebuggerScope* thisObject = jsCast<DebuggerScope*>(object); |
115 |
DebuggerScope* scope = jsCast<DebuggerScope*>(object); |
| 95 |
return thisObject->m_activation->methodTable()->defineOwnProperty(thisObject->m_activation.get(), exec, propertyName, descriptor, shouldThrow); |
116 |
ASSERT(scope->isValid()); |
|
|
117 |
if (!scope->isValid()) |
| 118 |
return false; |
| 119 |
JSObject* thisObject = JSScope::objectAtScope(scope->jsScope()); |
| 120 |
return thisObject->methodTable()->defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow); |
| 121 |
} |
| 122 |
|
| 123 |
DebuggerScope* DebuggerScope::next() |
| 124 |
{ |
| 125 |
ASSERT(isValid()); |
| 126 |
if (!m_next && m_scope->next()) { |
| 127 |
VM& vm = *m_scope->vm(); |
| 128 |
DebuggerScope* nextScope = create(vm, m_scope->next()); |
| 129 |
m_next.set(vm, this, nextScope); |
| 130 |
} |
| 131 |
return m_next.get(); |
| 132 |
} |
| 133 |
|
| 134 |
void DebuggerScope::invalidateChain() |
| 135 |
{ |
| 136 |
DebuggerScope* scope = this; |
| 137 |
while (scope) { |
| 138 |
ASSERT(scope->isValid()); |
| 139 |
DebuggerScope* nextScope = scope->m_next.get(); |
| 140 |
scope->m_next.clear(); |
| 141 |
scope->m_scope.clear(); |
| 142 |
scope = nextScope; |
| 143 |
} |
| 144 |
} |
| 145 |
|
| 146 |
bool DebuggerScope::isWithScope() const |
| 147 |
{ |
| 148 |
return m_scope->isWithScope(); |
| 149 |
} |
| 150 |
|
| 151 |
bool DebuggerScope::isGlobalScope() const |
| 152 |
{ |
| 153 |
return m_scope->isGlobalObject(); |
| 154 |
} |
| 155 |
|
| 156 |
bool DebuggerScope::isFunctionScope() const |
| 157 |
{ |
| 158 |
// In the current debugger implementation, every function will create an |
| 159 |
// activation object. Hence, an activation object implies a function scope. |
| 160 |
return m_scope->isActivationObject(); |
| 96 |
} |
161 |
} |
| 97 |
|
162 |
|
| 98 |
} // namespace JSC |
163 |
} // namespace JSC |