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/profiler/allocation-tracker.h" | 10 #include "src/profiler/allocation-tracker.h" |
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1732 int length = js_obj->GetInternalFieldCount(); | 1732 int length = js_obj->GetInternalFieldCount(); |
1733 for (int i = 0; i < length; ++i) { | 1733 for (int i = 0; i < length; ++i) { |
1734 Object* o = js_obj->GetInternalField(i); | 1734 Object* o = js_obj->GetInternalField(i); |
1735 SetInternalReference( | 1735 SetInternalReference( |
1736 js_obj, entry, i, o, js_obj->GetInternalFieldOffset(i)); | 1736 js_obj, entry, i, o, js_obj->GetInternalFieldOffset(i)); |
1737 } | 1737 } |
1738 } | 1738 } |
1739 | 1739 |
1740 | 1740 |
1741 String* V8HeapExplorer::GetConstructorName(JSObject* object) { | 1741 String* V8HeapExplorer::GetConstructorName(JSObject* object) { |
1742 Heap* heap = object->GetHeap(); | 1742 Isolate* isolate = object->GetIsolate(); |
1743 if (object->IsJSFunction()) return heap->closure_string(); | 1743 if (object->IsJSFunction()) return isolate->heap()->closure_string(); |
1744 String* constructor_name = object->constructor_name(); | 1744 DisallowHeapAllocation no_gc; |
1745 if (constructor_name == heap->Object_string()) { | 1745 HandleScope scope(isolate); |
1746 // TODO(verwaest): Try to get object.constructor.name in this case. | 1746 return *JSReceiver::GetConstructorName(handle(object, isolate)); |
1747 // This requires handlification of the V8HeapExplorer. | |
1748 } | |
1749 return object->constructor_name(); | |
1750 } | 1747 } |
1751 | 1748 |
1752 | 1749 |
1753 HeapEntry* V8HeapExplorer::GetEntry(Object* obj) { | 1750 HeapEntry* V8HeapExplorer::GetEntry(Object* obj) { |
1754 if (!obj->IsHeapObject()) return NULL; | 1751 if (!obj->IsHeapObject()) return NULL; |
1755 return filler_->FindOrAddEntry(obj, this); | 1752 return filler_->FindOrAddEntry(obj, this); |
1756 } | 1753 } |
1757 | 1754 |
1758 | 1755 |
1759 class RootsReferencesExtractor : public ObjectVisitor { | 1756 class RootsReferencesExtractor : public ObjectVisitor { |
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3170 for (int i = 1; i < sorted_strings.length(); ++i) { | 3167 for (int i = 1; i < sorted_strings.length(); ++i) { |
3171 writer_->AddCharacter(','); | 3168 writer_->AddCharacter(','); |
3172 SerializeString(sorted_strings[i]); | 3169 SerializeString(sorted_strings[i]); |
3173 if (writer_->aborted()) return; | 3170 if (writer_->aborted()) return; |
3174 } | 3171 } |
3175 } | 3172 } |
3176 | 3173 |
3177 | 3174 |
3178 } // namespace internal | 3175 } // namespace internal |
3179 } // namespace v8 | 3176 } // namespace v8 |
OLD | NEW |