summaryrefslogtreecommitdiff
path: root/src/3rdparty/v8/src/scopes.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/v8/src/scopes.cc')
-rw-r--r--src/3rdparty/v8/src/scopes.cc81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/3rdparty/v8/src/scopes.cc b/src/3rdparty/v8/src/scopes.cc
index c961257..d2a919a 100644
--- a/src/3rdparty/v8/src/scopes.cc
+++ b/src/3rdparty/v8/src/scopes.cc
@@ -37,6 +37,8 @@
#include "allocation-inl.h"
+#include "debug.h"
+
namespace v8 {
namespace internal {
@@ -191,6 +193,8 @@ void Scope::SetDefaults(ScopeType type,
// Inherit the strict mode from the parent scope.
language_mode_ = (outer_scope != NULL)
? outer_scope->language_mode_ : CLASSIC_MODE;
+ qml_mode_flag_ = (outer_scope != NULL)
+ ? outer_scope->qml_mode_flag_ : kNonQmlMode;
outer_scope_calls_non_strict_eval_ = false;
inner_scope_calls_eval_ = false;
force_eager_compilation_ = false;
@@ -1029,6 +1033,24 @@ bool Scope::ResolveVariable(CompilationInfo* info,
switch (binding_kind) {
case BOUND:
// We found a variable binding.
+ if (is_qml_mode()) {
+ Handle<GlobalObject> global = isolate_->global_object();
+
+#ifdef ENABLE_DEBUGGER_SUPPORT
+ if (isolate_->debug()->IsLoaded() && isolate_->debug()->InDebugger()) {
+ // Get the context before the debugger was entered.
+ SaveContext *save = isolate_->save_context();
+ while (save != NULL && *save->context() == *isolate_->debug()->debug_context())
+ save = save->prev();
+
+ global = Handle<GlobalObject>(save->context()->global_object());
+ }
+#endif
+
+ if (!global->HasProperty(*(proxy->name()))) {
+ var->set_is_qml_global(true);
+ }
+ }
break;
case BOUND_EVAL_SHADOWED:
@@ -1038,6 +1060,25 @@ bool Scope::ResolveVariable(CompilationInfo* info,
// debugger to evaluate arbitrary expressions at a break point).
if (var->IsGlobalObjectProperty()) {
var = NonLocal(proxy->name(), DYNAMIC_GLOBAL);
+
+ if (is_qml_mode()) {
+ Handle<GlobalObject> global = isolate_->global_object();
+
+#ifdef ENABLE_DEBUGGER_SUPPORT
+ if (isolate_->debug()->IsLoaded() && isolate_->debug()->InDebugger()) {
+ // Get the context before the debugger was entered.
+ SaveContext *save = isolate_->save_context();
+ while (save != NULL && *save->context() == *isolate_->debug()->debug_context())
+ save = save->prev();
+
+ global = Handle<GlobalObject>(save->context()->global_object());
+ }
+#endif
+
+ if (!global->HasProperty(*(proxy->name()))) {
+ var->set_is_qml_global(true);
+ }
+ }
} else if (var->is_dynamic()) {
var = NonLocal(proxy->name(), DYNAMIC);
} else {
@@ -1050,12 +1091,52 @@ bool Scope::ResolveVariable(CompilationInfo* info,
case UNBOUND:
// No binding has been found. Declare a variable on the global object.
var = info->global_scope()->DeclareDynamicGlobal(proxy->name());
+
+ if (is_qml_mode()) {
+ Handle<GlobalObject> global = isolate_->global_object();
+
+#ifdef ENABLE_DEBUGGER_SUPPORT
+ if (isolate_->debug()->IsLoaded() && isolate_->debug()->InDebugger()) {
+ // Get the context before the debugger was entered.
+ SaveContext *save = isolate_->save_context();
+ while (save != NULL && *save->context() == *isolate_->debug()->debug_context())
+ save = save->prev();
+
+ global = Handle<GlobalObject>(save->context()->global_object());
+ }
+#endif
+
+ if (!global->HasProperty(*(proxy->name()))) {
+ var->set_is_qml_global(true);
+ }
+ }
+
break;
case UNBOUND_EVAL_SHADOWED:
// No binding has been found. But some scope makes a
// non-strict 'eval' call.
var = NonLocal(proxy->name(), DYNAMIC_GLOBAL);
+
+ if (is_qml_mode()) {
+ Handle<GlobalObject> global = isolate_->global_object();
+
+#ifdef ENABLE_DEBUGGER_SUPPORT
+ if (isolate_->debug()->IsLoaded() && isolate_->debug()->InDebugger()) {
+ // Get the context before the debugger was entered.
+ SaveContext *save = isolate_->save_context();
+ while (save != NULL && *save->context() == *isolate_->debug()->debug_context())
+ save = save->prev();
+
+ global = Handle<GlobalObject>(save->context()->global_object());
+ }
+#endif
+
+ if (!global->HasProperty(*(proxy->name()))) {
+ var->set_is_qml_global(true);
+ }
+ }
+
break;
case DYNAMIC_LOOKUP: