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