Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Unified Diff: src/runtime/runtime-debug.cc

Issue 2139613002: [debug] use handle list instead of fixed array for temporary storage. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: address comment Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-debug.cc
diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc
index 9db7b7f0f1ccce5bf707d01b6670e9ed31cce644..52a9286ff91d7c84fe8895ac016b093631f18bea 100644
--- a/src/runtime/runtime-debug.cc
+++ b/src/runtime/runtime-debug.cc
@@ -612,16 +612,13 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
}
}
- Handle<FixedArray> locals =
- isolate->factory()->NewFixedArray(local_count * 2);
-
+ List<Handle<Object>> locals;
// Fill in the values of the locals.
- int local = 0;
int i = 0;
for (; i < scope_info->StackLocalCount(); ++i) {
// Use the value from the stack.
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 =
frame_inspector.GetExpression(scope_info->StackLocalIndex(i));
// TODO(yangguo): We convert optimized out values to {undefined} when they
@@ -629,10 +626,9 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
if (value->IsOptimizedOut(isolate)) {
value = isolate->factory()->undefined_value();
}
- locals->set(local * 2 + 1, *value);
- local++;
+ locals.Add(value);
}
- if (local < local_count) {
+ if (locals.length() < local_count * 2) {
// Get the context containing declarations.
Handle<Context> context(
Handle<Context>::cast(frame_inspector.GetContext())->closure_context());
@@ -642,12 +638,11 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
VariableMode mode;
InitializationFlag init_flag;
MaybeAssignedFlag maybe_assigned_flag;
- locals->set(local * 2, *name);
+ locals.Add(name);
int context_slot_index = ScopeInfo::ContextSlotIndex(
scope_info, name, &mode, &init_flag, &maybe_assigned_flag);
Object* value = context->get(context_slot_index);
- locals->set(local * 2 + 1, value);
- local++;
+ locals.Add(Handle<Object>(value, isolate));
}
}
@@ -753,9 +748,7 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
}
// Add locals name and value from the temporary copy from the function frame.
- for (int i = 0; i < local_count * 2; i++) {
- details->set(details_index++, locals->get(i));
- }
+ for (const auto& local : locals) details->set(details_index++, *local);
// Add the value being returned.
if (at_return) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698