diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-05-20 09:56:07 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-05-20 09:56:07 +0000 |
commit | 41386e9cb918eed93b3f13648cbef387e371e451 (patch) | |
tree | a97f9d7bd1d9d091833286085f72da9d83fd0606 /Source/JavaScriptCore/runtime/Completion.cpp | |
parent | e15dd966d523731101f70ccf768bba12435a0208 (diff) | |
download | WebKitGtk-tarball-41386e9cb918eed93b3f13648cbef387e371e451.tar.gz |
webkitgtk-2.4.9webkitgtk-2.4.9
Diffstat (limited to 'Source/JavaScriptCore/runtime/Completion.cpp')
-rw-r--r-- | Source/JavaScriptCore/runtime/Completion.cpp | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/Source/JavaScriptCore/runtime/Completion.cpp b/Source/JavaScriptCore/runtime/Completion.cpp index a3daee603..9d7fd1a74 100644 --- a/Source/JavaScriptCore/runtime/Completion.cpp +++ b/Source/JavaScriptCore/runtime/Completion.cpp @@ -26,13 +26,10 @@ #include "CallFrame.h" #include "CodeProfiling.h" #include "Debugger.h" -#include "Exception.h" #include "Interpreter.h" #include "JSGlobalObject.h" #include "JSLock.h" -#include "JSCInlines.h" -#include "ModuleAnalyzer.h" -#include "ModuleRecord.h" +#include "Operations.h" #include "Parser.h" #include <wtf/WTFThreadData.h> @@ -41,7 +38,7 @@ namespace JSC { bool checkSyntax(ExecState* exec, const SourceCode& source, JSValue* returnedException) { JSLockHolder lock(exec); - RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable()); + RELEASE_ASSERT(exec->vm().identifierTable == wtfThreadData().currentIdentifierTable()); ProgramExecutable* program = ProgramExecutable::create(exec, source); JSObject* error = program->checkSyntax(exec); @@ -57,38 +54,24 @@ bool checkSyntax(ExecState* exec, const SourceCode& source, JSValue* returnedExc bool checkSyntax(VM& vm, const SourceCode& source, ParserError& error) { JSLockHolder lock(vm); - RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable()); - return !!parse<ProgramNode>( - &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin, - JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, error); + RELEASE_ASSERT(vm.identifierTable == wtfThreadData().currentIdentifierTable()); + RefPtr<ProgramNode> programNode = parse<ProgramNode>(&vm, source, 0, Identifier(), JSParseNormal, JSParseProgramCode, error); + return programNode; } -bool checkModuleSyntax(VM& vm, const SourceCode& source, ParserError& error) -{ - JSLockHolder lock(vm); - RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable()); - std::unique_ptr<ModuleProgramNode> moduleProgramNode = parse<ModuleProgramNode>( - &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin, - JSParserStrictMode::Strict, SourceParseMode::ModuleAnalyzeMode, error); - if (!moduleProgramNode) - return false; - - ModuleAnalyzer moduleAnalyzer(vm, moduleProgramNode->varDeclarations(), moduleProgramNode->lexicalVariables()); - moduleAnalyzer.analyze(*moduleProgramNode); - return true; -} - -JSValue evaluate(ExecState* exec, const SourceCode& source, JSValue thisValue, NakedPtr<Exception>& returnedException) +JSValue evaluate(ExecState* exec, const SourceCode& source, JSValue thisValue, JSValue* returnedException) { JSLockHolder lock(exec); - RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable()); + RELEASE_ASSERT(exec->vm().identifierTable == wtfThreadData().currentIdentifierTable()); RELEASE_ASSERT(!exec->vm().isCollectorBusy()); CodeProfiling profile(source); ProgramExecutable* program = ProgramExecutable::create(exec, source); if (!program) { - returnedException = exec->vm().exception(); + if (returnedException) + *returnedException = exec->vm().exception(); + exec->vm().clearException(); return jsUndefined(); } @@ -99,7 +82,9 @@ JSValue evaluate(ExecState* exec, const SourceCode& source, JSValue thisValue, N JSValue result = exec->interpreter()->execute(program, exec, thisObj); if (exec->hadException()) { - returnedException = exec->exception(); + if (returnedException) + *returnedException = exec->exception(); + exec->clearException(); return jsUndefined(); } |