| 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 != heap_->hidden_symbol()) { |
| 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 TagObject(value, "(hidden properties)"); |
| 2197 SetInternalReference( |
| 2198 js_obj, entry, |
| 2199 "hidden_properties", value, |
| 2200 js_obj->GetInObjectPropertyOffset(index)); |
| 2201 } |
| 2191 } else { | 2202 } else { |
| 2192 SetPropertyReference( | 2203 Object* value = js_obj->FastPropertyAt(index); |
| 2193 js_obj, entry, | 2204 if (k != heap_->hidden_symbol()) { |
| 2194 descs->GetKey(i), js_obj->FastPropertyAt(index)); | 2205 SetPropertyReference(js_obj, entry, k, value); |
| 2206 } else { |
| 2207 TagObject(value, "(hidden properties)"); |
| 2208 SetInternalReference(js_obj, entry, "hidden_properties", value); |
| 2209 } |
| 2195 } | 2210 } |
| 2196 break; | 2211 break; |
| 2197 } | 2212 } |
| 2198 case CONSTANT_FUNCTION: | 2213 case CONSTANT_FUNCTION: |
| 2199 SetPropertyReference( | 2214 SetPropertyReference( |
| 2200 js_obj, entry, | 2215 js_obj, entry, |
| 2201 descs->GetKey(i), descs->GetConstantFunction(i)); | 2216 descs->GetKey(i), descs->GetConstantFunction(i)); |
| 2202 break; | 2217 break; |
| 2203 case CALLBACKS: { | 2218 case CALLBACKS: { |
| 2204 Object* callback_obj = descs->GetValue(i); | 2219 Object* callback_obj = descs->GetValue(i); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2230 StringDictionary* dictionary = js_obj->property_dictionary(); | 2245 StringDictionary* dictionary = js_obj->property_dictionary(); |
| 2231 int length = dictionary->Capacity(); | 2246 int length = dictionary->Capacity(); |
| 2232 for (int i = 0; i < length; ++i) { | 2247 for (int i = 0; i < length; ++i) { |
| 2233 Object* k = dictionary->KeyAt(i); | 2248 Object* k = dictionary->KeyAt(i); |
| 2234 if (dictionary->IsKey(k)) { | 2249 if (dictionary->IsKey(k)) { |
| 2235 Object* target = dictionary->ValueAt(i); | 2250 Object* target = dictionary->ValueAt(i); |
| 2236 // We assume that global objects can only have slow properties. | 2251 // We assume that global objects can only have slow properties. |
| 2237 Object* value = target->IsJSGlobalPropertyCell() | 2252 Object* value = target->IsJSGlobalPropertyCell() |
| 2238 ? JSGlobalPropertyCell::cast(target)->value() | 2253 ? JSGlobalPropertyCell::cast(target)->value() |
| 2239 : target; | 2254 : target; |
| 2240 if (String::cast(k)->length() > 0) { | 2255 if (k != heap_->hidden_symbol()) { |
| 2241 SetPropertyReference(js_obj, entry, String::cast(k), value); | 2256 SetPropertyReference(js_obj, entry, String::cast(k), value); |
| 2242 } else { | 2257 } else { |
| 2243 TagObject(value, "(hidden properties)"); | 2258 TagObject(value, "(hidden properties)"); |
| 2244 SetInternalReference(js_obj, entry, "hidden_properties", value); | 2259 SetInternalReference(js_obj, entry, "hidden_properties", value); |
| 2245 } | 2260 } |
| 2246 } | 2261 } |
| 2247 } | 2262 } |
| 2248 } | 2263 } |
| 2249 } | 2264 } |
| 2250 | 2265 |
| (...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3563 | 3578 |
| 3564 | 3579 |
| 3565 void HeapSnapshotJSONSerializer::SortHashMap( | 3580 void HeapSnapshotJSONSerializer::SortHashMap( |
| 3566 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3581 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
| 3567 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3582 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
| 3568 sorted_entries->Add(p); | 3583 sorted_entries->Add(p); |
| 3569 sorted_entries->Sort(SortUsingEntryValue); | 3584 sorted_entries->Sort(SortUsingEntryValue); |
| 3570 } | 3585 } |
| 3571 | 3586 |
| 3572 } } // namespace v8::internal | 3587 } } // namespace v8::internal |
| OLD | NEW |