Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index e763d435cc985e80a21f0fe43b4e11439c534e6b..497e8d338381df5d139fb3a3b0f01f5bcb7e744a 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -11364,6 +11364,12 @@ 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; |
+ |
Handle<Object> value(i < frame_inspector->GetParametersCount() |
? frame_inspector->GetParameter(i) |
: isolate->heap()->undefined_value(), |
@@ -11372,32 +11378,23 @@ static Handle<JSObject> MaterializeStackLocalsWithFrameInspector( |
RETURN_IF_EMPTY_HANDLE_VALUE( |
isolate, |
- Runtime::SetObjectProperty(isolate, |
- target, |
- Handle<String>(scope_info->ParameterName(i)), |
- value, |
- NONE, |
- kNonStrictMode), |
+ Runtime::SetObjectProperty( |
+ isolate, target, name, value, NONE, kNonStrictMode), |
Handle<JSObject>()); |
} |
// Second fill all stack locals. |
for (int i = 0; i < scope_info->StackLocalCount(); ++i) { |
+ Handle<String> name(scope_info->StackLocalName(i)); |
Handle<Object> value(frame_inspector->GetExpression(i), isolate); |
if (value->IsTheHole()) continue; |
RETURN_IF_EMPTY_HANDLE_VALUE( |
isolate, |
Runtime::SetObjectProperty( |
- isolate, |
- target, |
- Handle<String>(scope_info->StackLocalName(i)), |
- value, |
- NONE, |
- kNonStrictMode), |
+ isolate, target, name, value, NONE, kNonStrictMode), |
Handle<JSObject>()); |
} |
- |
return target; |
} |