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 2164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2175 } | 2175 } |
2176 | 2176 |
2177 | 2177 |
2178 void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, int entry) { | 2178 void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, int entry) { |
2179 if (js_obj->HasFastProperties()) { | 2179 if (js_obj->HasFastProperties()) { |
2180 DescriptorArray* descs = js_obj->map()->instance_descriptors(); | 2180 DescriptorArray* descs = js_obj->map()->instance_descriptors(); |
2181 for (int i = 0; i < descs->number_of_descriptors(); i++) { | 2181 for (int i = 0; i < descs->number_of_descriptors(); i++) { |
2182 switch (descs->GetType(i)) { | 2182 switch (descs->GetType(i)) { |
2183 case FIELD: { | 2183 case FIELD: { |
2184 int index = descs->GetFieldIndex(i); | 2184 int index = descs->GetFieldIndex(i); |
2185 | |
2186 String* k = descs->GetKey(i); | |
2185 if (index < js_obj->map()->inobject_properties()) { | 2187 if (index < js_obj->map()->inobject_properties()) { |
2186 SetPropertyReference( | 2188 Object* value = js_obj->InObjectPropertyAt(index); |
2187 js_obj, entry, | 2189 if (k->length() > 0) { |
Vyacheslav Egorov (Google)
2012/07/02 12:12:45
Consider comparing against Heap::hidden_symbol()
yurys
2012/07/02 12:43:27
Done.
| |
2188 descs->GetKey(i), js_obj->InObjectPropertyAt(index), | 2190 SetPropertyReference( |
2189 NULL, | 2191 js_obj, entry, |
2190 js_obj->GetInObjectPropertyOffset(index)); | 2192 k, value, |
2193 NULL, | |
2194 js_obj->GetInObjectPropertyOffset(index)); | |
2195 } else { | |
2196 OS::Print("Empty name for fast property 1\n"); | |
Vyacheslav Egorov (Google)
2012/07/02 12:12:45
remove OS::Print
yurys
2012/07/02 12:43:27
Done.
| |
2197 TagObject(value, "(hidden properties)"); | |
2198 SetInternalReference( | |
2199 js_obj, entry, | |
2200 "hidden_properties", value, | |
2201 js_obj->GetInObjectPropertyOffset(index)); | |
2202 } | |
2191 } else { | 2203 } else { |
2192 SetPropertyReference( | 2204 Object* value = js_obj->FastPropertyAt(index); |
2193 js_obj, entry, | 2205 if (k->length() > 0) { |
Vyacheslav Egorov (Google)
2012/07/02 12:12:45
Consider comparing against Heap::hidden_symbol
yurys
2012/07/02 12:43:27
Done.
| |
2194 descs->GetKey(i), js_obj->FastPropertyAt(index)); | 2206 SetPropertyReference(js_obj, entry, k, value); |
2207 } else { | |
2208 OS::Print("Empty name for fast property 2\n"); | |
Vyacheslav Egorov (Google)
2012/07/02 12:12:45
remove OS::Print
yurys
2012/07/02 12:43:27
Done.
| |
2209 TagObject(value, "(hidden properties)"); | |
2210 SetInternalReference(js_obj, entry, "hidden_properties", value); | |
2211 } | |
2195 } | 2212 } |
2196 break; | 2213 break; |
2197 } | 2214 } |
2198 case CONSTANT_FUNCTION: | 2215 case CONSTANT_FUNCTION: |
2199 SetPropertyReference( | 2216 SetPropertyReference( |
2200 js_obj, entry, | 2217 js_obj, entry, |
2201 descs->GetKey(i), descs->GetConstantFunction(i)); | 2218 descs->GetKey(i), descs->GetConstantFunction(i)); |
2202 break; | 2219 break; |
2203 case CALLBACKS: { | 2220 case CALLBACKS: { |
2204 Object* callback_obj = descs->GetValue(i); | 2221 Object* callback_obj = descs->GetValue(i); |
(...skipping 25 matching lines...) Expand all Loading... | |
2230 StringDictionary* dictionary = js_obj->property_dictionary(); | 2247 StringDictionary* dictionary = js_obj->property_dictionary(); |
2231 int length = dictionary->Capacity(); | 2248 int length = dictionary->Capacity(); |
2232 for (int i = 0; i < length; ++i) { | 2249 for (int i = 0; i < length; ++i) { |
2233 Object* k = dictionary->KeyAt(i); | 2250 Object* k = dictionary->KeyAt(i); |
2234 if (dictionary->IsKey(k)) { | 2251 if (dictionary->IsKey(k)) { |
2235 Object* target = dictionary->ValueAt(i); | 2252 Object* target = dictionary->ValueAt(i); |
2236 // We assume that global objects can only have slow properties. | 2253 // We assume that global objects can only have slow properties. |
2237 Object* value = target->IsJSGlobalPropertyCell() | 2254 Object* value = target->IsJSGlobalPropertyCell() |
2238 ? JSGlobalPropertyCell::cast(target)->value() | 2255 ? JSGlobalPropertyCell::cast(target)->value() |
2239 : target; | 2256 : target; |
2240 if (String::cast(k)->length() > 0) { | 2257 if (String::cast(k)->length() > 0) { |
alexeif
2012/07/02 12:38:03
Please consider comparing against Heap::hidden_sym
yurys
2012/07/02 12:45:51
Done.
| |
2241 SetPropertyReference(js_obj, entry, String::cast(k), value); | 2258 SetPropertyReference(js_obj, entry, String::cast(k), value); |
2242 } else { | 2259 } else { |
2243 TagObject(value, "(hidden properties)"); | 2260 TagObject(value, "(hidden properties)"); |
2244 SetInternalReference(js_obj, entry, "hidden_properties", value); | 2261 SetInternalReference(js_obj, entry, "hidden_properties", value); |
2245 } | 2262 } |
2246 } | 2263 } |
2247 } | 2264 } |
2248 } | 2265 } |
2249 } | 2266 } |
2250 | 2267 |
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3563 | 3580 |
3564 | 3581 |
3565 void HeapSnapshotJSONSerializer::SortHashMap( | 3582 void HeapSnapshotJSONSerializer::SortHashMap( |
3566 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3583 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
3567 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3584 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
3568 sorted_entries->Add(p); | 3585 sorted_entries->Add(p); |
3569 sorted_entries->Sort(SortUsingEntryValue); | 3586 sorted_entries->Sort(SortUsingEntryValue); |
3570 } | 3587 } |
3571 | 3588 |
3572 } } // namespace v8::internal | 3589 } } // namespace v8::internal |
OLD | NEW |