Changeset 47412 in webkit for trunk/JavaScriptCore/debugger
- Timestamp:
- Aug 17, 2009, 10:34:52 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/debugger/Debugger.cpp
r47304 r47412 62 62 return; 63 63 64 Vector<ProtectedPtr<JSFunction> > functions; 64 typedef HashSet<FunctionExecutable*> FunctionExecutableSet; 65 typedef HashMap<SourceProvider*, ExecState*> SourceProviderMap; 66 67 FunctionExecutableSet functionExecutables; 68 SourceProviderMap sourceProviders; 69 65 70 Heap::iterator heapEnd = globalData->heap.primaryHeapEnd(); 66 71 for (Heap::iterator it = globalData->heap.primaryHeapBegin(); it != heapEnd; ++it) { 67 if ((*it)->inherits(&JSFunction::info)) { 68 JSFunction* function = asFunction(*it); 69 if (!function->body()->isHostFunction()) 70 functions.append(function); 71 } 72 if (!(*it)->inherits(&JSFunction::info)) 73 continue; 74 75 JSFunction* function = asFunction(*it); 76 if (function->executable()->isHostFunction()) 77 continue; 78 79 FunctionExecutable* executable = function->executable(); 80 81 // Check if the function is already in the set - if so, 82 // we've already retranslated it, nothing to do here. 83 if (!functionExecutables.add(executable).second) 84 continue; 85 86 ExecState* exec = function->scope().globalObject()->JSGlobalObject::globalExec(); 87 executable->recompile(exec); 88 if (function->scope().globalObject()->debugger() == this) 89 sourceProviders.add(executable->source().provider(), exec); 72 90 } 73 91 74 typedef HashMap<RefPtr<FunctionBodyNode>, RefPtr<FunctionBodyNode> > FunctionBodyMap;75 typedef HashMap<SourceProvider*, ExecState*> SourceProviderMap;76 77 FunctionBodyMap functionBodies;78 SourceProviderMap sourceProviders;79 80 size_t size = functions.size();81 for (size_t i = 0; i < size; ++i) {82 JSFunction* function = functions[i];83 84 FunctionBodyNode* oldBody = function->body();85 pair<FunctionBodyMap::iterator, bool> result = functionBodies.add(oldBody, 0);86 if (!result.second) {87 function->setBody(result.first->second);88 continue;89 }90 91 ExecState* exec = function->scope().globalObject()->JSGlobalObject::globalExec();92 const SourceCode& sourceCode = oldBody->source();93 94 RefPtr<FunctionBodyNode> newBody = globalData->parser->parse<FunctionBodyNode>(exec, 0, sourceCode);95 ASSERT(newBody);96 newBody->finishParsing(oldBody->copyParameters(), oldBody->parameterCount(), oldBody->ident());97 98 result.first->second = newBody;99 function->setBody(newBody.release());100 101 if (function->scope().globalObject()->debugger() == this)102 sourceProviders.add(sourceCode.provider(), exec);103 }104 92 105 93 // Call sourceParsed() after reparsing all functions because it will execute
Note:
See TracChangeset
for help on using the changeset viewer.