Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(990)

Unified Diff: src/runtime/runtime-debug.cc

Issue 1218783005: Support for global var shortcuts in script contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixing builds Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/prettyprinter.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-debug.cc
diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc
index e8919b517243789f90820edd78b9bdb99ae9ee4f..9aa4341b30ad30e226d4a65c6a1c3860e98b8ac0 100644
--- a/src/runtime/runtime-debug.cc
+++ b/src/runtime/runtime-debug.cc
@@ -681,11 +681,13 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
if (scope_info->LocalIsSynthetic(i)) continue;
Handle<String> name(scope_info->LocalName(i));
VariableMode mode;
+ VariableLocation location;
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);
+ scope_info, name, &mode, &location, &init_flag, &maybe_assigned_flag);
+ DCHECK(VariableLocation::CONTEXT == location);
Object* value = context->get(context_slot_index);
locals->set(local * 2 + 1, value);
local++;
@@ -856,10 +858,11 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
static bool ParameterIsShadowedByContextLocal(Handle<ScopeInfo> info,
Handle<String> parameter_name) {
VariableMode mode;
+ VariableLocation location;
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, &location,
+ &init_flag, &maybe_assigned_flag) != -1;
}
@@ -872,14 +875,15 @@ static Handle<Context> MaterializeReceiver(Isolate* isolate,
Handle<Object> receiver;
switch (scope_info->scope_type()) {
case FUNCTION_SCOPE: {
- VariableMode variable_mode;
+ VariableMode mode;
+ VariableLocation location;
InitializationFlag init_flag;
MaybeAssignedFlag maybe_assigned_flag;
// Don't bother creating a fake context node if "this" is in the context
// already.
if (ScopeInfo::ContextSlotIndex(
- scope_info, isolate->factory()->this_string(), &variable_mode,
+ scope_info, isolate->factory()->this_string(), &mode, &location,
&init_flag, &maybe_assigned_flag) >= 0) {
return target;
}
@@ -1077,10 +1081,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;
+ VariableLocation location;
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, &location,
+ &init_flag, &maybe_assigned_flag);
context->set(context_index, *new_value);
return true;
}
@@ -2671,6 +2677,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 +2704,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) {
« no previous file with comments | « src/prettyprinter.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698