Index: src/runtime/runtime-debug.cc |
diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc |
index 8ddc494428f9726df604c0c4808e5666b1cf6c28..305344e509851dc0064718f9baefa17167e3c253 100644 |
--- a/src/runtime/runtime-debug.cc |
+++ b/src/runtime/runtime-debug.cc |
@@ -681,11 +681,14 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) { |
if (scope_info->LocalIsSynthetic(i)) continue; |
Handle<String> name(scope_info->LocalName(i)); |
VariableMode mode; |
+ ContextSlotKindFlag slot_kind; |
InitializationFlag init_flag; |
MaybeAssignedFlag maybe_assigned_flag; |
locals->set(local * 2, *name); |
- int context_slot_index = ScopeInfo::ContextSlotIndex( |
- scope_info, name, &mode, &init_flag, &maybe_assigned_flag); |
+ int context_slot_index = |
+ ScopeInfo::ContextSlotIndex(scope_info, name, &mode, &slot_kind, |
+ &init_flag, &maybe_assigned_flag); |
+ DCHECK(ContextSlotKindFlag::kLocal == slot_kind); |
Toon Verwaest
2015/07/01 09:28:55
DCHECK_EQ
This may not be necessary anymore if you
Igor Sheludko
2015/07/02 16:50:13
Done.
|
Object* value = context->get(context_slot_index); |
locals->set(local * 2 + 1, value); |
local++; |
@@ -856,10 +859,11 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) { |
static bool ParameterIsShadowedByContextLocal(Handle<ScopeInfo> info, |
Handle<String> parameter_name) { |
VariableMode mode; |
+ ContextSlotKindFlag slot_kind; |
InitializationFlag init_flag; |
MaybeAssignedFlag maybe_assigned_flag; |
- return ScopeInfo::ContextSlotIndex(info, parameter_name, &mode, &init_flag, |
- &maybe_assigned_flag) != -1; |
+ return ScopeInfo::ContextSlotIndex(info, parameter_name, &mode, &slot_kind, |
+ &init_flag, &maybe_assigned_flag) != -1; |
} |
@@ -873,6 +877,7 @@ static Handle<Context> MaterializeReceiver(Isolate* isolate, |
switch (scope_info->scope_type()) { |
case FUNCTION_SCOPE: { |
VariableMode variable_mode; |
+ ContextSlotKindFlag slot_kind; |
InitializationFlag init_flag; |
MaybeAssignedFlag maybe_assigned_flag; |
@@ -880,7 +885,7 @@ static Handle<Context> MaterializeReceiver(Isolate* isolate, |
// already. |
if (ScopeInfo::ContextSlotIndex( |
scope_info, isolate->factory()->this_string(), &variable_mode, |
- &init_flag, &maybe_assigned_flag) >= 0) { |
+ &slot_kind, &init_flag, &maybe_assigned_flag) >= 0) { |
return target; |
} |
receiver = handle(frame->receiver(), isolate); |
@@ -1077,10 +1082,12 @@ static bool SetContextLocalValue(Isolate* isolate, Handle<ScopeInfo> scope_info, |
Handle<String> next_name(scope_info->ContextLocalName(i)); |
if (String::Equals(variable_name, next_name)) { |
VariableMode mode; |
+ ContextSlotKindFlag slot_kind; |
InitializationFlag init_flag; |
MaybeAssignedFlag maybe_assigned_flag; |
- int context_index = ScopeInfo::ContextSlotIndex( |
- scope_info, next_name, &mode, &init_flag, &maybe_assigned_flag); |
+ int context_index = |
+ ScopeInfo::ContextSlotIndex(scope_info, next_name, &mode, &slot_kind, |
+ &init_flag, &maybe_assigned_flag); |
context->set(context_index, *new_value); |
return true; |
} |
@@ -2671,6 +2678,14 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluate) { |
} |
+static inline bool IsDebugContext(Isolate* isolate, Context* context) { |
+ // Try to unwrap script context if it exist. |
+ if (context->IsScriptContext()) context = context->previous(); |
+ DCHECK_NOT_NULL(context); |
+ return context == *isolate->debug()->debug_context(); |
+} |
+ |
+ |
RUNTIME_FUNCTION(Runtime_DebugEvaluateGlobal) { |
HandleScope scope(isolate); |
@@ -2690,7 +2705,7 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluateGlobal) { |
// Enter the top context from before the debugger was invoked. |
SaveContext save(isolate); |
SaveContext* top = &save; |
- while (top != NULL && *top->context() == *isolate->debug()->debug_context()) { |
+ while (top != NULL && IsDebugContext(isolate, *top->context())) { |
top = top->prev(); |
} |
if (top != NULL) { |