OLD | NEW |
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 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1923 heap_->prototype_symbol(), js_fun->prototype()); | 1923 heap_->prototype_symbol(), js_fun->prototype()); |
1924 } | 1924 } |
1925 } | 1925 } |
1926 SetInternalReference(js_fun, entry, | 1926 SetInternalReference(js_fun, entry, |
1927 "shared", js_fun->shared(), | 1927 "shared", js_fun->shared(), |
1928 JSFunction::kSharedFunctionInfoOffset); | 1928 JSFunction::kSharedFunctionInfoOffset); |
1929 TagObject(js_fun->unchecked_context(), "(context)"); | 1929 TagObject(js_fun->unchecked_context(), "(context)"); |
1930 SetInternalReference(js_fun, entry, | 1930 SetInternalReference(js_fun, entry, |
1931 "context", js_fun->unchecked_context(), | 1931 "context", js_fun->unchecked_context(), |
1932 JSFunction::kContextOffset); | 1932 JSFunction::kContextOffset); |
1933 TagObject(js_fun->literals(), "(function literals)"); | 1933 TagObject(js_fun->literals_or_bindings(), |
| 1934 "(function literals_or_bindings)"); |
1934 SetInternalReference(js_fun, entry, | 1935 SetInternalReference(js_fun, entry, |
1935 "literals", js_fun->literals(), | 1936 "literals_or_bindings", |
| 1937 js_fun->literals_or_bindings(), |
1936 JSFunction::kLiteralsOffset); | 1938 JSFunction::kLiteralsOffset); |
1937 } | 1939 } |
1938 TagObject(js_obj->properties(), "(object properties)"); | 1940 TagObject(js_obj->properties(), "(object properties)"); |
1939 SetInternalReference(obj, entry, | 1941 SetInternalReference(obj, entry, |
1940 "properties", js_obj->properties(), | 1942 "properties", js_obj->properties(), |
1941 JSObject::kPropertiesOffset); | 1943 JSObject::kPropertiesOffset); |
1942 TagObject(js_obj->elements(), "(object elements)"); | 1944 TagObject(js_obj->elements(), "(object elements)"); |
1943 SetInternalReference(obj, entry, | 1945 SetInternalReference(obj, entry, |
1944 "elements", js_obj->elements(), | 1946 "elements", js_obj->elements(), |
1945 JSObject::kElementsOffset); | 1947 JSObject::kElementsOffset); |
1946 } else if (obj->IsString()) { | 1948 } else if (obj->IsString()) { |
1947 if (obj->IsConsString()) { | 1949 if (obj->IsConsString()) { |
1948 ConsString* cs = ConsString::cast(obj); | 1950 ConsString* cs = ConsString::cast(obj); |
1949 SetInternalReference(obj, entry, 1, cs->first()); | 1951 SetInternalReference(obj, entry, 1, cs->first()); |
1950 SetInternalReference(obj, entry, 2, cs->second()); | 1952 SetInternalReference(obj, entry, 2, cs->second()); |
1951 } | 1953 } |
| 1954 if (obj->IsSlicedString()) { |
| 1955 SlicedString* ss = SlicedString::cast(obj); |
| 1956 SetInternalReference(obj, entry, "parent", ss->parent()); |
| 1957 } |
1952 extract_indexed_refs = false; | 1958 extract_indexed_refs = false; |
1953 } else if (obj->IsGlobalContext()) { | 1959 } else if (obj->IsGlobalContext()) { |
1954 Context* context = Context::cast(obj); | 1960 Context* context = Context::cast(obj); |
1955 TagObject(context->jsfunction_result_caches(), | 1961 TagObject(context->jsfunction_result_caches(), |
1956 "(context func. result caches)"); | 1962 "(context func. result caches)"); |
1957 TagObject(context->normalized_map_cache(), "(context norm. map cache)"); | 1963 TagObject(context->normalized_map_cache(), "(context norm. map cache)"); |
1958 TagObject(context->runtime_context(), "(runtime context)"); | 1964 TagObject(context->runtime_context(), "(runtime context)"); |
1959 TagObject(context->map_cache(), "(context map cache)"); | 1965 TagObject(context->map_cache(), "(context map cache)"); |
1960 TagObject(context->data(), "(context data)"); | 1966 TagObject(context->data(), "(context data)"); |
1961 } else if (obj->IsMap()) { | 1967 } else if (obj->IsMap()) { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2157 int length = js_obj->GetInternalFieldCount(); | 2163 int length = js_obj->GetInternalFieldCount(); |
2158 for (int i = 0; i < length; ++i) { | 2164 for (int i = 0; i < length; ++i) { |
2159 Object* o = js_obj->GetInternalField(i); | 2165 Object* o = js_obj->GetInternalField(i); |
2160 SetInternalReference( | 2166 SetInternalReference( |
2161 js_obj, entry, i, o, js_obj->GetInternalFieldOffset(i)); | 2167 js_obj, entry, i, o, js_obj->GetInternalFieldOffset(i)); |
2162 } | 2168 } |
2163 } | 2169 } |
2164 | 2170 |
2165 | 2171 |
2166 String* V8HeapExplorer::GetConstructorName(JSObject* object) { | 2172 String* V8HeapExplorer::GetConstructorName(JSObject* object) { |
2167 if (object->IsJSFunction()) return HEAP->closure_symbol(); | 2173 Heap* heap = object->GetHeap(); |
| 2174 if (object->IsJSFunction()) return heap->closure_symbol(); |
2168 String* constructor_name = object->constructor_name(); | 2175 String* constructor_name = object->constructor_name(); |
2169 if (constructor_name == HEAP->Object_symbol()) { | 2176 if (constructor_name == heap->Object_symbol()) { |
2170 // Look up an immediate "constructor" property, if it is a function, | 2177 // Look up an immediate "constructor" property, if it is a function, |
2171 // return its name. This is for instances of binding objects, which | 2178 // return its name. This is for instances of binding objects, which |
2172 // have prototype constructor type "Object". | 2179 // have prototype constructor type "Object". |
2173 Object* constructor_prop = NULL; | 2180 Object* constructor_prop = NULL; |
2174 LookupResult result; | 2181 LookupResult result(heap->isolate()); |
2175 object->LocalLookupRealNamedProperty(HEAP->constructor_symbol(), &result); | 2182 object->LocalLookupRealNamedProperty(heap->constructor_symbol(), &result); |
2176 if (result.IsProperty()) { | 2183 if (result.IsProperty()) { |
2177 constructor_prop = result.GetLazyValue(); | 2184 constructor_prop = result.GetLazyValue(); |
2178 } | 2185 } |
2179 if (constructor_prop->IsJSFunction()) { | 2186 if (constructor_prop->IsJSFunction()) { |
2180 Object* maybe_name = JSFunction::cast(constructor_prop)->shared()->name(); | 2187 Object* maybe_name = JSFunction::cast(constructor_prop)->shared()->name(); |
2181 if (maybe_name->IsString()) { | 2188 if (maybe_name->IsString()) { |
2182 String* name = String::cast(maybe_name); | 2189 String* name = String::cast(maybe_name); |
2183 if (name->length() > 0) return name; | 2190 if (name->length() > 0) return name; |
2184 } | 2191 } |
2185 } | 2192 } |
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3393 | 3400 |
3394 | 3401 |
3395 void HeapSnapshotJSONSerializer::SortHashMap( | 3402 void HeapSnapshotJSONSerializer::SortHashMap( |
3396 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3403 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
3397 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3404 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
3398 sorted_entries->Add(p); | 3405 sorted_entries->Add(p); |
3399 sorted_entries->Sort(SortUsingEntryValue); | 3406 sorted_entries->Sort(SortUsingEntryValue); |
3400 } | 3407 } |
3401 | 3408 |
3402 } } // namespace v8::internal | 3409 } } // namespace v8::internal |
OLD | NEW |