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 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1717 int length = js_obj->GetInternalFieldCount(); | 1717 int length = js_obj->GetInternalFieldCount(); |
1718 for (int i = 0; i < length; ++i) { | 1718 for (int i = 0; i < length; ++i) { |
1719 Object* o = js_obj->GetInternalField(i); | 1719 Object* o = js_obj->GetInternalField(i); |
1720 SetInternalReference( | 1720 SetInternalReference( |
1721 js_obj, entry, i, o, js_obj->GetInternalFieldOffset(i)); | 1721 js_obj, entry, i, o, js_obj->GetInternalFieldOffset(i)); |
1722 } | 1722 } |
1723 } | 1723 } |
1724 | 1724 |
1725 | 1725 |
1726 String* V8HeapExplorer::GetConstructorName(JSObject* object) { | 1726 String* V8HeapExplorer::GetConstructorName(JSObject* object) { |
1727 Heap* heap = object->GetHeap(); | 1727 Isolate* isolate = object->GetIsolate(); |
1728 if (object->IsJSFunction()) return heap->closure_string(); | 1728 if (object->IsJSFunction()) return isolate->heap()->closure_string(); |
1729 String* constructor_name = object->constructor_name(); | 1729 DisallowHeapAllocation no_gc; |
1730 if (constructor_name == heap->Object_string()) { | 1730 HandleScope scope(isolate); |
1731 // TODO(verwaest): Try to get object.constructor.name in this case. | 1731 return *JSReceiver::GetConstructorName(handle(object, isolate)); |
1732 // This requires handlification of the V8HeapExplorer. | |
1733 } | |
1734 return object->constructor_name(); | |
1735 } | 1732 } |
1736 | 1733 |
1737 | 1734 |
1738 HeapEntry* V8HeapExplorer::GetEntry(Object* obj) { | 1735 HeapEntry* V8HeapExplorer::GetEntry(Object* obj) { |
1739 if (!obj->IsHeapObject()) return NULL; | 1736 if (!obj->IsHeapObject()) return NULL; |
1740 return filler_->FindOrAddEntry(obj, this); | 1737 return filler_->FindOrAddEntry(obj, this); |
1741 } | 1738 } |
1742 | 1739 |
1743 | 1740 |
1744 class RootsReferencesExtractor : public ObjectVisitor { | 1741 class RootsReferencesExtractor : public ObjectVisitor { |
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3171 for (int i = 1; i < sorted_strings.length(); ++i) { | 3168 for (int i = 1; i < sorted_strings.length(); ++i) { |
3172 writer_->AddCharacter(','); | 3169 writer_->AddCharacter(','); |
3173 SerializeString(sorted_strings[i]); | 3170 SerializeString(sorted_strings[i]); |
3174 if (writer_->aborted()) return; | 3171 if (writer_->aborted()) return; |
3175 } | 3172 } |
3176 } | 3173 } |
3177 | 3174 |
3178 | 3175 |
3179 } // namespace internal | 3176 } // namespace internal |
3180 } // namespace v8 | 3177 } // namespace v8 |
OLD | NEW |