| 1 | /* |
| 2 | * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 | * Copyright (C) 1999-2001 Harri Porten ([email protected]) |
| 4 | * Copyright (C) 2001 Peter Kelly ([email protected]) |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #include "config.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/config.h`/ |
| 23 | #include "Debugger.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.h`/ |
| 24 | |
| 25 | #include "CollectorHeapIterator.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/CollectorHeapIterator.h`/ |
| 26 | #include "Error.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Error.h`/ |
| 27 | #include "Interpreter.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.h`/ |
| 28 | #include "JSFunction.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSFunction.h`/ |
| 29 | #include "JSGlobalObject.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.h`/ |
| 30 | #include "Parser.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/parser/Parser.h`/ |
| 31 | #include "Protect.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Protect.h`/ |
| 32 | |
| 33 | namespace JSCcxx . . $ `<built-in>:463:9`! { |
| 34 | |
| 35 | Debuggercxx . . $ QTJSC/Debugger#::~cxx . . $ QTJSC/Debugger#`~Debugger`(49f6e7a06ebc5aa8).Debuggercxx . . $ QTJSC/Debugger#() |
| 36 | { |
| 37 | HashSet<JSGlobalObject*>::iterator end = m_globalObjects.end(); |
| 38 | for (HashSet<JSGlobalObject*>::iterator it = m_globalObjects.begin(); it !=cxx . . $ QTJSC/`operator!=`(8208a731c2dadbc2). end; ++it) |
| 39 | (*it)->setDebugger(0); |
| 40 | } |
| 41 | |
| 42 | void Debuggercxx . . $ QTJSC/Debugger#::attachcxx . . $ QTJSC/Debugger#attach(314241c1c980276a).(JSGlobalObjectcxx . . $ QTJSC/JSGlobalObject#* globalObject) |
| 43 | { |
| 44 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(!globalObject->debugger()); |
| 45 | globalObject->setDebuggercxx . . $ QTJSC/JSGlobalObject#setDebugger(68c3e460158fd0cf).(this); |
| 46 | m_globalObjects.add(globalObject); |
| 47 | } |
| 48 | |
| 49 | void Debuggercxx . . $ QTJSC/Debugger#::detachcxx . . $ QTJSC/Debugger#detach(314241c1c980276a).(JSGlobalObjectcxx . . $ QTJSC/JSGlobalObject#* globalObject) |
| 50 | { |
| 51 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(m_globalObjects.contains(globalObject)); |
| 52 | m_globalObjects.remove(globalObject); |
| 53 | globalObject->setDebuggercxx . . $ QTJSC/JSGlobalObject#setDebugger(68c3e460158fd0cf).(0); |
| 54 | } |
| 55 | |
| 56 | void Debuggercxx . . $ QTJSC/Debugger#::recompileAllJSFunctionscxx . . $ QTJSC/Debugger#recompileAllJSFunctions(71c44650a83bfd83).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData) |
| 57 | { |
| 58 | // If JavaScript is running, it's not safe to recompile, since we'll end |
| 59 | // up throwing away code that is live on the stack. |
| 60 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(!globalData->dynamicGlobalObject); |
| 61 | if (globalData->dynamicGlobalObjectcxx . . $ QTJSC/JSGlobalData#dynamicGlobalObject.) |
| 62 | return; |
| 63 | |
| 64 | typedef HashSet<FunctionExecutable*> FunctionExecutableSetcxx . . $ QTJSC/Debugger#recompileAllJSFunctions(71c44650a83bfd83).FunctionExecutableSet#; |
| 65 | typedef HashMap<SourceProvider*, ExecState*> SourceProviderMapcxx . . $ QTJSC/Debugger#recompileAllJSFunctions(71c44650a83bfd83).SourceProviderMap#; |
| 66 | |
| 67 | FunctionExecutableSetcxx . . $ QTJSC/Debugger#recompileAllJSFunctions(71c44650a83bfd83).FunctionExecutableSet# functionExecutables; |
| 68 | SourceProviderMapcxx . . $ QTJSC/Debugger#recompileAllJSFunctions(71c44650a83bfd83).SourceProviderMap# sourceProviders; |
| 69 | |
| 70 | LiveObjectIteratorcxx . . $ QTJSC/LiveObjectIterator# it = globalData->heap.primaryHeapBegin(); |
| 71 | LiveObjectIteratorcxx . . $ QTJSC/LiveObjectIterator# heapEnd = globalData->heap.primaryHeapEnd(); |
| 72 | for ( ; it !=cxx . . $ QTJSC/CollectorHeapIterator#`operator!=`(96da696bd38a03f2). heapEnd; ++cxx . . $ QTJSC/LiveObjectIterator#operator++(ad3105ada3b52940).it) { |
| 73 | if (!(*cxx . . $ QTJSC/CollectorHeapIterator#`operator*`(60510463d9a84528).it)->inheritscxx . . $ QTJSC/JSCell#inherits(7eca403b06d48463).(&JSFunctioncxx . . $ QTJSC/JSFunction#::infocxx . . $ QTJSC/JSFunction#info.)) |
| 74 | continue; |
| 75 | |
| 76 | JSFunctioncxx . . $ QTJSC/JSFunction#* function = asFunctioncxx . . $ QTJSC/asFunction(deffc94ad83de35f).(*cxx . . $ QTJSC/JSValue#JSValue(c6d88d3bdacccd64).it); |
| 77 | if (function->executablecxx . . $ QTJSC/JSFunction#executable(278b097dd65ecae5).()->isHostFunctioncxx . . $ QTJSC/ExecutableBase#isHostFunction(50ce9a9e25b4a850).()) |
| 78 | continue; |
| 79 | |
| 80 | FunctionExecutablecxx . . $ QTJSC/FunctionExecutable#* executable = function->jsExecutablecxx . . $ QTJSC/JSFunction#jsExecutable(41a6d61c9ef790ed).(); |
| 81 | |
| 82 | // Check if the function is already in the set - if so, |
| 83 | // we've already retranslated it, nothing to do here. |
| 84 | if (!functionExecutables.add(executable).second) |
| 85 | continue; |
| 86 | |
| 87 | ExecStatecxx . . $ QTJSC/ExecState#* exec = function->scopecxx . . $ QTJSC/JSFunction#scope(b239d380c31bc982).().globalObjectcxx . . $ QTJSC/ScopeChain#globalObject(3d50c730b5e26899).()->JSGlobalObjectcxx . . $ QTJSC/JSGlobalObject#::globalExeccxx . . $ QTJSC/JSGlobalObject#globalExec(27c3d7386a195136).(); |
| 88 | executable->recompilecxx . . $ QTJSC/FunctionExecutable#recompile(d2cb180e190a9680).(exec); |
| 89 | if (function->scopecxx . . $ QTJSC/JSFunction#scope(b239d380c31bc982).().globalObjectcxx . . $ QTJSC/ScopeChain#globalObject(3d50c730b5e26899).()->debuggercxx . . $ QTJSC/JSGlobalObject#debugger(1a524ff7b31d81c).() == this) |
| 90 | sourceProviders.add(executable->sourcecxx . . $ QTJSC/ScriptExecutable#source(95f0f088d0751f0c).().provider(), exec); |
| 91 | } |
| 92 | |
| 93 | // Call sourceParsed() after reparsing all functions because it will execute |
| 94 | // JavaScript in the inspector. |
| 95 | SourceProviderMap::const_iterator end = sourceProviders.end(); |
| 96 | for (SourceProviderMap::const_iterator iter = sourceProviders.begin(); iter !=cxx . . $ QTJSC/`operator!=`(8208a731c2dadbc2). end; ++iter) |
| 97 | sourceParsedcxx . . $ QTJSC/Debugger#sourceParsed(b9d3e5b00e66c0ae).(iter->second, SourceCodecxx . . $ QTJSC/SourceCode#(iter->first), -1, 0); |
| 98 | } |
| 99 | |
| 100 | JSValuecxx . . $ QTJSC/JSValue# evaluateInGlobalCallFramecxx . . $ QTJSC/evaluateInGlobalCallFrame(493c3e795f704541).(const UStringcxx . . $ QTJSC/UString#& script, JSValuecxx . . $ QTJSC/JSValue#& exception, JSGlobalObjectcxx . . $ QTJSC/JSGlobalObject#* globalObject) |
| 101 | { |
| 102 | CallFramecxx . . $ QTJSC/CallFrame#* globalCallFrame = globalObject->globalExeccxx . . $ QTJSC/JSGlobalObject#globalExec(27c3d7386a195136).(); |
| 103 | |
| 104 | RefPtrcxx . . $ RefPtr#<EvalExecutablecxx . . $ QTJSC/EvalExecutable#> eval = EvalExecutable::create(globalCallFrame, makeSource(script)); |
| 105 | JSObjectcxx . . $ QTJSC/JSObject#* error = eval->compile(globalCallFrame, globalCallFrame->scopeChaincxx . . $ QTJSC/ExecState#scopeChain(7483ce9f56294eec).()); |
| 106 | if (error) |
| 107 | return error; |
| 108 | |
| 109 | return globalObject->globalDatacxx . . $ QTJSC/JSGlobalObject#globalData(a2bcd21f8a8ecac2).()->interpretercxx . . $ QTJSC/JSGlobalData#interpreter.->executecxx . . $ QTJSC/Interpreter#execute(c7284d9f486c89c0).(eval.get(), globalCallFrame, globalObject, globalCallFrame->scopeChaincxx . . $ QTJSC/ExecState#scopeChain(7483ce9f56294eec).(), &exception); |
| 110 | } |
| 111 | |
| 112 | } // namespace JSC |