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 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1965 } | 1965 } |
1966 return false; | 1966 return false; |
1967 } | 1967 } |
1968 V8HeapExplorer* generator_; | 1968 V8HeapExplorer* generator_; |
1969 HeapObject* parent_obj_; | 1969 HeapObject* parent_obj_; |
1970 HeapEntry* parent_; | 1970 HeapEntry* parent_; |
1971 int next_index_; | 1971 int next_index_; |
1972 }; | 1972 }; |
1973 | 1973 |
1974 | 1974 |
1975 void V8HeapExplorer::ExtractJSGlobalProxy(JSGlobalProxy* proxy) { | |
mnaganov (inactive)
2012/04/24 12:25:45
I think you should put these functions after Extra
alexeif
2012/04/24 12:33:28
Done.
| |
1976 // We need to reference JS global objects from snapshot's root. | |
1977 // We use JSGlobalProxy because this is what embedder (e.g. browser) | |
1978 // uses for the global object. | |
1979 Object* object = proxy->map()->prototype(); | |
1980 bool is_debug_object = false; | |
1981 #ifdef ENABLE_DEBUGGER_SUPPORT | |
1982 is_debug_object = object->IsGlobalObject() && | |
1983 Isolate::Current()->debug()->IsDebugGlobal(GlobalObject::cast(object)); | |
1984 #endif | |
1985 if (!is_debug_object) { | |
1986 SetUserGlobalReference(object); | |
1987 } | |
1988 } | |
1989 | |
1990 | |
1991 void V8HeapExplorer::ExtractJSObject(HeapEntry* entry, JSObject* js_obj) { | |
1992 HeapObject* obj = js_obj; | |
1993 ExtractClosureReferences(js_obj, entry); | |
1994 ExtractPropertyReferences(js_obj, entry); | |
1995 ExtractElementReferences(js_obj, entry); | |
1996 ExtractInternalReferences(js_obj, entry); | |
1997 SetPropertyReference( | |
1998 obj, entry, heap_->Proto_symbol(), js_obj->GetPrototype()); | |
1999 if (obj->IsJSFunction()) { | |
2000 JSFunction* js_fun = JSFunction::cast(js_obj); | |
2001 Object* proto_or_map = js_fun->prototype_or_initial_map(); | |
2002 if (!proto_or_map->IsTheHole()) { | |
2003 if (!proto_or_map->IsMap()) { | |
2004 SetPropertyReference( | |
2005 obj, entry, | |
2006 heap_->prototype_symbol(), proto_or_map, | |
2007 NULL, | |
2008 JSFunction::kPrototypeOrInitialMapOffset); | |
2009 } else { | |
2010 SetPropertyReference( | |
2011 obj, entry, | |
2012 heap_->prototype_symbol(), js_fun->prototype()); | |
2013 } | |
2014 } | |
2015 SharedFunctionInfo* shared_info = js_fun->shared(); | |
2016 // JSFunction has either bindings or literals and never both. | |
2017 bool bound = shared_info->bound(); | |
2018 TagObject(js_fun->literals_or_bindings(), | |
2019 bound ? "(function bindings)" : "(function literals)"); | |
2020 SetInternalReference(js_fun, entry, | |
2021 bound ? "bindings" : "literals", | |
2022 js_fun->literals_or_bindings(), | |
2023 JSFunction::kLiteralsOffset); | |
2024 TagObject(shared_info, "(shared function info)"); | |
2025 SetInternalReference(js_fun, entry, | |
2026 "shared", shared_info, | |
2027 JSFunction::kSharedFunctionInfoOffset); | |
2028 TagObject(js_fun->unchecked_context(), "(context)"); | |
2029 SetInternalReference(js_fun, entry, | |
2030 "context", js_fun->unchecked_context(), | |
2031 JSFunction::kContextOffset); | |
2032 for (int i = JSFunction::kNonWeakFieldsEndOffset; | |
2033 i < JSFunction::kSize; | |
2034 i += kPointerSize) { | |
2035 SetWeakReference(js_fun, entry, i, *HeapObject::RawField(js_fun, i), i); | |
2036 } | |
2037 } else if (obj->IsGlobalObject()) { | |
2038 GlobalObject* global_obj = GlobalObject::cast(obj); | |
2039 SetInternalReference(global_obj, entry, | |
2040 "builtins", global_obj->builtins(), | |
2041 GlobalObject::kBuiltinsOffset); | |
2042 SetInternalReference(global_obj, entry, | |
2043 "global_context", global_obj->global_context(), | |
2044 GlobalObject::kGlobalContextOffset); | |
2045 SetInternalReference(global_obj, entry, | |
2046 "global_receiver", global_obj->global_receiver(), | |
2047 GlobalObject::kGlobalReceiverOffset); | |
2048 } | |
2049 TagObject(js_obj->properties(), "(object properties)"); | |
2050 SetInternalReference(obj, entry, | |
2051 "properties", js_obj->properties(), | |
2052 JSObject::kPropertiesOffset); | |
2053 TagObject(js_obj->elements(), "(object elements)"); | |
2054 SetInternalReference(obj, entry, | |
2055 "elements", js_obj->elements(), | |
2056 JSObject::kElementsOffset); | |
2057 } | |
2058 | |
2059 | |
2060 void V8HeapExplorer::ExtractString(HeapEntry* entry, String* string) { | |
2061 if (string->IsConsString()) { | |
2062 ConsString* cs = ConsString::cast(string); | |
2063 SetInternalReference(cs, entry, 1, cs->first()); | |
2064 SetInternalReference(cs, entry, 2, cs->second()); | |
2065 } | |
2066 if (string->IsSlicedString()) { | |
2067 SlicedString* ss = SlicedString::cast(string); | |
2068 SetInternalReference(ss, entry, "parent", ss->parent()); | |
2069 } | |
2070 } | |
2071 | |
2072 | |
2073 void V8HeapExplorer::ExtractContext(HeapEntry* entry, Context* context) { | |
2074 #define EXTRACT_CONTEXT_FIELD(index, type, name) \ | |
2075 SetInternalReference(context, entry, #name, context->get(Context::index), \ | |
2076 FixedArray::OffsetOfElementAt(Context::index)); | |
2077 EXTRACT_CONTEXT_FIELD(CLOSURE_INDEX, JSFunction, closure); | |
2078 EXTRACT_CONTEXT_FIELD(PREVIOUS_INDEX, Context, previous); | |
2079 EXTRACT_CONTEXT_FIELD(EXTENSION_INDEX, Object, extension); | |
2080 EXTRACT_CONTEXT_FIELD(GLOBAL_INDEX, GlobalObject, global); | |
2081 if (context->IsGlobalContext()) { | |
2082 TagObject(context->jsfunction_result_caches(), | |
2083 "(context func. result caches)"); | |
2084 TagObject(context->normalized_map_cache(), "(context norm. map cache)"); | |
2085 TagObject(context->runtime_context(), "(runtime context)"); | |
2086 TagObject(context->data(), "(context data)"); | |
2087 GLOBAL_CONTEXT_FIELDS(EXTRACT_CONTEXT_FIELD); | |
2088 #undef EXTRACT_CONTEXT_FIELD | |
2089 for (int i = Context::FIRST_WEAK_SLOT; | |
2090 i < Context::GLOBAL_CONTEXT_SLOTS; | |
2091 ++i) { | |
2092 SetWeakReference(context, entry, i, context->get(i), | |
2093 FixedArray::OffsetOfElementAt(i)); | |
2094 } | |
2095 } | |
2096 } | |
2097 | |
2098 | |
2099 void V8HeapExplorer::ExtractMap(HeapEntry* entry, Map* map) { | |
2100 SetInternalReference(map, entry, | |
2101 "prototype", map->prototype(), Map::kPrototypeOffset); | |
2102 SetInternalReference(map, entry, | |
2103 "constructor", map->constructor(), | |
2104 Map::kConstructorOffset); | |
2105 if (!map->instance_descriptors()->IsEmpty()) { | |
2106 TagObject(map->instance_descriptors(), "(map descriptors)"); | |
2107 SetInternalReference(map, entry, | |
2108 "descriptors", map->instance_descriptors(), | |
2109 Map::kInstanceDescriptorsOrBitField3Offset); | |
2110 } | |
2111 TagObject(map->prototype_transitions(), "(prototype transitions)"); | |
2112 SetInternalReference(map, entry, | |
2113 "prototype_transitions", map->prototype_transitions(), | |
2114 Map::kPrototypeTransitionsOffset); | |
2115 SetInternalReference(map, entry, | |
2116 "code_cache", map->code_cache(), | |
2117 Map::kCodeCacheOffset); | |
2118 } | |
2119 | |
2120 | |
2121 void V8HeapExplorer::ExtractSharedFunctionInfo( | |
2122 HeapEntry* entry, SharedFunctionInfo* shared) { | |
2123 HeapObject* obj = shared; | |
2124 SetInternalReference(obj, entry, | |
2125 "name", shared->name(), | |
2126 SharedFunctionInfo::kNameOffset); | |
2127 TagObject(shared->code(), "(code)"); | |
2128 SetInternalReference(obj, entry, | |
2129 "code", shared->code(), | |
2130 SharedFunctionInfo::kCodeOffset); | |
2131 TagObject(shared->scope_info(), "(function scope info)"); | |
2132 SetInternalReference(obj, entry, | |
2133 "scope_info", shared->scope_info(), | |
2134 SharedFunctionInfo::kScopeInfoOffset); | |
2135 SetInternalReference(obj, entry, | |
2136 "instance_class_name", shared->instance_class_name(), | |
2137 SharedFunctionInfo::kInstanceClassNameOffset); | |
2138 SetInternalReference(obj, entry, | |
2139 "script", shared->script(), | |
2140 SharedFunctionInfo::kScriptOffset); | |
2141 TagObject(shared->construct_stub(), "(code)"); | |
2142 SetInternalReference(obj, entry, | |
2143 "construct_stub", shared->construct_stub(), | |
2144 SharedFunctionInfo::kConstructStubOffset); | |
2145 SetInternalReference(obj, entry, | |
2146 "function_data", shared->function_data(), | |
2147 SharedFunctionInfo::kFunctionDataOffset); | |
2148 SetInternalReference(obj, entry, | |
2149 "debug_info", shared->debug_info(), | |
2150 SharedFunctionInfo::kDebugInfoOffset); | |
2151 SetInternalReference(obj, entry, | |
2152 "inferred_name", shared->inferred_name(), | |
2153 SharedFunctionInfo::kInferredNameOffset); | |
2154 SetInternalReference(obj, entry, | |
2155 "this_property_assignments", | |
2156 shared->this_property_assignments(), | |
2157 SharedFunctionInfo::kThisPropertyAssignmentsOffset); | |
2158 SetWeakReference(obj, entry, | |
2159 1, shared->initial_map(), | |
2160 SharedFunctionInfo::kInitialMapOffset); | |
2161 } | |
2162 | |
2163 | |
2164 void V8HeapExplorer::ExtractScript(HeapEntry* entry, Script* script) { | |
2165 HeapObject* obj = script; | |
2166 SetInternalReference(obj, entry, | |
2167 "source", script->source(), | |
2168 Script::kSourceOffset); | |
2169 SetInternalReference(obj, entry, | |
2170 "name", script->name(), | |
2171 Script::kNameOffset); | |
2172 SetInternalReference(obj, entry, | |
2173 "data", script->data(), | |
2174 Script::kDataOffset); | |
2175 SetInternalReference(obj, entry, | |
2176 "context_data", script->context_data(), | |
2177 Script::kContextOffset); | |
2178 TagObject(script->line_ends(), "(script line ends)"); | |
2179 SetInternalReference(obj, entry, | |
2180 "line_ends", script->line_ends(), | |
2181 Script::kLineEndsOffset); | |
2182 } | |
2183 | |
2184 | |
2185 void V8HeapExplorer::ExtractCodeCache(HeapEntry* entry, CodeCache* code_cache) { | |
2186 TagObject(code_cache->default_cache(), "(default code cache)"); | |
2187 SetInternalReference(code_cache, entry, | |
2188 "default_cache", code_cache->default_cache(), | |
2189 CodeCache::kDefaultCacheOffset); | |
2190 TagObject(code_cache->normal_type_cache(), "(code type cache)"); | |
2191 SetInternalReference(code_cache, entry, | |
2192 "type_cache", code_cache->normal_type_cache(), | |
2193 CodeCache::kNormalTypeCacheOffset); | |
2194 } | |
2195 | |
2196 | |
2197 void V8HeapExplorer::ExtractCode(HeapEntry* entry, Code* code) { | |
2198 TagObject(code->unchecked_relocation_info(), "(code relocation info)"); | |
2199 TagObject(code->unchecked_deoptimization_data(), "(code deopt data)"); | |
2200 } | |
2201 | |
2202 | |
1975 void V8HeapExplorer::ExtractReferences(HeapObject* obj) { | 2203 void V8HeapExplorer::ExtractReferences(HeapObject* obj) { |
1976 HeapEntry* entry = GetEntry(obj); | 2204 HeapEntry* entry = GetEntry(obj); |
1977 if (entry == NULL) return; // No interest in this object. | 2205 if (entry == NULL) return; // No interest in this object. |
1978 | 2206 |
1979 bool extract_indexed_refs = true; | 2207 bool extract_indexed_refs = true; |
1980 if (obj->IsJSGlobalProxy()) { | 2208 if (obj->IsJSGlobalProxy()) { |
1981 // We need to reference JS global objects from snapshot's root. | 2209 ExtractJSGlobalProxy(JSGlobalProxy::cast(obj)); |
1982 // We use JSGlobalProxy because this is what embedder (e.g. browser) | |
1983 // uses for the global object. | |
1984 JSGlobalProxy* proxy = JSGlobalProxy::cast(obj); | |
1985 Object* object = proxy->map()->prototype(); | |
1986 bool is_debug_object = false; | |
1987 #ifdef ENABLE_DEBUGGER_SUPPORT | |
1988 is_debug_object = object->IsGlobalObject() && | |
1989 Isolate::Current()->debug()->IsDebugGlobal(GlobalObject::cast(object)); | |
1990 #endif | |
1991 if (!is_debug_object) { | |
1992 SetUserGlobalReference(object); | |
1993 } | |
1994 } else if (obj->IsJSObject()) { | 2210 } else if (obj->IsJSObject()) { |
1995 JSObject* js_obj = JSObject::cast(obj); | 2211 ExtractJSObject(entry, JSObject::cast(obj)); |
1996 ExtractClosureReferences(js_obj, entry); | |
1997 ExtractPropertyReferences(js_obj, entry); | |
1998 ExtractElementReferences(js_obj, entry); | |
1999 ExtractInternalReferences(js_obj, entry); | |
2000 SetPropertyReference( | |
2001 obj, entry, heap_->Proto_symbol(), js_obj->GetPrototype()); | |
2002 if (obj->IsJSFunction()) { | |
2003 JSFunction* js_fun = JSFunction::cast(js_obj); | |
2004 Object* proto_or_map = js_fun->prototype_or_initial_map(); | |
2005 if (!proto_or_map->IsTheHole()) { | |
2006 if (!proto_or_map->IsMap()) { | |
2007 SetPropertyReference( | |
2008 obj, entry, | |
2009 heap_->prototype_symbol(), proto_or_map, | |
2010 NULL, | |
2011 JSFunction::kPrototypeOrInitialMapOffset); | |
2012 } else { | |
2013 SetPropertyReference( | |
2014 obj, entry, | |
2015 heap_->prototype_symbol(), js_fun->prototype()); | |
2016 } | |
2017 } | |
2018 SharedFunctionInfo* shared_info = js_fun->shared(); | |
2019 // JSFunction has either bindings or literals and never both. | |
2020 bool bound = shared_info->bound(); | |
2021 TagObject(js_fun->literals_or_bindings(), | |
2022 bound ? "(function bindings)" : "(function literals)"); | |
2023 SetInternalReference(js_fun, entry, | |
2024 bound ? "bindings" : "literals", | |
2025 js_fun->literals_or_bindings(), | |
2026 JSFunction::kLiteralsOffset); | |
2027 TagObject(shared_info, "(shared function info)"); | |
2028 SetInternalReference(js_fun, entry, | |
2029 "shared", shared_info, | |
2030 JSFunction::kSharedFunctionInfoOffset); | |
2031 TagObject(js_fun->unchecked_context(), "(context)"); | |
2032 SetInternalReference(js_fun, entry, | |
2033 "context", js_fun->unchecked_context(), | |
2034 JSFunction::kContextOffset); | |
2035 for (int i = JSFunction::kNonWeakFieldsEndOffset; | |
2036 i < JSFunction::kSize; | |
2037 i += kPointerSize) { | |
2038 SetWeakReference(js_fun, entry, i, *HeapObject::RawField(js_fun, i), i); | |
2039 } | |
2040 } else if (obj->IsGlobalObject()) { | |
2041 GlobalObject* global_obj = GlobalObject::cast(obj); | |
2042 SetInternalReference(global_obj, entry, | |
2043 "builtins", global_obj->builtins(), | |
2044 GlobalObject::kBuiltinsOffset); | |
2045 SetInternalReference(global_obj, entry, | |
2046 "global_context", global_obj->global_context(), | |
2047 GlobalObject::kGlobalContextOffset); | |
2048 SetInternalReference(global_obj, entry, | |
2049 "global_receiver", global_obj->global_receiver(), | |
2050 GlobalObject::kGlobalReceiverOffset); | |
2051 } | |
2052 TagObject(js_obj->properties(), "(object properties)"); | |
2053 SetInternalReference(obj, entry, | |
2054 "properties", js_obj->properties(), | |
2055 JSObject::kPropertiesOffset); | |
2056 TagObject(js_obj->elements(), "(object elements)"); | |
2057 SetInternalReference(obj, entry, | |
2058 "elements", js_obj->elements(), | |
2059 JSObject::kElementsOffset); | |
2060 } else if (obj->IsString()) { | 2212 } else if (obj->IsString()) { |
2061 if (obj->IsConsString()) { | 2213 ExtractString(entry, String::cast(obj)); |
2062 ConsString* cs = ConsString::cast(obj); | |
2063 SetInternalReference(obj, entry, 1, cs->first()); | |
2064 SetInternalReference(obj, entry, 2, cs->second()); | |
2065 } | |
2066 if (obj->IsSlicedString()) { | |
2067 SlicedString* ss = SlicedString::cast(obj); | |
2068 SetInternalReference(obj, entry, "parent", ss->parent()); | |
2069 } | |
2070 extract_indexed_refs = false; | 2214 extract_indexed_refs = false; |
2071 } else if (obj->IsContext()) { | 2215 } else if (obj->IsContext()) { |
2072 Context* context = Context::cast(obj); | 2216 ExtractContext(entry, Context::cast(obj)); |
2073 #define EXTRACT_CONTEXT_FIELD(index, type, name) \ | |
2074 SetInternalReference(context, entry, #name, context->get(Context::index), \ | |
2075 FixedArray::OffsetOfElementAt(Context::index)); | |
2076 EXTRACT_CONTEXT_FIELD(CLOSURE_INDEX, JSFunction, closure); | |
2077 EXTRACT_CONTEXT_FIELD(PREVIOUS_INDEX, Context, previous); | |
2078 EXTRACT_CONTEXT_FIELD(EXTENSION_INDEX, Object, extension); | |
2079 EXTRACT_CONTEXT_FIELD(GLOBAL_INDEX, GlobalObject, global); | |
2080 if (obj->IsGlobalContext()) { | |
2081 TagObject(context->jsfunction_result_caches(), | |
2082 "(context func. result caches)"); | |
2083 TagObject(context->normalized_map_cache(), "(context norm. map cache)"); | |
2084 TagObject(context->runtime_context(), "(runtime context)"); | |
2085 TagObject(context->data(), "(context data)"); | |
2086 GLOBAL_CONTEXT_FIELDS(EXTRACT_CONTEXT_FIELD); | |
2087 #undef EXTRACT_CONTEXT_FIELD | |
2088 for (int i = Context::FIRST_WEAK_SLOT; | |
2089 i < Context::GLOBAL_CONTEXT_SLOTS; | |
2090 ++i) { | |
2091 SetWeakReference(obj, entry, | |
2092 i, context->get(i), | |
2093 FixedArray::OffsetOfElementAt(i)); | |
2094 } | |
2095 } | |
2096 } else if (obj->IsMap()) { | 2217 } else if (obj->IsMap()) { |
2097 Map* map = Map::cast(obj); | 2218 ExtractMap(entry, Map::cast(obj)); |
2098 SetInternalReference(obj, entry, | |
2099 "prototype", map->prototype(), Map::kPrototypeOffset); | |
2100 SetInternalReference(obj, entry, | |
2101 "constructor", map->constructor(), | |
2102 Map::kConstructorOffset); | |
2103 if (!map->instance_descriptors()->IsEmpty()) { | |
2104 TagObject(map->instance_descriptors(), "(map descriptors)"); | |
2105 SetInternalReference(obj, entry, | |
2106 "descriptors", map->instance_descriptors(), | |
2107 Map::kInstanceDescriptorsOrBitField3Offset); | |
2108 } | |
2109 TagObject(map->prototype_transitions(), "(prototype transitions)"); | |
2110 SetInternalReference(obj, entry, | |
2111 "prototype_transitions", map->prototype_transitions(), | |
2112 Map::kPrototypeTransitionsOffset); | |
2113 SetInternalReference(obj, entry, | |
2114 "code_cache", map->code_cache(), | |
2115 Map::kCodeCacheOffset); | |
2116 } else if (obj->IsSharedFunctionInfo()) { | 2219 } else if (obj->IsSharedFunctionInfo()) { |
2117 SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj); | 2220 ExtractSharedFunctionInfo(entry, SharedFunctionInfo::cast(obj)); |
2118 SetInternalReference(obj, entry, | |
2119 "name", shared->name(), | |
2120 SharedFunctionInfo::kNameOffset); | |
2121 TagObject(shared->code(), "(code)"); | |
2122 SetInternalReference(obj, entry, | |
2123 "code", shared->code(), | |
2124 SharedFunctionInfo::kCodeOffset); | |
2125 TagObject(shared->scope_info(), "(function scope info)"); | |
2126 SetInternalReference(obj, entry, | |
2127 "scope_info", shared->scope_info(), | |
2128 SharedFunctionInfo::kScopeInfoOffset); | |
2129 SetInternalReference(obj, entry, | |
2130 "instance_class_name", shared->instance_class_name(), | |
2131 SharedFunctionInfo::kInstanceClassNameOffset); | |
2132 SetInternalReference(obj, entry, | |
2133 "script", shared->script(), | |
2134 SharedFunctionInfo::kScriptOffset); | |
2135 TagObject(shared->construct_stub(), "(code)"); | |
2136 SetInternalReference(obj, entry, | |
2137 "construct_stub", shared->construct_stub(), | |
2138 SharedFunctionInfo::kConstructStubOffset); | |
2139 SetInternalReference(obj, entry, | |
2140 "function_data", shared->function_data(), | |
2141 SharedFunctionInfo::kFunctionDataOffset); | |
2142 SetInternalReference(obj, entry, | |
2143 "debug_info", shared->debug_info(), | |
2144 SharedFunctionInfo::kDebugInfoOffset); | |
2145 SetInternalReference(obj, entry, | |
2146 "inferred_name", shared->inferred_name(), | |
2147 SharedFunctionInfo::kInferredNameOffset); | |
2148 SetInternalReference(obj, entry, | |
2149 "this_property_assignments", | |
2150 shared->this_property_assignments(), | |
2151 SharedFunctionInfo::kThisPropertyAssignmentsOffset); | |
2152 SetWeakReference(obj, entry, | |
2153 1, shared->initial_map(), | |
2154 SharedFunctionInfo::kInitialMapOffset); | |
2155 } else if (obj->IsScript()) { | 2221 } else if (obj->IsScript()) { |
2156 Script* script = Script::cast(obj); | 2222 ExtractScript(entry, Script::cast(obj)); |
2157 SetInternalReference(obj, entry, | |
2158 "source", script->source(), | |
2159 Script::kSourceOffset); | |
2160 SetInternalReference(obj, entry, | |
2161 "name", script->name(), | |
2162 Script::kNameOffset); | |
2163 SetInternalReference(obj, entry, | |
2164 "data", script->data(), | |
2165 Script::kDataOffset); | |
2166 SetInternalReference(obj, entry, | |
2167 "context_data", script->context_data(), | |
2168 Script::kContextOffset); | |
2169 TagObject(script->line_ends(), "(script line ends)"); | |
2170 SetInternalReference(obj, entry, | |
2171 "line_ends", script->line_ends(), | |
2172 Script::kLineEndsOffset); | |
2173 } else if (obj->IsCodeCache()) { | 2223 } else if (obj->IsCodeCache()) { |
2174 CodeCache* code_cache = CodeCache::cast(obj); | 2224 ExtractCodeCache(entry, CodeCache::cast(obj)); |
2175 TagObject(code_cache->default_cache(), "(default code cache)"); | |
2176 SetInternalReference(obj, entry, | |
2177 "default_cache", code_cache->default_cache(), | |
2178 CodeCache::kDefaultCacheOffset); | |
2179 TagObject(code_cache->normal_type_cache(), "(code type cache)"); | |
2180 SetInternalReference(obj, entry, | |
2181 "type_cache", code_cache->normal_type_cache(), | |
2182 CodeCache::kNormalTypeCacheOffset); | |
2183 } else if (obj->IsCode()) { | 2225 } else if (obj->IsCode()) { |
2184 Code* code = Code::cast(obj); | 2226 ExtractCode(entry, Code::cast(obj)); |
2185 TagObject(code->unchecked_relocation_info(), "(code relocation info)"); | |
2186 TagObject(code->unchecked_deoptimization_data(), "(code deopt data)"); | |
2187 } | 2227 } |
2188 if (extract_indexed_refs) { | 2228 if (extract_indexed_refs) { |
2189 SetInternalReference(obj, entry, "map", obj->map(), HeapObject::kMapOffset); | 2229 SetInternalReference(obj, entry, "map", obj->map(), HeapObject::kMapOffset); |
2190 IndexedReferencesExtractor refs_extractor(this, obj, entry); | 2230 IndexedReferencesExtractor refs_extractor(this, obj, entry); |
2191 obj->Iterate(&refs_extractor); | 2231 obj->Iterate(&refs_extractor); |
2192 } | 2232 } |
2193 } | 2233 } |
2194 | 2234 |
2195 | 2235 |
2196 void V8HeapExplorer::ExtractClosureReferences(JSObject* js_obj, | 2236 void V8HeapExplorer::ExtractClosureReferences(JSObject* js_obj, |
(...skipping 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3978 | 4018 |
3979 | 4019 |
3980 void HeapSnapshotJSONSerializer::SortHashMap( | 4020 void HeapSnapshotJSONSerializer::SortHashMap( |
3981 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 4021 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
3982 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 4022 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
3983 sorted_entries->Add(p); | 4023 sorted_entries->Add(p); |
3984 sorted_entries->Sort(SortUsingEntryValue); | 4024 sorted_entries->Sort(SortUsingEntryValue); |
3985 } | 4025 } |
3986 | 4026 |
3987 } } // namespace v8::internal | 4027 } } // namespace v8::internal |
OLD | NEW |