Commit 02130bfb authored by yangguo's avatar yangguo Committed by Commit bot

[debug] use handle list instead of fixed array for temporary storage.

R=jgruber@chromium.org

Review-Url: https://codereview.chromium.org/2139613002
Cr-Commit-Position: refs/heads/master@{#37666}
parent 4e862dd9
...@@ -615,16 +615,13 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) { ...@@ -615,16 +615,13 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
} }
} }
Handle<FixedArray> locals = List<Handle<Object>> locals;
isolate->factory()->NewFixedArray(local_count * 2);
// Fill in the values of the locals. // Fill in the values of the locals.
int local = 0;
int i = 0; int i = 0;
for (; i < scope_info->StackLocalCount(); ++i) { for (; i < scope_info->StackLocalCount(); ++i) {
// Use the value from the stack. // Use the value from the stack.
if (ScopeInfo::VariableIsSynthetic(scope_info->LocalName(i))) continue; if (ScopeInfo::VariableIsSynthetic(scope_info->LocalName(i))) continue;
locals->set(local * 2, scope_info->LocalName(i)); locals.Add(Handle<String>(scope_info->LocalName(i), isolate));
Handle<Object> value = Handle<Object> value =
frame_inspector.GetExpression(scope_info->StackLocalIndex(i)); frame_inspector.GetExpression(scope_info->StackLocalIndex(i));
// TODO(yangguo): We convert optimized out values to {undefined} when they // TODO(yangguo): We convert optimized out values to {undefined} when they
...@@ -632,10 +629,9 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) { ...@@ -632,10 +629,9 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
if (value->IsOptimizedOut(isolate)) { if (value->IsOptimizedOut(isolate)) {
value = isolate->factory()->undefined_value(); value = isolate->factory()->undefined_value();
} }
locals->set(local * 2 + 1, *value); locals.Add(value);
local++;
} }
if (local < local_count) { if (locals.length() < local_count * 2) {
// Get the context containing declarations. // Get the context containing declarations.
Handle<Context> context( Handle<Context> context(
Handle<Context>::cast(frame_inspector.GetContext())->closure_context()); Handle<Context>::cast(frame_inspector.GetContext())->closure_context());
...@@ -645,12 +641,11 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) { ...@@ -645,12 +641,11 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
VariableMode mode; VariableMode mode;
InitializationFlag init_flag; InitializationFlag init_flag;
MaybeAssignedFlag maybe_assigned_flag; MaybeAssignedFlag maybe_assigned_flag;
locals->set(local * 2, *name); locals.Add(name);
int context_slot_index = ScopeInfo::ContextSlotIndex( int context_slot_index = ScopeInfo::ContextSlotIndex(
scope_info, name, &mode, &init_flag, &maybe_assigned_flag); scope_info, name, &mode, &init_flag, &maybe_assigned_flag);
Object* value = context->get(context_slot_index); Object* value = context->get(context_slot_index);
locals->set(local * 2 + 1, value); locals.Add(Handle<Object>(value, isolate));
local++;
} }
} }
...@@ -756,9 +751,7 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) { ...@@ -756,9 +751,7 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
} }
// Add locals name and value from the temporary copy from the function frame. // Add locals name and value from the temporary copy from the function frame.
for (int i = 0; i < local_count * 2; i++) { for (const auto& local : locals) details->set(details_index++, *local);
details->set(details_index++, locals->get(i));
}
// Add the value being returned. // Add the value being returned.
if (at_return) { if (at_return) {
......
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