summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2011-09-09 14:16:12 +1000
committerQt by Nokia <qt-info@nokia.com>2012-06-13 09:57:03 +0200
commitf7d784789656ab94077c29dcb7816a5cb945e049 (patch)
treeaec4704daa64637fef546eb4d445abad824c1979 /src
parent6c28d75933a9a56a311573593711a7e73eeab8c3 (diff)
downloadqtjsbackend-f7d784789656ab94077c29dcb7816a5cb945e049.tar.gz
[V8] Allow a script to be flagged as "native"
Native scripts do not appear in backtraces, or in the source and line number when exceptions are thrown from within them. This is useful to be able to write code in JavaScript instead of C++ and still have it appear sensibly to the user. Change-Id: I0a772f7bdde24257b0aa19216b932f6a546ab918 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/v8/include/v8.h5
-rw-r--r--src/3rdparty/v8/src/compiler.cc2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/3rdparty/v8/include/v8.h b/src/3rdparty/v8/include/v8.h
index d79b1c3..fbb348f 100644
--- a/src/3rdparty/v8/include/v8.h
+++ b/src/3rdparty/v8/include/v8.h
@@ -591,8 +591,9 @@ class ScriptOrigin {
class V8EXPORT Script {
public:
enum CompileFlags {
- Default = 0x00,
- QmlMode = 0x01
+ Default = 0x00,
+ QmlMode = 0x01,
+ NativeMode = 0x02
};
/**
diff --git a/src/3rdparty/v8/src/compiler.cc b/src/3rdparty/v8/src/compiler.cc
index 88b477d..4060b15 100644
--- a/src/3rdparty/v8/src/compiler.cc
+++ b/src/3rdparty/v8/src/compiler.cc
@@ -508,7 +508,7 @@ Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source,
// Create a script object describing the script to be compiled.
Handle<Script> script = FACTORY->NewScript(source);
- if (natives == NATIVES_CODE) {
+ if (natives == NATIVES_CODE || compile_flags & v8::Script::NativeMode) {
script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
}
if (!script_name.is_null()) {