Commit 133957e7 authored by peter.rybin@gmail.com's avatar peter.rybin@gmail.com

Fix set variable value bug: a function argument must be updated in 2 places

Review URL: https://codereview.chromium.org/11519020

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13225 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6380b815
......@@ -10836,11 +10836,14 @@ static bool SetLocalVariableValue(Isolate* isolate,
Handle<SharedFunctionInfo> shared(function->shared());
Handle<ScopeInfo> scope_info(shared->scope_info());
bool default_result = false;
// Parameters.
for (int i = 0; i < scope_info->ParameterCount(); ++i) {
if (scope_info->ParameterName(i)->Equals(*variable_name)) {
frame->SetParameterValue(i, *new_value);
return true;
// Argument might be shadowed in heap context, don't stop here.
default_result = true;
}
}
......@@ -10882,7 +10885,7 @@ static bool SetLocalVariableValue(Isolate* isolate,
}
}
return false;
return default_result;
}
......
......@@ -257,6 +257,38 @@ RunPauseTest(0, 'mouse', 'v1', 'dog', 'dog', (function Factory() {
})());
// Check that we correctly update local variable that
// is referenced from an inner closure.
RunPauseTest(0, 'Blue', 'v', 'Green', 'Green', (function Factory() {
return function() {
function A() {
var v = "Blue";
function Inner() {
return void v;
}
debugger;
return v;
}
return A();
}
})());
// Check that we correctly update parameter, that is known to be stored
// both on stack and in heap.
RunPauseTest(0, 5, 'p', 2012, 2012, (function Factory() {
return function() {
function A(p) {
function Inner() {
return void p;
}
debugger;
return p;
}
return A(5);
}
})());
// Test value description protocol JSON
assertEquals(true, Debug.TestApi.CommandProcessorResolveValue({value: true}));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment