Changeset 173100 in webkit
- Timestamp:
- Aug 28, 2014 5:48:59 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r173082 r173100 1 2014-08-28 Mark Lam <mark.lam@apple.com> 2 3 DebuggerCallFrame::scope() should return a DebuggerScope. 4 <https://webkit.org/b/134420> 5 6 Reviewed by Geoffrey Garen. 7 8 Rolling back in r170680 with the fix for <https://webkit.org/b/135656>. 9 10 Previously, DebuggerCallFrame::scope() returns a JSActivation (and relevant 11 peers) which the WebInspector will use to introspect CallFrame variables. 12 Instead, we should be returning a DebuggerScope as an abstraction layer that 13 provides the introspection functionality that the WebInspector needs. This 14 is the first step towards not forcing every frame to have a JSActivation 15 object just because the debugger is enabled. 16 17 1. Instantiate the debuggerScopeStructure as a member of the JSGlobalObject 18 instead of the VM. This allows JSObject::globalObject() to be able to 19 return the global object for the DebuggerScope. 20 21 2. On the DebuggerScope's life-cycle management: 22 23 The DebuggerCallFrame is designed to be "valid" only during a debugging session 24 (while the debugger is broken) through the use of a DebuggerCallFrameScope in 25 Debugger::pauseIfNeeded(). Once the debugger resumes from the break, the 26 DebuggerCallFrameScope destructs, and the DebuggerCallFrame will be invalidated. 27 We can't guarantee (from this code alone) that the Inspector code isn't still 28 holding a ref to the DebuggerCallFrame (though they shouldn't), but by contract, 29 the frame will be invalidated, and any attempt to query it will return null values. 30 This is pre-existing behavior. 31 32 Now, we're adding the DebuggerScope into the picture. While a single debugger 33 pause session is in progress, the Inspector may request the scope from the 34 DebuggerCallFrame. While the DebuggerCallFrame is still valid, we want 35 DebuggerCallFrame::scope() to always return the same DebuggerScope object. 36 This is why we hold on to the DebuggerScope with a strong ref. 37 38 If we use a weak ref instead, the following cooky behavior can manifest: 39 1. The Inspector calls Debugger::scope() to get the top scope. 40 2. The Inspector iterates down the scope chain and is now only holding a 41 reference to a parent scope. It is no longer referencing the top scope. 42 3. A GC occurs, and the DebuggerCallFrame's weak m_scope ref to the top scope 43 gets cleared. 44 4. The Inspector calls DebuggerCallFrame::scope() to get the top scope again but gets 45 a different DebuggerScope instance. 46 5. The Inspector iterates down the scope chain but never sees the parent scope 47 instance that retained a ref to in step 2 above. This is because when iterating 48 this new DebuggerScope instance (which has no knowledge of the previous parent 49 DebuggerScope instance), a new DebuggerScope instance will get created for the 50 same parent scope. 51 52 Since the DebuggerScope is a JSObject, its liveness is determined by its reachability. 53 However, its "validity" is determined by the life-cycle of its owner DebuggerCallFrame. 54 When the owner DebuggerCallFrame gets invalidated, its debugger scope chain (if 55 instantiated) will also get invalidated. This is why we need the 56 DebuggerScope::invalidateChain() method. The Inspector should not be using the 57 DebuggerScope instance after its owner DebuggerCallFrame is invalidated. If it does, 58 those methods will do nothing or returned a failed status. 59 60 Fix for <https://webkit.org/b/135656>: 61 3. DebuggerScope::getOwnPropertySlot() and DebuggerScope::put() need to set 62 m_thisValue in the returned slot to the wrapped scope object. Previously, 63 it was pointing to the DebuggerScope though the rest of the fields in the 64 returned slot will be set to data pertaining the wrapped scope object. 65 66 4. DebuggerScope::getOwnPropertySlot() will invoke getPropertySlot() on its 67 wrapped scope. This is because JSObject::getPropertySlot() cannot be 68 overridden, and when called on a DebuggerScope, will not know to look in 69 the ptototype chain of the DebuggerScope's wrapped scope. Hence, we'll 70 treat all properties in the wrapped scope as own properties in the 71 DebuggerScope. This is fine because the WebInspector does not presently 72 care about where in the prototype chain the scope property comes from. 73 74 Note that the DebuggerScope and the JSActivation objects that it wraps do 75 not have prototypes. They are always jsNull(). This works perfectly with 76 the above change to use getPropertySlot() instead of getOwnPropertySlot(). 77 To make this an explicit invariant, I also changed DebuggerScope::createStructure() 78 and JSActivation::createStructure() to not take a prototype argument, and 79 to always use jsNull() for their prototype value. 80 81 * debugger/Debugger.h: 82 * debugger/DebuggerCallFrame.cpp: 83 (JSC::DebuggerCallFrame::scope): 84 (JSC::DebuggerCallFrame::evaluate): 85 (JSC::DebuggerCallFrame::invalidate): 86 * debugger/DebuggerCallFrame.h: 87 * debugger/DebuggerScope.cpp: 88 (JSC::DebuggerScope::DebuggerScope): 89 (JSC::DebuggerScope::finishCreation): 90 (JSC::DebuggerScope::visitChildren): 91 (JSC::DebuggerScope::className): 92 (JSC::DebuggerScope::getOwnPropertySlot): 93 (JSC::DebuggerScope::put): 94 (JSC::DebuggerScope::deleteProperty): 95 (JSC::DebuggerScope::getOwnPropertyNames): 96 (JSC::DebuggerScope::defineOwnProperty): 97 (JSC::DebuggerScope::next): 98 (JSC::DebuggerScope::invalidateChain): 99 (JSC::DebuggerScope::isWithScope): 100 (JSC::DebuggerScope::isGlobalScope): 101 (JSC::DebuggerScope::isFunctionOrEvalScope): 102 * debugger/DebuggerScope.h: 103 (JSC::DebuggerScope::create): 104 (JSC::DebuggerScope::createStructure): 105 (JSC::DebuggerScope::iterator::iterator): 106 (JSC::DebuggerScope::iterator::get): 107 (JSC::DebuggerScope::iterator::operator++): 108 (JSC::DebuggerScope::iterator::operator==): 109 (JSC::DebuggerScope::iterator::operator!=): 110 (JSC::DebuggerScope::isValid): 111 (JSC::DebuggerScope::jsScope): 112 (JSC::DebuggerScope::begin): 113 (JSC::DebuggerScope::end): 114 * inspector/JSJavaScriptCallFrame.cpp: 115 (Inspector::JSJavaScriptCallFrame::scopeType): 116 (Inspector::JSJavaScriptCallFrame::scopeChain): 117 * inspector/JavaScriptCallFrame.h: 118 (Inspector::JavaScriptCallFrame::scopeChain): 119 * inspector/ScriptDebugServer.cpp: 120 * runtime/JSActivation.h: 121 (JSC::JSActivation::createStructure): 122 * runtime/JSGlobalObject.cpp: 123 (JSC::JSGlobalObject::reset): 124 (JSC::JSGlobalObject::visitChildren): 125 * runtime/JSGlobalObject.h: 126 (JSC::JSGlobalObject::debuggerScopeStructure): 127 * runtime/JSObject.cpp: 128 * runtime/JSObject.h: 129 (JSC::JSObject::isWithScope): 130 * runtime/JSScope.h: 131 * runtime/PropertySlot.h: 132 (JSC::PropertySlot::setThisValue): 133 * runtime/PutPropertySlot.h: 134 (JSC::PutPropertySlot::setThisValue): 135 * runtime/VM.cpp: 136 (JSC::VM::VM): 137 * runtime/VM.h: 138 1 139 2014-08-28 Andreas Kling <akling@apple.com> 2 140 -
trunk/Source/JavaScriptCore/debugger/Debugger.h
r172372 r173100 34 34 namespace JSC { 35 35 36 class CodeBlock; 36 37 class ExecState; 37 38 class JSGlobalObject; -
trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
r172665 r173100 31 31 32 32 #include "CodeBlock.h" 33 #include "DebuggerScope.h" 33 34 #include "Interpreter.h" 34 35 #include "JSActivation.h" … … 37 38 #include "Parser.h" 38 39 #include "StackVisitor.h" 40 #include "StrongInlines.h" 39 41 40 42 namespace JSC { … … 133 135 } 134 136 135 JSScope* DebuggerCallFrame::scope() const 136 { 137 ASSERT(isValid()); 138 if (!isValid()) 139 return 0; 140 141 CodeBlock* codeBlock = m_callFrame->codeBlock(); 142 if (codeBlock && codeBlock->needsActivation() && !m_callFrame->hasActivation()) { 143 JSActivation* activation = JSActivation::create(*codeBlock->vm(), m_callFrame, codeBlock); 144 m_callFrame->setActivation(activation); 145 m_callFrame->setScope(activation); 146 } 147 148 return m_callFrame->scope(); 137 DebuggerScope* DebuggerCallFrame::scope() 138 { 139 ASSERT(isValid()); 140 if (!isValid()) 141 return 0; 142 143 if (!m_scope) { 144 VM& vm = m_callFrame->vm(); 145 CodeBlock* codeBlock = m_callFrame->codeBlock(); 146 if (codeBlock && codeBlock->needsActivation() && !m_callFrame->hasActivation()) { 147 ASSERT(!m_callFrame->scope()->isWithScope()); 148 JSActivation* activation = JSActivation::create(vm, m_callFrame, codeBlock); 149 m_callFrame->setActivation(activation); 150 m_callFrame->setScope(activation); 151 } 152 153 m_scope.set(vm, DebuggerScope::create(vm, m_callFrame->scope())); 154 } 155 return m_scope.get(); 149 156 } 150 157 … … 189 196 190 197 JSValue thisValue = thisValueForCallFrame(callFrame); 191 JSValue result = vm.interpreter->execute(eval, callFrame, thisValue, scope() );198 JSValue result = vm.interpreter->execute(eval, callFrame, thisValue, scope()->jsScope()); 192 199 if (vm.exception()) { 193 200 exception = vm.exception(); … … 201 208 { 202 209 m_callFrame = nullptr; 210 if (m_scope) { 211 m_scope->invalidateChain(); 212 m_scope.clear(); 213 } 203 214 RefPtr<DebuggerCallFrame> frame = m_caller.release(); 204 215 while (frame) { -
trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.h
r172372 r173100 30 30 #define DebuggerCallFrame_h 31 31 32 #include "CallFrame.h"33 32 #include "DebuggerPrimitives.h" 33 #include "Strong.h" 34 34 #include <wtf/PassRefPtr.h> 35 35 #include <wtf/RefCounted.h> … … 37 37 38 38 namespace JSC { 39 40 class DebuggerScope; 41 class ExecState; 42 typedef ExecState CallFrame; 39 43 40 44 class DebuggerCallFrame : public RefCounted<DebuggerCallFrame> { … … 59 63 60 64 JS_EXPORT_PRIVATE JSGlobalObject* vmEntryGlobalObject() const; 61 JS_EXPORT_PRIVATE JSScope* scope() const;65 JS_EXPORT_PRIVATE DebuggerScope* scope(); 62 66 JS_EXPORT_PRIVATE String functionName() const; 63 67 JS_EXPORT_PRIVATE Type type() const; … … 79 83 RefPtr<DebuggerCallFrame> m_caller; 80 84 TextPosition m_position; 85 // The DebuggerCallFrameScope is responsible for calling invalidate() which, 86 // in turn, will clear this strong ref. 87 Strong<DebuggerScope> m_scope; 81 88 }; 82 89 -
trunk/Source/JavaScriptCore/debugger/DebuggerScope.cpp
r172372 r173100 29 29 #include "JSActivation.h" 30 30 #include "JSCInlines.h" 31 #include "JSWithScope.h" 31 32 32 33 namespace JSC { … … 36 37 const ClassInfo DebuggerScope::s_info = { "DebuggerScope", &Base::s_info, 0, CREATE_METHOD_TABLE(DebuggerScope) }; 37 38 38 DebuggerScope::DebuggerScope(VM& vm )39 : JSNonFinalObject(vm, vm.debuggerScopeStructure.get())39 DebuggerScope::DebuggerScope(VM& vm, JSScope* scope) 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 48 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_activation); 56 visitor.append(&thisObject->m_scope); 57 visitor.append(&thisObject->m_next); 57 58 } 58 59 59 60 String DebuggerScope::className(const JSObject* object) 60 61 { 61 const DebuggerScope* thisObject = jsCast<const DebuggerScope*>(object); 62 return thisObject->m_activation->methodTable()->className(thisObject->m_activation.get()); 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); 63 68 } 64 69 65 70 bool DebuggerScope::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot) 66 71 { 67 DebuggerScope* thisObject = jsCast<DebuggerScope*>(object); 68 return thisObject->m_activation->methodTable()->getOwnPropertySlot(thisObject->m_activation.get(), exec, propertyName, slot); 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 slot.setThisValue(JSValue(thisObject)); 78 79 // By default, JSObject::getPropertySlot() will look in the DebuggerScope's prototype 80 // chain and not the wrapped scope, and JSObject::getPropertySlot() cannot be overridden 81 // to behave differently for the DebuggerScope. 82 // 83 // Instead, we'll treat all properties in the wrapped scope and its prototype chain as 84 // the own properties of the DebuggerScope. This is fine because the WebInspector 85 // does not presently need to distinguish between what's owned at each level in the 86 // prototype chain. Hence, we'll invoke getPropertySlot() on the wrapped scope here 87 // instead of getOwnPropertySlot(). 88 return thisObject->getPropertySlot(exec, propertyName, slot); 69 89 } 70 90 71 91 void DebuggerScope::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) 72 92 { 73 DebuggerScope* thisObject = jsCast<DebuggerScope*>(cell); 74 thisObject->m_activation->methodTable()->put(thisObject->m_activation.get(), exec, propertyName, value, slot); 93 DebuggerScope* scope = jsCast<DebuggerScope*>(cell); 94 ASSERT(scope->isValid()); 95 if (!scope->isValid()) 96 return; 97 JSObject* thisObject = JSScope::objectAtScope(scope->jsScope()); 98 slot.setThisValue(JSValue(thisObject)); 99 thisObject->methodTable()->put(thisObject, exec, propertyName, value, slot); 75 100 } 76 101 77 102 bool DebuggerScope::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) 78 103 { 79 DebuggerScope* thisObject = jsCast<DebuggerScope*>(cell); 80 return thisObject->m_activation->methodTable()->deleteProperty(thisObject->m_activation.get(), exec, propertyName); 104 DebuggerScope* scope = jsCast<DebuggerScope*>(cell); 105 ASSERT(scope->isValid()); 106 if (!scope->isValid()) 107 return false; 108 JSObject* thisObject = JSScope::objectAtScope(scope->jsScope()); 109 return thisObject->methodTable()->deleteProperty(thisObject, exec, propertyName); 81 110 } 82 111 83 112 void DebuggerScope::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) 84 113 { 85 DebuggerScope* thisObject = jsCast<DebuggerScope*>(object); 86 thisObject->m_activation->methodTable()->getPropertyNames(thisObject->m_activation.get(), exec, propertyNames, mode); 114 DebuggerScope* scope = jsCast<DebuggerScope*>(object); 115 ASSERT(scope->isValid()); 116 if (!scope->isValid()) 117 return; 118 JSObject* thisObject = JSScope::objectAtScope(scope->jsScope()); 119 thisObject->methodTable()->getPropertyNames(thisObject, exec, propertyNames, mode); 87 120 } 88 121 89 122 bool DebuggerScope::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool shouldThrow) 90 123 { 91 DebuggerScope* thisObject = jsCast<DebuggerScope*>(object); 92 return thisObject->m_activation->methodTable()->defineOwnProperty(thisObject->m_activation.get(), exec, propertyName, descriptor, shouldThrow); 124 DebuggerScope* scope = jsCast<DebuggerScope*>(object); 125 ASSERT(scope->isValid()); 126 if (!scope->isValid()) 127 return false; 128 JSObject* thisObject = JSScope::objectAtScope(scope->jsScope()); 129 return thisObject->methodTable()->defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow); 130 } 131 132 DebuggerScope* DebuggerScope::next() 133 { 134 ASSERT(isValid()); 135 if (!m_next && m_scope->next()) { 136 VM& vm = *m_scope->vm(); 137 DebuggerScope* nextScope = create(vm, m_scope->next()); 138 m_next.set(vm, this, nextScope); 139 } 140 return m_next.get(); 141 } 142 143 void DebuggerScope::invalidateChain() 144 { 145 DebuggerScope* scope = this; 146 while (scope) { 147 ASSERT(scope->isValid()); 148 DebuggerScope* nextScope = scope->m_next.get(); 149 scope->m_next.clear(); 150 scope->m_scope.clear(); 151 scope = nextScope; 152 } 153 } 154 155 bool DebuggerScope::isWithScope() const 156 { 157 return m_scope->isWithScope(); 158 } 159 160 bool DebuggerScope::isGlobalScope() const 161 { 162 return m_scope->isGlobalObject(); 163 } 164 165 bool DebuggerScope::isFunctionOrEvalScope() const 166 { 167 // In the current debugger implementation, every function or eval will create an 168 // activation object. Hence, an activation object implies a function or eval scope. 169 return m_scope->isActivationObject(); 93 170 } 94 171 -
trunk/Source/JavaScriptCore/debugger/DebuggerScope.h
r172372 r173100 31 31 namespace JSC { 32 32 33 class DebuggerCallFrame; 34 class JSScope; 35 33 36 class DebuggerScope : public JSNonFinalObject { 34 37 public: 35 38 typedef JSNonFinalObject Base; 36 39 37 static DebuggerScope* create(VM& vm, JS Object* object)40 static DebuggerScope* create(VM& vm, JSScope* scope) 38 41 { 39 DebuggerScope* activation = new (NotNull, allocateCell<DebuggerScope>(vm.heap)) DebuggerScope(vm);40 activation->finishCreation(vm, object);41 return activation;42 DebuggerScope* debuggerScope = new (NotNull, allocateCell<DebuggerScope>(vm.heap)) DebuggerScope(vm, scope); 43 debuggerScope->finishCreation(vm); 44 return debuggerScope; 42 45 } 43 46 … … 52 55 DECLARE_EXPORT_INFO; 53 56 54 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject , JSValue prototype)57 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject) 55 58 { 56 return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());59 return Structure::create(vm, globalObject, jsNull(), TypeInfo(ObjectType, StructureFlags), info()); 57 60 } 58 61 59 protected: 60 static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags; 62 class iterator { 63 public: 64 iterator(DebuggerScope* node) 65 : m_node(node) 66 { 67 } 61 68 62 JS_EXPORT_PRIVATE void finishCreation(VM&, JSObject* activation); 69 DebuggerScope* get() { return m_node; } 70 iterator& operator++() { m_node = m_node->next(); return *this; } 71 // postfix ++ intentionally omitted 72 73 bool operator==(const iterator& other) const { return m_node == other.m_node; } 74 bool operator!=(const iterator& other) const { return m_node != other.m_node; } 75 76 private: 77 DebuggerScope* m_node; 78 }; 79 80 iterator begin(); 81 iterator end(); 82 DebuggerScope* next(); 83 84 void invalidateChain(); 85 bool isValid() const { return !!m_scope; } 86 87 bool isWithScope() const; 88 bool isGlobalScope() const; 89 bool isFunctionOrEvalScope() const; 63 90 64 91 private: 65 JS_EXPORT_PRIVATE DebuggerScope(VM&); 66 WriteBarrier<JSActivation> m_activation; 92 JS_EXPORT_PRIVATE DebuggerScope(VM&, JSScope*); 93 JS_EXPORT_PRIVATE void finishCreation(VM&); 94 95 JSScope* jsScope() const { return m_scope.get(); } 96 97 static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSObject::StructureFlags; 98 99 WriteBarrier<JSScope> m_scope; 100 WriteBarrier<DebuggerScope> m_next; 101 102 friend class DebuggerCallFrame; 67 103 }; 104 105 inline DebuggerScope::iterator DebuggerScope::begin() 106 { 107 return iterator(this); 108 } 109 110 inline DebuggerScope::iterator DebuggerScope::end() 111 { 112 return iterator(0); 113 } 68 114 69 115 } // namespace JSC -
trunk/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp
r172372 r173100 29 29 #if ENABLE(INSPECTOR) 30 30 31 #include "DebuggerScope.h" 31 32 #include "Error.h" 32 33 #include "JSCJSValue.h" … … 96 97 int index = exec->argument(0).asInt32(); 97 98 98 JSScope* scopeChain = impl().scopeChain(); 99 ScopeChainIterator end = scopeChain->end(); 100 101 // FIXME: We should be identifying and returning CATCH_SCOPE appropriately. 99 DebuggerScope* scopeChain = impl().scopeChain(); 100 DebuggerScope::iterator end = scopeChain->end(); 102 101 103 102 bool foundLocalScope = false; 104 for (ScopeChainIterator iter = scopeChain->begin(); iter != end; ++iter) { 105 JSObject* scope = iter.get(); 106 if (scope->isActivationObject()) { 107 if (!foundLocalScope) { 108 // First activation object is local scope, each successive activation object is closure. 109 if (!index) 110 return jsNumber(JSJavaScriptCallFrame::LOCAL_SCOPE); 111 foundLocalScope = true; 112 } else if (!index) 113 return jsNumber(JSJavaScriptCallFrame::CLOSURE_SCOPE); 103 for (DebuggerScope::iterator iter = scopeChain->begin(); iter != end; ++iter) { 104 DebuggerScope* scope = iter.get(); 105 106 if (!foundLocalScope && scope->isFunctionOrEvalScope()) { 107 // First function scope is the local scope, each successive one is a closure. 108 if (!index) 109 return jsNumber(JSJavaScriptCallFrame::LOCAL_SCOPE); 110 foundLocalScope = true; 114 111 } 115 112 116 113 if (!index) { 117 // Last in the chain is global scope. 118 if (++iter == end) 114 if (scope->isWithScope()) 115 return jsNumber(JSJavaScriptCallFrame::WITH_SCOPE); 116 if (scope->isGlobalScope()) { 117 ASSERT(++iter == end); 119 118 return jsNumber(JSJavaScriptCallFrame::GLOBAL_SCOPE); 120 return jsNumber(JSJavaScriptCallFrame::WITH_SCOPE); 119 } 120 // FIXME: We should be identifying and returning CATCH_SCOPE appropriately. 121 ASSERT(scope->isFunctionOrEvalScope()); 122 return jsNumber(JSJavaScriptCallFrame::CLOSURE_SCOPE); 121 123 } 122 124 … … 158 160 return jsNull(); 159 161 160 JSScope* scopeChain = impl().scopeChain();161 ScopeChainIterator iter = scopeChain->begin();162 ScopeChainIterator end = scopeChain->end();162 DebuggerScope* scopeChain = impl().scopeChain(); 163 DebuggerScope::iterator iter = scopeChain->begin(); 164 DebuggerScope::iterator end = scopeChain->end(); 163 165 164 166 // We must always have something in the scope chain. -
trunk/Source/JavaScriptCore/inspector/JavaScriptCallFrame.h
r172372 r173100 1 1 /* 2 * Copyright (C) 2008, 2013 Apple Inc. All Rights Reserved.2 * Copyright (C) 2008, 2013-2014 Apple Inc. All Rights Reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 54 54 String functionName() const { return m_debuggerCallFrame->functionName(); } 55 55 JSC::DebuggerCallFrame::Type type() const { return m_debuggerCallFrame->type(); } 56 JSC:: JSScope* scopeChain() const { return m_debuggerCallFrame->scope(); }56 JSC::DebuggerScope* scopeChain() const { return m_debuggerCallFrame->scope(); } 57 57 JSC::JSGlobalObject* vmEntryGlobalObject() const { return m_debuggerCallFrame->vmEntryGlobalObject(); } 58 58 -
trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.cpp
r172372 r173100 35 35 36 36 #include "DebuggerCallFrame.h" 37 #include "DebuggerScope.h" 37 38 #include "JSJavaScriptCallFrame.h" 38 39 #include "JSLock.h" -
trunk/Source/JavaScriptCore/runtime/JSActivation.h
r171939 r173100 82 82 DECLARE_INFO; 83 83 84 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject , JSValue proto) { return Structure::create(vm, globalObject, proto, TypeInfo(ActivationObjectType, StructureFlags), info()); }84 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject) { return Structure::create(vm, globalObject, jsNull(), TypeInfo(ActivationObjectType, StructureFlags), info()); } 85 85 86 86 WriteBarrierBase<Unknown>& registerAt(int) const; -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r172372 r173100 46 46 #include "DatePrototype.h" 47 47 #include "Debugger.h" 48 #include "DebuggerScope.h" 48 49 #include "Error.h" 49 50 #include "ErrorConstructor.h" … … 319 320 320 321 m_nameScopeStructure.set(vm, this, JSNameScope::createStructure(vm, this, jsNull())); 321 m_activationStructure.set(vm, this, JSActivation::createStructure(vm, this , jsNull()));322 m_activationStructure.set(vm, this, JSActivation::createStructure(vm, this)); 322 323 m_strictEvalActivationStructure.set(vm, this, StrictEvalActivation::createStructure(vm, this, jsNull())); 324 m_debuggerScopeStructure.set(m_vm, this, DebuggerScope::createStructure(m_vm, this)); 323 325 m_withScopeStructure.set(vm, this, JSWithScope::createStructure(vm, this, jsNull())); 324 326 … … 663 665 #endif 664 666 667 visitor.append(&thisObject->m_debuggerScopeStructure); 665 668 visitor.append(&thisObject->m_withScopeStructure); 666 669 visitor.append(&thisObject->m_strictEvalActivationStructure); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r172372 r173100 187 187 #endif 188 188 189 WriteBarrier<Structure> m_debuggerScopeStructure; 189 190 WriteBarrier<Structure> m_withScopeStructure; 190 191 WriteBarrier<Structure> m_strictEvalActivationStructure; … … 392 393 #endif 393 394 395 Structure* debuggerScopeStructure() const { return m_debuggerScopeStructure.get(); } 394 396 Structure* withScopeStructure() const { return m_withScopeStructure.get(); } 395 397 Structure* strictEvalActivationStructure() const { return m_strictEvalActivationStructure.get(); } -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r172176 r173100 2783 2783 } 2784 2784 2785 2786 2785 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r172372 r173100 595 595 bool isActivationObject() const; 596 596 bool isErrorInstance() const; 597 bool isWithScope() const; 597 598 598 599 JS_EXPORT_PRIVATE void seal(VM&); … … 1151 1152 } 1152 1153 1154 inline bool JSObject::isWithScope() const 1155 { 1156 return type() == WithScopeType; 1157 } 1158 1153 1159 inline void JSObject::setStructureAndButterfly(VM& vm, Structure* structure, Butterfly* butterfly) 1154 1160 { -
trunk/Source/JavaScriptCore/runtime/JSScope.h
r172808 r173100 151 151 static size_t offsetOfNext(); 152 152 153 JS_EXPORT_PRIVATEstatic JSObject* objectAtScope(JSScope*);153 static JSObject* objectAtScope(JSScope*); 154 154 155 155 static JSValue resolve(ExecState*, JSScope*, const Identifier&); -
trunk/Source/JavaScriptCore/runtime/PropertySlot.h
r172120 r173100 205 205 } 206 206 207 void setThisValue(JSValue thisValue) 208 { 209 m_thisValue = thisValue; 210 } 211 207 212 void setUndefined() 208 213 { … … 236 241 PropertyType m_propertyType; 237 242 PropertyOffset m_offset; 238 constJSValue m_thisValue;243 JSValue m_thisValue; 239 244 JSObject* m_slotBase; 240 245 WatchpointSet* m_watchpointSet; -
trunk/Source/JavaScriptCore/runtime/PutPropertySlot.h
r166945 r173100 81 81 } 82 82 83 void setThisValue(JSValue thisValue) 84 { 85 m_thisValue = thisValue; 86 } 87 83 88 PutValueFunc customSetter() const { return m_putFunction; } 84 89 -
trunk/Source/JavaScriptCore/runtime/VM.cpp
r173069 r173100 41 41 #include "DFGLongLivedState.h" 42 42 #include "DFGWorklist.h" 43 #include "DebuggerScope.h"44 43 #include "ErrorInstance.h" 45 44 #include "FTLThunks.h" … … 210 209 structureStructure.set(*this, Structure::createStructure(*this)); 211 210 structureRareDataStructure.set(*this, StructureRareData::createStructure(*this, 0, jsNull())); 212 debuggerScopeStructure.set(*this, DebuggerScope::createStructure(*this, 0, jsNull()));213 211 terminatedExecutionErrorStructure.set(*this, TerminatedExecutionError::createStructure(*this, 0, jsNull())); 214 212 stringStructure.set(*this, JSString::createStructure(*this, 0, jsNull())); -
trunk/Source/JavaScriptCore/runtime/VM.h
r173069 r173100 247 247 Strong<Structure> structureStructure; 248 248 Strong<Structure> structureRareDataStructure; 249 Strong<Structure> debuggerScopeStructure;250 249 Strong<Structure> terminatedExecutionErrorStructure; 251 250 Strong<Structure> stringStructure; -
trunk/Source/WebCore
- Property svn:mergeinfo changed
/branches/ftlopt/Source/WebCore (added) merged: 170680
- Property svn:mergeinfo changed
-
trunk/Source/WebCore/ChangeLog
r173097 r173100 1 2014-08-28 Mark Lam <mark.lam@apple.com> 2 3 DebuggerCallFrame::scope() should return a DebuggerScope. 4 <https://webkit.org/b/134420> 5 6 Reviewed by Geoffrey Garen. 7 8 No new tests. 9 10 Rolling back in r170680 with the fix for <https://webkit.org/b/135656>. 11 12 * bindings/js/ScriptController.cpp: 13 (WebCore::ScriptController::attachDebugger): 14 - We should acquire the JSLock before modifying a JS global object. 15 1 16 2014-08-28 Enrica Casucci <enrica@apple.com> 2 17 -
trunk/Source/WebCore/bindings/js/ScriptController.cpp
r172372 r173100 308 308 309 309 JSDOMWindow* globalObject = shell->window(); 310 JSLockHolder lock(globalObject->vm()); 310 311 if (debugger) 311 312 debugger->attach(globalObject);
Note: See TracChangeset
for help on using the changeset viewer.