summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/v8/src/compiler.h
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2011-10-27 13:34:16 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-01 12:03:42 +0100
commit8a4d849a0152c76bd9107a1b38a641cf8c0ff226 (patch)
treeffcea453f5bc3a7631f6d183a3ee8360d45b8dfd /src/3rdparty/v8/src/compiler.h
parentab8f129b865ce22e72ad2ad6025d94cc8151b2b3 (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: Ib6b4ed363b7e8089d38a9cdcfb0d3b314dc333ca Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Diffstat (limited to 'src/3rdparty/v8/src/compiler.h')
-rw-r--r--src/3rdparty/v8/src/compiler.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/3rdparty/v8/src/compiler.h b/src/3rdparty/v8/src/compiler.h
index bedf5ee..054e3b9 100644
--- a/src/3rdparty/v8/src/compiler.h
+++ b/src/3rdparty/v8/src/compiler.h
@@ -57,6 +57,7 @@ class CompilationInfo BASE_EMBEDDED {
return StrictModeFlagField::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_; }
Handle<Code> code() const { return code_; }
@@ -85,6 +86,9 @@ class CompilationInfo BASE_EMBEDDED {
ASSERT(is_lazy());
flags_ |= IsInLoop::encode(true);
}
+ void MarkAsQmlMode() {
+ flags_ |= IsQmlMode::encode(true);
+ }
void MarkAsNative() {
flags_ |= IsNative::encode(true);
}
@@ -192,6 +196,9 @@ class CompilationInfo BASE_EMBEDDED {
ASSERT(strict_mode_flag() == kNonStrictMode);
SetStrictModeFlag(shared_info_->strict_mode_flag());
}
+ if (!shared_info_.is_null() && shared_info_->qml_mode()) {
+ MarkAsQmlMode();
+ }
}
void SetMode(Mode mode) {
@@ -218,7 +225,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_;
@@ -283,13 +291,15 @@ 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,
- StrictModeFlag strict_mode);
+ StrictModeFlag strict_mode,
+ 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.