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

Side by Side Diff: src/profile-generator.cc

Issue 8352039: Cleanup ScopeInfo and SerializedScopeInfo. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Converted ScopeInfo accessors to CamelCase. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2043 matching lines...) Expand 10 before | Expand all | Expand 10 after
2054 SetInternalReference(obj, entry, "map", obj->map(), HeapObject::kMapOffset); 2054 SetInternalReference(obj, entry, "map", obj->map(), HeapObject::kMapOffset);
2055 IndexedReferencesExtractor refs_extractor(this, obj, entry); 2055 IndexedReferencesExtractor refs_extractor(this, obj, entry);
2056 obj->Iterate(&refs_extractor); 2056 obj->Iterate(&refs_extractor);
2057 } 2057 }
2058 } 2058 }
2059 2059
2060 2060
2061 void V8HeapExplorer::ExtractClosureReferences(JSObject* js_obj, 2061 void V8HeapExplorer::ExtractClosureReferences(JSObject* js_obj,
2062 HeapEntry* entry) { 2062 HeapEntry* entry) {
2063 if (js_obj->IsJSFunction()) { 2063 if (js_obj->IsJSFunction()) {
2064 HandleScope hs;
2065 JSFunction* func = JSFunction::cast(js_obj); 2064 JSFunction* func = JSFunction::cast(js_obj);
2066 Context* context = func->context(); 2065 Context* context = func->context();
2067 ZoneScope zscope(Isolate::Current(), DELETE_ON_EXIT); 2066 ScopeInfo* scope_info = context->closure()->shared()->scope_info();
2068 SerializedScopeInfo* serialized_scope_info = 2067
2069 context->closure()->shared()->scope_info(); 2068 // Add context allocated locals.
2070 ScopeInfo<ZoneListAllocationPolicy> zone_scope_info(serialized_scope_info); 2069 int context_locals = scope_info->NumContextLocals();
2071 int locals_number = zone_scope_info.NumberOfLocals(); 2070 for (int i = 0; i < context_locals; ++i) {
2072 for (int i = 0; i < locals_number; ++i) { 2071 String* local_name = scope_info->ContextLocalName(i);
2073 String* local_name = *zone_scope_info.LocalName(i); 2072 int idx = Context::MIN_CONTEXT_SLOTS + i;
2074 int idx = serialized_scope_info->ContextSlotIndex(local_name, NULL); 2073 SetClosureReference(js_obj, entry, local_name, context->get(idx));
2075 if (idx >= 0 && idx < context->length()) { 2074 }
2076 SetClosureReference(js_obj, entry, local_name, context->get(idx)); 2075
2077 } 2076 // Add function variable.
2077 if (scope_info->HasFunctionName()) {
2078 String* name = scope_info->FunctionName();
2079 int idx = Context::MIN_CONTEXT_SLOTS + context_locals;
2080 #ifdef DEBUG
2081 VariableMode mode;
2082 ASSERT(idx == scope_info->FunctionContextSlotIndex(name, &mode));
2083 #endif
2084 SetClosureReference(js_obj, entry, name, context->get(idx));
2078 } 2085 }
2079 } 2086 }
2080 } 2087 }
2081 2088
2082 2089
2083 void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, 2090 void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj,
2084 HeapEntry* entry) { 2091 HeapEntry* entry) {
2085 if (js_obj->HasFastProperties()) { 2092 if (js_obj->HasFastProperties()) {
2086 DescriptorArray* descs = js_obj->map()->instance_descriptors(); 2093 DescriptorArray* descs = js_obj->map()->instance_descriptors();
2087 for (int i = 0; i < descs->number_of_descriptors(); i++) { 2094 for (int i = 0; i < descs->number_of_descriptors(); i++) {
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
3400 3407
3401 3408
3402 void HeapSnapshotJSONSerializer::SortHashMap( 3409 void HeapSnapshotJSONSerializer::SortHashMap(
3403 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 3410 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
3404 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 3411 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
3405 sorted_entries->Add(p); 3412 sorted_entries->Add(p);
3406 sorted_entries->Sort(SortUsingEntryValue); 3413 sorted_entries->Sort(SortUsingEntryValue);
3407 } 3414 }
3408 3415
3409 } } // namespace v8::internal 3416 } } // namespace v8::internal
OLDNEW
« src/frames.cc ('K') | « src/parser.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698