| 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 2282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2293 Heap* heap = object->GetHeap(); | 2293 Heap* heap = object->GetHeap(); |
| 2294 if (object->IsJSFunction()) return heap->closure_symbol(); | 2294 if (object->IsJSFunction()) return heap->closure_symbol(); |
| 2295 String* constructor_name = object->constructor_name(); | 2295 String* constructor_name = object->constructor_name(); |
| 2296 if (constructor_name == heap->Object_symbol()) { | 2296 if (constructor_name == heap->Object_symbol()) { |
| 2297 // Look up an immediate "constructor" property, if it is a function, | 2297 // Look up an immediate "constructor" property, if it is a function, |
| 2298 // return its name. This is for instances of binding objects, which | 2298 // return its name. This is for instances of binding objects, which |
| 2299 // have prototype constructor type "Object". | 2299 // have prototype constructor type "Object". |
| 2300 Object* constructor_prop = NULL; | 2300 Object* constructor_prop = NULL; |
| 2301 LookupResult result(heap->isolate()); | 2301 LookupResult result(heap->isolate()); |
| 2302 object->LocalLookupRealNamedProperty(heap->constructor_symbol(), &result); | 2302 object->LocalLookupRealNamedProperty(heap->constructor_symbol(), &result); |
| 2303 if (result.IsProperty()) { | 2303 if (!result.IsFound()) return object->constructor_name(); |
| 2304 constructor_prop = result.GetLazyValue(); | 2304 |
| 2305 } | 2305 constructor_prop = result.GetLazyValue(); |
| 2306 if (constructor_prop->IsJSFunction()) { | 2306 if (constructor_prop->IsJSFunction()) { |
| 2307 Object* maybe_name = JSFunction::cast(constructor_prop)->shared()->name(); | 2307 Object* maybe_name = |
| 2308 JSFunction::cast(constructor_prop)->shared()->name(); |
| 2308 if (maybe_name->IsString()) { | 2309 if (maybe_name->IsString()) { |
| 2309 String* name = String::cast(maybe_name); | 2310 String* name = String::cast(maybe_name); |
| 2310 if (name->length() > 0) return name; | 2311 if (name->length() > 0) return name; |
| 2311 } | 2312 } |
| 2312 } | 2313 } |
| 2313 } | 2314 } |
| 2314 return object->constructor_name(); | 2315 return object->constructor_name(); |
| 2315 } | 2316 } |
| 2316 | 2317 |
| 2317 | 2318 |
| (...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3567 | 3568 |
| 3568 | 3569 |
| 3569 void HeapSnapshotJSONSerializer::SortHashMap( | 3570 void HeapSnapshotJSONSerializer::SortHashMap( |
| 3570 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3571 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
| 3571 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3572 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
| 3572 sorted_entries->Add(p); | 3573 sorted_entries->Add(p); |
| 3573 sorted_entries->Sort(SortUsingEntryValue); | 3574 sorted_entries->Sort(SortUsingEntryValue); |
| 3574 } | 3575 } |
| 3575 | 3576 |
| 3576 } } // namespace v8::internal | 3577 } } // namespace v8::internal |
| OLD | NEW |