 Chromium Code Reviews
 Chromium Code Reviews Issue 207153004:
  Fix DebugEvaluate for generators.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 207153004:
  Fix DebugEvaluate for generators.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| Index: src/runtime.cc | 
| diff --git a/src/runtime.cc b/src/runtime.cc | 
| index b4c34ef76922cf8b997b6ecd72f34c88d85e3587..7835ffeec3d0c166c9bcfb4579bdb9e3990707e4 100644 | 
| --- a/src/runtime.cc | 
| +++ b/src/runtime.cc | 
| @@ -11407,6 +11407,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameDetails) { | 
| } | 
| +static bool ParameterIsShadowedByContextLocal(Handle<ScopeInfo> info, | 
| + int index) { | 
| + VariableMode mode; | 
| + InitializationFlag flag; | 
| + return info->ContextSlotIndex(info->ParameterName(index), &mode, &flag) != -1; | 
| +} | 
| + | 
| + | 
| // Create a plain JSObject which materializes the local scope for the specified | 
| // frame. | 
| static Handle<JSObject> MaterializeStackLocalsWithFrameInspector( | 
| @@ -11419,21 +11427,21 @@ static Handle<JSObject> MaterializeStackLocalsWithFrameInspector( | 
| // First fill all parameters. | 
| for (int i = 0; i < scope_info->ParameterCount(); ++i) { | 
| - Handle<String> name(scope_info->ParameterName(i)); | 
| - VariableMode mode; | 
| - InitializationFlag init_flag; | 
| // Do not materialize the parameter if it is shadowed by a context local. | 
| - if (scope_info->ContextSlotIndex(*name, &mode, &init_flag) != -1) continue; | 
| + if (ParameterIsShadowedByContextLocal(scope_info, i)) continue; | 
| + HandleScope scope(isolate); | 
| Handle<Object> value(i < frame_inspector->GetParametersCount() | 
| ? frame_inspector->GetParameter(i) | 
| : isolate->heap()->undefined_value(), | 
| isolate); | 
| ASSERT(!value->IsTheHole()); | 
| + Handle<String> name(scope_info->ParameterName(i)); | 
| RETURN_IF_EMPTY_HANDLE_VALUE( | 
| isolate, | 
| - Runtime::SetObjectProperty(isolate, target, name, value, NONE, SLOPPY), | 
| + Runtime::SetObjectProperty( | 
| 
Michael Starzinger
2014/03/24 10:57:07
nit: Should fit into one line again now.
 | 
| + isolate, target, name, value, NONE, SLOPPY), | 
| Handle<JSObject>()); | 
| } | 
| @@ -11470,10 +11478,13 @@ static void UpdateStackLocalsFromMaterializedObject(Isolate* isolate, | 
| // Parameters. | 
| for (int i = 0; i < scope_info->ParameterCount(); ++i) { | 
| + // Shadowed parameters were not materialized. | 
| + if (ParameterIsShadowedByContextLocal(scope_info, i)) continue; | 
| + | 
| ASSERT(!frame->GetParameter(i)->IsTheHole()); | 
| HandleScope scope(isolate); | 
| - Handle<Object> value = GetProperty( | 
| - isolate, target, Handle<String>(scope_info->ParameterName(i))); | 
| + Handle<String> name(scope_info->ParameterName(i)); | 
| + Handle<Object> value = GetProperty(isolate, target, name); | 
| frame->SetParameterValue(i, *value); | 
| } |