Chromium Code Reviews| Index: src/runtime.cc |
| diff --git a/src/runtime.cc b/src/runtime.cc |
| index b4c34ef76922cf8b997b6ecd72f34c88d85e3587..95e3c08ddc47118dcdaf02f57d84a83f843c66e6 100644 |
| --- a/src/runtime.cc |
| +++ b/src/runtime.cc |
| @@ -11417,24 +11417,29 @@ static Handle<JSObject> MaterializeStackLocalsWithFrameInspector( |
| Handle<SharedFunctionInfo> shared(function->shared()); |
| Handle<ScopeInfo> scope_info(shared->scope_info()); |
| - // 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; |
| - |
| - Handle<Object> value(i < frame_inspector->GetParametersCount() |
| - ? frame_inspector->GetParameter(i) |
| - : isolate->heap()->undefined_value(), |
| - isolate); |
| - ASSERT(!value->IsTheHole()); |
| + // First fill all parameters. Parameters in generators are context-allocated. |
| + if (!shared->is_generator()) { |
| + 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) { |
|
Michael Starzinger
2014/03/24 10:24:28
I am little bit confused here. For generators we s
|
| + continue; |
| + } |
| - RETURN_IF_EMPTY_HANDLE_VALUE( |
| - isolate, |
| - Runtime::SetObjectProperty(isolate, target, name, value, NONE, SLOPPY), |
| - Handle<JSObject>()); |
| + Handle<Object> value(i < frame_inspector->GetParametersCount() |
| + ? frame_inspector->GetParameter(i) |
| + : isolate->heap()->undefined_value(), |
| + isolate); |
| + ASSERT(!value->IsTheHole()); |
| + |
| + RETURN_IF_EMPTY_HANDLE_VALUE( |
| + isolate, |
| + Runtime::SetObjectProperty( |
| + isolate, target, name, value, NONE, SLOPPY), |
| + Handle<JSObject>()); |
| + } |
| } |
| // Second fill all stack locals. |
| @@ -11468,13 +11473,15 @@ static void UpdateStackLocalsFromMaterializedObject(Isolate* isolate, |
| Handle<SharedFunctionInfo> shared(function->shared()); |
| Handle<ScopeInfo> scope_info(shared->scope_info()); |
| - // Parameters. |
| - for (int i = 0; i < scope_info->ParameterCount(); ++i) { |
| - ASSERT(!frame->GetParameter(i)->IsTheHole()); |
| - HandleScope scope(isolate); |
| - Handle<Object> value = GetProperty( |
| - isolate, target, Handle<String>(scope_info->ParameterName(i))); |
| - frame->SetParameterValue(i, *value); |
| + // Parameters. Parameters in generators are context-allocated. |
| + if (!shared->is_generator()) { |
| + for (int i = 0; i < scope_info->ParameterCount(); ++i) { |
| + ASSERT(!frame->GetParameter(i)->IsTheHole()); |
|
Michael Starzinger
2014/03/24 10:24:28
Likewise, instead of baking in arbitrary special h
|
| + HandleScope scope(isolate); |
| + Handle<Object> value = GetProperty( |
| + isolate, target, Handle<String>(scope_info->ParameterName(i))); |
| + frame->SetParameterValue(i, *value); |
| + } |
| } |
| // Stack locals. |