OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1989 } else if (obj->IsMap()) { | 1989 } else if (obj->IsMap()) { |
1990 ExtractMap(entry, Map::cast(obj)); | 1990 ExtractMap(entry, Map::cast(obj)); |
1991 } else if (obj->IsSharedFunctionInfo()) { | 1991 } else if (obj->IsSharedFunctionInfo()) { |
1992 ExtractSharedFunctionInfo(entry, SharedFunctionInfo::cast(obj)); | 1992 ExtractSharedFunctionInfo(entry, SharedFunctionInfo::cast(obj)); |
1993 } else if (obj->IsScript()) { | 1993 } else if (obj->IsScript()) { |
1994 ExtractScript(entry, Script::cast(obj)); | 1994 ExtractScript(entry, Script::cast(obj)); |
1995 } else if (obj->IsCodeCache()) { | 1995 } else if (obj->IsCodeCache()) { |
1996 ExtractCodeCache(entry, CodeCache::cast(obj)); | 1996 ExtractCodeCache(entry, CodeCache::cast(obj)); |
1997 } else if (obj->IsCode()) { | 1997 } else if (obj->IsCode()) { |
1998 ExtractCode(entry, Code::cast(obj)); | 1998 ExtractCode(entry, Code::cast(obj)); |
1999 } else if (obj->IsJSGlobalPropertyCell()) { | |
2000 ExtractJSGlobalPropertyCell(entry, JSGlobalPropertyCell::cast(obj)); | |
2001 extract_indexed_refs = false; | |
1999 } | 2002 } |
2000 if (extract_indexed_refs) { | 2003 if (extract_indexed_refs) { |
2001 SetInternalReference(obj, entry, "map", obj->map(), HeapObject::kMapOffset); | 2004 SetInternalReference(obj, entry, "map", obj->map(), HeapObject::kMapOffset); |
2002 IndexedReferencesExtractor refs_extractor(this, obj, entry); | 2005 IndexedReferencesExtractor refs_extractor(this, obj, entry); |
2003 obj->Iterate(&refs_extractor); | 2006 obj->Iterate(&refs_extractor); |
2004 } | 2007 } |
2005 } | 2008 } |
2006 | 2009 |
2007 | 2010 |
2008 void V8HeapExplorer::ExtractJSGlobalProxy(JSGlobalProxy* proxy) { | 2011 void V8HeapExplorer::ExtractJSGlobalProxy(JSGlobalProxy* proxy) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2086 TagObject(js_obj->elements(), "(object elements)"); | 2089 TagObject(js_obj->elements(), "(object elements)"); |
2087 SetInternalReference(obj, entry, | 2090 SetInternalReference(obj, entry, |
2088 "elements", js_obj->elements(), | 2091 "elements", js_obj->elements(), |
2089 JSObject::kElementsOffset); | 2092 JSObject::kElementsOffset); |
2090 } | 2093 } |
2091 | 2094 |
2092 | 2095 |
2093 void V8HeapExplorer::ExtractString(HeapEntry* entry, String* string) { | 2096 void V8HeapExplorer::ExtractString(HeapEntry* entry, String* string) { |
2094 if (string->IsConsString()) { | 2097 if (string->IsConsString()) { |
2095 ConsString* cs = ConsString::cast(string); | 2098 ConsString* cs = ConsString::cast(string); |
2096 SetInternalReference(cs, entry, 1, cs->first()); | 2099 SetInternalReference(cs, entry, "first", cs->first()); |
2097 SetInternalReference(cs, entry, 2, cs->second()); | 2100 SetInternalReference(cs, entry, "second", cs->second()); |
2098 } | 2101 } else if (string->IsSlicedString()) { |
2099 if (string->IsSlicedString()) { | |
2100 SlicedString* ss = SlicedString::cast(string); | 2102 SlicedString* ss = SlicedString::cast(string); |
2101 SetInternalReference(ss, entry, "parent", ss->parent()); | 2103 SetInternalReference(ss, entry, "parent", ss->parent()); |
2102 } | 2104 } |
2103 } | 2105 } |
2104 | 2106 |
2105 | 2107 |
2106 void V8HeapExplorer::ExtractContext(HeapEntry* entry, Context* context) { | 2108 void V8HeapExplorer::ExtractContext(HeapEntry* entry, Context* context) { |
2107 #define EXTRACT_CONTEXT_FIELD(index, type, name) \ | 2109 #define EXTRACT_CONTEXT_FIELD(index, type, name) \ |
2108 SetInternalReference(context, entry, #name, context->get(Context::index), \ | 2110 SetInternalReference(context, entry, #name, context->get(Context::index), \ |
2109 FixedArray::OffsetOfElementAt(Context::index)); | 2111 FixedArray::OffsetOfElementAt(Context::index)); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2221 "default_cache", code_cache->default_cache(), | 2223 "default_cache", code_cache->default_cache(), |
2222 CodeCache::kDefaultCacheOffset); | 2224 CodeCache::kDefaultCacheOffset); |
2223 TagObject(code_cache->normal_type_cache(), "(code type cache)"); | 2225 TagObject(code_cache->normal_type_cache(), "(code type cache)"); |
2224 SetInternalReference(code_cache, entry, | 2226 SetInternalReference(code_cache, entry, |
2225 "type_cache", code_cache->normal_type_cache(), | 2227 "type_cache", code_cache->normal_type_cache(), |
2226 CodeCache::kNormalTypeCacheOffset); | 2228 CodeCache::kNormalTypeCacheOffset); |
2227 } | 2229 } |
2228 | 2230 |
2229 | 2231 |
2230 void V8HeapExplorer::ExtractCode(HeapEntry* entry, Code* code) { | 2232 void V8HeapExplorer::ExtractCode(HeapEntry* entry, Code* code) { |
2231 TagObject(code->unchecked_relocation_info(), "(code relocation info)"); | 2233 TagObject(code->unchecked_relocation_info(), "(code relocation info)"); |
yurys
2012/04/25 06:26:16
btw, why we use unchecked_* accessors in this meth
alexeif
2012/04/25 09:55:10
I don't know. Changed them to checked versions.
| |
2234 SetInternalReference(code, entry, | |
2235 "relocation_info", code->relocation_info(), | |
2236 Code::kRelocationInfoOffset); | |
2237 SetInternalReference(code, entry, | |
2238 "handler_table", code->handler_table(), | |
2239 Code::kHandlerTableOffset); | |
2232 TagObject(code->unchecked_deoptimization_data(), "(code deopt data)"); | 2240 TagObject(code->unchecked_deoptimization_data(), "(code deopt data)"); |
2241 SetInternalReference(code, entry, | |
2242 "deoptimization_data", code->deoptimization_data(), | |
2243 Code::kDeoptimizationDataOffset); | |
2244 SetInternalReference(code, entry, | |
2245 "type_feedback_info", code->type_feedback_info(), | |
2246 Code::kTypeFeedbackInfoOffset); | |
2247 SetInternalReference(code, entry, | |
2248 "gc_metadata", code->gc_metadata(), | |
2249 Code::kGCMetadataOffset); | |
2233 } | 2250 } |
2234 | 2251 |
2235 | 2252 |
2253 void V8HeapExplorer::ExtractJSGlobalPropertyCell(HeapEntry* entry, | |
2254 JSGlobalPropertyCell* cell) { | |
2255 SetInternalReference(cell, entry, "value", cell->value()); | |
2256 } | |
2257 | |
2258 | |
2236 void V8HeapExplorer::ExtractClosureReferences(JSObject* js_obj, | 2259 void V8HeapExplorer::ExtractClosureReferences(JSObject* js_obj, |
2237 HeapEntry* entry) { | 2260 HeapEntry* entry) { |
2238 if (!js_obj->IsJSFunction()) return; | 2261 if (!js_obj->IsJSFunction()) return; |
2239 | 2262 |
2240 JSFunction* func = JSFunction::cast(js_obj); | 2263 JSFunction* func = JSFunction::cast(js_obj); |
2241 if (func->shared()->bound()) { | 2264 if (func->shared()->bound()) { |
2242 FixedArray* bindings = func->function_bindings(); | 2265 FixedArray* bindings = func->function_bindings(); |
2243 SetNativeBindReference(js_obj, entry, "bound_this", | 2266 SetNativeBindReference(js_obj, entry, "bound_this", |
2244 bindings->get(JSFunction::kBoundThisIndex)); | 2267 bindings->get(JSFunction::kBoundThisIndex)); |
2245 SetNativeBindReference(js_obj, entry, "bound_function", | 2268 SetNativeBindReference(js_obj, entry, "bound_function", |
(...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4018 | 4041 |
4019 | 4042 |
4020 void HeapSnapshotJSONSerializer::SortHashMap( | 4043 void HeapSnapshotJSONSerializer::SortHashMap( |
4021 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 4044 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
4022 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 4045 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
4023 sorted_entries->Add(p); | 4046 sorted_entries->Add(p); |
4024 sorted_entries->Sort(SortUsingEntryValue); | 4047 sorted_entries->Sort(SortUsingEntryValue); |
4025 } | 4048 } |
4026 | 4049 |
4027 } } // namespace v8::internal | 4050 } } // namespace v8::internal |
OLD | NEW |