OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/profiler/heap-snapshot-generator.h" | 5 #include "src/profiler/heap-snapshot-generator.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/objects-body-descriptors.h" | 10 #include "src/objects-body-descriptors.h" |
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 SetNativeBindReference(js_obj, entry, "bound_function", | 1101 SetNativeBindReference(js_obj, entry, "bound_function", |
1102 js_fun->bound_target_function()); | 1102 js_fun->bound_target_function()); |
1103 FixedArray* bindings = js_fun->bound_arguments(); | 1103 FixedArray* bindings = js_fun->bound_arguments(); |
1104 for (int i = 0; i < bindings->length(); i++) { | 1104 for (int i = 0; i < bindings->length(); i++) { |
1105 const char* reference_name = names_->GetFormatted("bound_argument_%d", i); | 1105 const char* reference_name = names_->GetFormatted("bound_argument_%d", i); |
1106 SetNativeBindReference(js_obj, entry, reference_name, bindings->get(i)); | 1106 SetNativeBindReference(js_obj, entry, reference_name, bindings->get(i)); |
1107 } | 1107 } |
1108 } else if (obj->IsJSFunction()) { | 1108 } else if (obj->IsJSFunction()) { |
1109 JSFunction* js_fun = JSFunction::cast(js_obj); | 1109 JSFunction* js_fun = JSFunction::cast(js_obj); |
1110 Object* proto_or_map = js_fun->prototype_or_initial_map(); | 1110 Object* proto_or_map = js_fun->prototype_or_initial_map(); |
1111 if (!proto_or_map->IsTheHole()) { | 1111 if (!proto_or_map->IsTheHole(heap_->isolate())) { |
1112 if (!proto_or_map->IsMap()) { | 1112 if (!proto_or_map->IsMap()) { |
1113 SetPropertyReference( | 1113 SetPropertyReference( |
1114 obj, entry, | 1114 obj, entry, |
1115 heap_->prototype_string(), proto_or_map, | 1115 heap_->prototype_string(), proto_or_map, |
1116 NULL, | 1116 NULL, |
1117 JSFunction::kPrototypeOrInitialMapOffset); | 1117 JSFunction::kPrototypeOrInitialMapOffset); |
1118 } else { | 1118 } else { |
1119 SetPropertyReference( | 1119 SetPropertyReference( |
1120 obj, entry, | 1120 obj, entry, |
1121 heap_->prototype_string(), js_fun->prototype()); | 1121 heap_->prototype_string(), js_fun->prototype()); |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 } | 1634 } |
1635 | 1635 |
1636 | 1636 |
1637 void V8HeapExplorer::ExtractElementReferences(JSObject* js_obj, int entry) { | 1637 void V8HeapExplorer::ExtractElementReferences(JSObject* js_obj, int entry) { |
1638 if (js_obj->HasFastObjectElements()) { | 1638 if (js_obj->HasFastObjectElements()) { |
1639 FixedArray* elements = FixedArray::cast(js_obj->elements()); | 1639 FixedArray* elements = FixedArray::cast(js_obj->elements()); |
1640 int length = js_obj->IsJSArray() ? | 1640 int length = js_obj->IsJSArray() ? |
1641 Smi::cast(JSArray::cast(js_obj)->length())->value() : | 1641 Smi::cast(JSArray::cast(js_obj)->length())->value() : |
1642 elements->length(); | 1642 elements->length(); |
1643 for (int i = 0; i < length; ++i) { | 1643 for (int i = 0; i < length; ++i) { |
1644 if (!elements->get(i)->IsTheHole()) { | 1644 if (!elements->get(i)->IsTheHole(heap_->isolate())) { |
1645 SetElementReference(js_obj, entry, i, elements->get(i)); | 1645 SetElementReference(js_obj, entry, i, elements->get(i)); |
1646 } | 1646 } |
1647 } | 1647 } |
1648 } else if (js_obj->HasDictionaryElements()) { | 1648 } else if (js_obj->HasDictionaryElements()) { |
1649 SeededNumberDictionary* dictionary = js_obj->element_dictionary(); | 1649 SeededNumberDictionary* dictionary = js_obj->element_dictionary(); |
1650 int length = dictionary->Capacity(); | 1650 int length = dictionary->Capacity(); |
1651 for (int i = 0; i < length; ++i) { | 1651 for (int i = 0; i < length; ++i) { |
1652 Object* k = dictionary->KeyAt(i); | 1652 Object* k = dictionary->KeyAt(i); |
1653 if (dictionary->IsKey(k)) { | 1653 if (dictionary->IsKey(heap_, k)) { |
1654 DCHECK(k->IsNumber()); | 1654 DCHECK(k->IsNumber()); |
1655 uint32_t index = static_cast<uint32_t>(k->Number()); | 1655 uint32_t index = static_cast<uint32_t>(k->Number()); |
1656 SetElementReference(js_obj, entry, index, dictionary->ValueAt(i)); | 1656 SetElementReference(js_obj, entry, index, dictionary->ValueAt(i)); |
1657 } | 1657 } |
1658 } | 1658 } |
1659 } | 1659 } |
1660 } | 1660 } |
1661 | 1661 |
1662 | 1662 |
1663 void V8HeapExplorer::ExtractInternalReferences(JSObject* js_obj, int entry) { | 1663 void V8HeapExplorer::ExtractInternalReferences(JSObject* js_obj, int entry) { |
(...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3114 for (int i = 1; i < sorted_strings.length(); ++i) { | 3114 for (int i = 1; i < sorted_strings.length(); ++i) { |
3115 writer_->AddCharacter(','); | 3115 writer_->AddCharacter(','); |
3116 SerializeString(sorted_strings[i]); | 3116 SerializeString(sorted_strings[i]); |
3117 if (writer_->aborted()) return; | 3117 if (writer_->aborted()) return; |
3118 } | 3118 } |
3119 } | 3119 } |
3120 | 3120 |
3121 | 3121 |
3122 } // namespace internal | 3122 } // namespace internal |
3123 } // namespace v8 | 3123 } // namespace v8 |
OLD | NEW |