diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-10-27 13:34:16 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-13 09:56:45 +0200 |
commit | 2df5be48c08803b6bafafe9c69959a4076022293 (patch) | |
tree | de9bd746c683190d5bee0d35e56420bee79589e0 /src/3rdparty/v8/src/compiler.h | |
parent | ccad1b6e4ca295861ff50b8e84560dd9769930d1 (diff) |
[V8] Introduce a QML compilation mode
In QML mode, there is a second global object - known as the QML
global object. During property resolution, if a property is not
present on the JS global object, it is resolved on the QML global
object.
This global object behavior is only enabled if a script is being
compiled in QML mode. The object to use as the QML global object
is passed as a parameter to the Script::Run() method. Any function
closures etc. created during the run will retain a reference to this
object, so different objects can be passed in different script
runs.
Change-Id: I86851683200d02208379744c887dfebc010a7ccc
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'src/3rdparty/v8/src/compiler.h')
-rw-r--r-- | src/3rdparty/v8/src/compiler.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/3rdparty/v8/src/compiler.h b/src/3rdparty/v8/src/compiler.h index 44df9e0..09583c0 100644 --- a/src/3rdparty/v8/src/compiler.h +++ b/src/3rdparty/v8/src/compiler.h @@ -58,6 +58,7 @@ class CompilationInfo BASE_EMBEDDED { return LanguageModeField::decode(flags_); } bool is_in_loop() const { return IsInLoop::decode(flags_); } + bool is_qml_mode() const { return IsQmlMode::decode(flags_); } FunctionLiteral* function() const { return function_; } Scope* scope() const { return scope_; } Scope* global_scope() const { return global_scope_; } @@ -88,6 +89,9 @@ class CompilationInfo BASE_EMBEDDED { ASSERT(is_lazy()); flags_ |= IsInLoop::encode(true); } + void MarkAsQmlMode() { + flags_ |= IsQmlMode::encode(true); + } void MarkAsNative() { flags_ |= IsNative::encode(true); } @@ -196,6 +200,9 @@ class CompilationInfo BASE_EMBEDDED { ASSERT(language_mode() == CLASSIC_MODE); SetLanguageMode(shared_info_->language_mode()); } + if (!shared_info_.is_null() && shared_info_->qml_mode()) { + MarkAsQmlMode(); + } } void SetMode(Mode mode) { @@ -222,7 +229,8 @@ class CompilationInfo BASE_EMBEDDED { // If compiling for debugging produce just full code matching the // initial mode setting. class IsCompilingForDebugging: public BitField<bool, 8, 1> {}; - + // Qml mode + class IsQmlMode: public BitField<bool, 9, 1> {}; unsigned flags_; @@ -292,14 +300,16 @@ class Compiler : public AllStatic { v8::Extension* extension, ScriptDataImpl* pre_data, Handle<Object> script_data, - NativesFlag is_natives_code); + NativesFlag is_natives_code, + v8::Script::CompileFlags = v8::Script::Default); // Compile a String source within a context for Eval. static Handle<SharedFunctionInfo> CompileEval(Handle<String> source, Handle<Context> context, bool is_global, LanguageMode language_mode, - int scope_position); + int scope_position, + bool qml_mode); // Compile from function info (used for lazy compilation). Returns true on // success and false if the compilation resulted in a stack overflow. |