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

Unified Diff: src/profile-generator.cc

Issue 8352039: Cleanup ScopeInfo and SerializedScopeInfo. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased to include removal of stack height tracking and strict mode flag changes. Created 9 years, 1 month 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
Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index 9812c26e9e410be711b567bff01a0b8b4d061163..e4908be6e449e3a15646f873341ad25e349e2cf3 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -2064,17 +2064,22 @@ void V8HeapExplorer::ExtractClosureReferences(JSObject* js_obj,
HandleScope hs;
JSFunction* func = JSFunction::cast(js_obj);
Context* context = func->context();
- ZoneScope zscope(Isolate::Current(), DELETE_ON_EXIT);
- SerializedScopeInfo* serialized_scope_info =
- context->closure()->shared()->scope_info();
- ScopeInfo<ZoneListAllocationPolicy> zone_scope_info(serialized_scope_info);
- int locals_number = zone_scope_info.NumberOfLocals();
- for (int i = 0; i < locals_number; ++i) {
- String* local_name = *zone_scope_info.LocalName(i);
- int idx = serialized_scope_info->ContextSlotIndex(local_name, NULL);
- if (idx >= 0 && idx < context->length()) {
- SetClosureReference(js_obj, entry, local_name, context->get(idx));
- }
+ ScopeInfo* scope_info = context->closure()->shared()->scope_info();
+
+ // Add context allocated locals.
+ int context_locals = scope_info->num_context_locals();
+ for (int i = 0; i < context_locals; ++i) {
+ String* local_name = *scope_info->context_local_name(i);
Kevin Millikin (Chromium) 2011/11/02 16:31:19 Not your code, but while you're cleaning this up I
Steven 2011/11/02 18:52:59 Done. However AFAICS this is the only HandleScope
+ int idx = Context::MIN_CONTEXT_SLOTS + i;
+ SetClosureReference(js_obj, entry, local_name, context->get(idx));
+ }
+
+ // Add function variable.
+ if (scope_info->HasFunctionName()) {
+ String* name = *scope_info->function_name();
+ int idx = Context::MIN_CONTEXT_SLOTS + context_locals;
+ ASSERT(idx == scope_info->FunctionContextSlotIndex(name, NULL));
+ SetClosureReference(js_obj, entry, name, context->get(idx));
}
}
}

Powered by Google App Engine
This is Rietveld 408576698