Changeset 43661 in webkit for trunk/JavaScriptCore/debugger
- Timestamp:
- May 13, 2009, 2:53:59 PM (16 years ago)
- Location:
- trunk/JavaScriptCore/debugger
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/debugger/Debugger.cpp
r43647 r43661 23 23 #include "Debugger.h" 24 24 25 #include " CollectorHeapIterator.h"25 #include "JSGlobalObject.h" 26 26 #include "Interpreter.h" 27 #include "JSFunction.h"28 #include "JSGlobalObject.h"29 27 #include "Parser.h" 30 28 … … 56 54 } 57 55 58 void Debugger::recompileAllJSFunctions(JSGlobalData* globalData, bool callSourceParsed)59 {60 // If JavaScript is running, it's not safe to recompile, since we'll end61 // up throwing away code that is live on the stack.62 ASSERT(!globalData->dynamicGlobalObject);63 if (globalData->dynamicGlobalObject)64 return;65 66 Vector<ProtectedPtr<JSFunction> > functions;67 Heap::iterator heapEnd = globalData->heap.primaryHeapEnd();68 for (Heap::iterator it = globalData->heap.primaryHeapBegin(); it != heapEnd; ++it) {69 if ((*it)->isObject(&JSFunction::info)) {70 JSFunction* function = static_cast<JSFunction*>(*it);71 FunctionBodyNode* body = function->body();72 if (body && !body->isHostFunction())73 functions.append(function);74 }75 }76 77 typedef HashMap<RefPtr<FunctionBodyNode>, RefPtr<FunctionBodyNode> > FunctionBodyMap;78 typedef HashMap<SourceProvider*, ExecState*> SourceProviderMap;79 80 FunctionBodyMap functionBodies;81 SourceProviderMap sourceProviders;82 83 size_t size = functions.size();84 for (size_t i = 0; i < size; ++i) {85 JSFunction* function = functions[i];86 87 FunctionBodyNode* oldBody = function->body();88 pair<FunctionBodyMap::iterator, bool> result = functionBodies.add(oldBody, 0);89 if (!result.second) {90 function->setBody(result.first->second.get());91 continue;92 }93 94 ExecState* exec = function->scope().globalObject()->JSGlobalObject::globalExec();95 const SourceCode& sourceCode = oldBody->source();96 97 RefPtr<FunctionBodyNode> newBody = globalData->parser->parse<FunctionBodyNode>(exec, 0, sourceCode);98 ASSERT(newBody);99 newBody->finishParsing(oldBody->copyParameters(), oldBody->parameterCount());100 101 result.first->second = newBody;102 function->setBody(newBody.release());103 104 if (callSourceParsed && function->scope().globalObject()->debugger() == this)105 sourceProviders.add(sourceCode.provider(), exec);106 }107 108 // Call sourceParsed() after reparsing all functions because it will execute109 // JavaScript in the inspector.110 SourceProviderMap::const_iterator end = sourceProviders.end();111 for (SourceProviderMap::const_iterator iter = sourceProviders.begin(); iter != end; ++iter)112 sourceParsed((*iter).second, SourceCode((*iter).first), -1, 0);113 }114 115 56 JSValue evaluateInGlobalCallFrame(const UString& script, JSValue& exception, JSGlobalObject* globalObject) 116 57 { -
trunk/JavaScriptCore/debugger/Debugger.h
r43642 r43661 51 51 virtual void didReachBreakpoint(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0; 52 52 53 void recompileAllJSFunctions(JSGlobalData*, bool callSourceParsed);54 55 53 private: 56 54 HashSet<JSGlobalObject*> m_globalObjects;
Note:
See TracChangeset
for help on using the changeset viewer.