summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-07 11:22:47 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-07 11:22:47 +0100
commitcfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch)
tree24d68c6f61c464ecba1e05670b80390ea3b0e50c /Source/JavaScriptCore/runtime/JSGlobalObject.cpp
parent69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff)
downloadqtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSGlobalObject.cpp')
-rw-r--r--Source/JavaScriptCore/runtime/JSGlobalObject.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
index 03252fad1..c466a2b04 100644
--- a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
+++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
@@ -36,6 +36,7 @@
#include "BooleanConstructor.h"
#include "BooleanPrototype.h"
#include "CodeBlock.h"
+#include "CodeCache.h"
#include "DateConstructor.h"
#include "DatePrototype.h"
#include "Debugger.h"
@@ -580,4 +581,58 @@ void slowValidateCell(JSGlobalObject* globalObject)
ASSERT_GC_OBJECT_INHERITS(globalObject, &JSGlobalObject::s_info);
}
+UnlinkedProgramCodeBlock* JSGlobalObject::createProgramCodeBlock(CallFrame* callFrame, ProgramExecutable* executable, JSObject** exception)
+{
+ ParserError error;
+ JSParserStrictness strictness = executable->isStrictMode() ? JSParseStrict : JSParseNormal;
+ DebuggerMode debuggerMode = hasDebugger() ? DebuggerOn : DebuggerOff;
+ ProfilerMode profilerMode = hasProfiler() ? ProfilerOn : ProfilerOff;
+ UnlinkedProgramCodeBlock* unlinkedCode = globalData().codeCache()->getProgramCodeBlock(globalData(), executable, executable->source(), strictness, debuggerMode, profilerMode, error);
+
+ if (hasDebugger())
+ debugger()->sourceParsed(callFrame, executable->source().provider(), error.m_line, error.m_message);
+
+ if (error.m_type != ParserError::ErrorNone) {
+ *exception = error.toErrorObject(this, executable->source());
+ return 0;
+ }
+
+ return unlinkedCode;
+}
+
+UnlinkedEvalCodeBlock* JSGlobalObject::createEvalCodeBlock(CallFrame* callFrame, EvalExecutable* executable, JSObject** exception)
+{
+ ParserError error;
+ JSParserStrictness strictness = executable->isStrictMode() ? JSParseStrict : JSParseNormal;
+ DebuggerMode debuggerMode = hasDebugger() ? DebuggerOn : DebuggerOff;
+ ProfilerMode profilerMode = hasProfiler() ? ProfilerOn : ProfilerOff;
+ UnlinkedEvalCodeBlock* unlinkedCode = globalData().codeCache()->getEvalCodeBlock(globalData(), executable, executable->source(), strictness, debuggerMode, profilerMode, error);
+
+ if (hasDebugger())
+ debugger()->sourceParsed(callFrame, executable->source().provider(), error.m_line, error.m_message);
+
+ if (error.m_type != ParserError::ErrorNone) {
+ *exception = error.toErrorObject(this, executable->source());
+ return 0;
+ }
+
+ return unlinkedCode;
+}
+
+UnlinkedFunctionExecutable* JSGlobalObject::createFunctionExecutableFromGlobalCode(CallFrame* callFrame, const Identifier& name, const SourceCode& code, JSObject** exception)
+{
+ ParserError error;
+ UnlinkedFunctionExecutable* executable = globalData().codeCache()->getFunctionExecutableFromGlobalCode(globalData(), name, code, error);
+ if (hasDebugger())
+ debugger()->sourceParsed(callFrame, code.provider(), error.m_line, error.m_message);
+
+ if (error.m_type != ParserError::ErrorNone) {
+ *exception = error.toErrorObject(this, code);
+ return 0;
+ }
+
+ return executable;
+}
+
+
} // namespace JSC