diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-09-09 14:16:12 +1000 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-01-05 12:18:11 +0100 |
commit | 7e77d8742ada5ee7fbdd8dfb7c3dc7ee9ebe3891 (patch) | |
tree | b88f2cd425a8135070610d9e6ebc7db5e83363f1 | |
parent | dd34832c519d86f1f7d157d872a87f8ed56de6c8 (diff) | |
download | qtjsbackend-7e77d8742ada5ee7fbdd8dfb7c3dc7ee9ebe3891.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: Ib022e74b3b912260d990faa2b2b81a32fa1d8a07
-rw-r--r-- | src/3rdparty/v8/include/v8.h | 5 | ||||
-rw-r--r-- | src/3rdparty/v8/src/compiler.cc | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/3rdparty/v8/include/v8.h b/src/3rdparty/v8/include/v8.h index 6baf2b2..229ddbd 100644 --- a/src/3rdparty/v8/include/v8.h +++ b/src/3rdparty/v8/include/v8.h @@ -588,8 +588,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 4902e72..cabca74 100644 --- a/src/3rdparty/v8/src/compiler.cc +++ b/src/3rdparty/v8/src/compiler.cc @@ -499,7 +499,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()) { |