| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 | 1007 |
| 1008 if (obj->IsJSGlobalProxy()) { | 1008 if (obj->IsJSGlobalProxy()) { |
| 1009 ExtractJSGlobalProxyReferences(entry, JSGlobalProxy::cast(obj)); | 1009 ExtractJSGlobalProxyReferences(entry, JSGlobalProxy::cast(obj)); |
| 1010 } else if (obj->IsJSArrayBuffer()) { | 1010 } else if (obj->IsJSArrayBuffer()) { |
| 1011 ExtractJSArrayBufferReferences(entry, JSArrayBuffer::cast(obj)); | 1011 ExtractJSArrayBufferReferences(entry, JSArrayBuffer::cast(obj)); |
| 1012 } else if (obj->IsJSObject()) { | 1012 } else if (obj->IsJSObject()) { |
| 1013 if (obj->IsJSWeakSet()) { | 1013 if (obj->IsJSWeakSet()) { |
| 1014 ExtractJSWeakCollectionReferences(entry, JSWeakSet::cast(obj)); | 1014 ExtractJSWeakCollectionReferences(entry, JSWeakSet::cast(obj)); |
| 1015 } else if (obj->IsJSWeakMap()) { | 1015 } else if (obj->IsJSWeakMap()) { |
| 1016 ExtractJSWeakCollectionReferences(entry, JSWeakMap::cast(obj)); | 1016 ExtractJSWeakCollectionReferences(entry, JSWeakMap::cast(obj)); |
| 1017 } else if (obj->IsJSWeakRef()) { |
| 1018 ExtractJSWeakRefReferences(entry, JSWeakRef::cast(obj)); |
| 1017 } else if (obj->IsJSSet()) { | 1019 } else if (obj->IsJSSet()) { |
| 1018 ExtractJSCollectionReferences(entry, JSSet::cast(obj)); | 1020 ExtractJSCollectionReferences(entry, JSSet::cast(obj)); |
| 1019 } else if (obj->IsJSMap()) { | 1021 } else if (obj->IsJSMap()) { |
| 1020 ExtractJSCollectionReferences(entry, JSMap::cast(obj)); | 1022 ExtractJSCollectionReferences(entry, JSMap::cast(obj)); |
| 1021 } | 1023 } |
| 1022 ExtractJSObjectReferences(entry, JSObject::cast(obj)); | 1024 ExtractJSObjectReferences(entry, JSObject::cast(obj)); |
| 1023 } else if (obj->IsString()) { | 1025 } else if (obj->IsString()) { |
| 1024 ExtractStringReferences(entry, String::cast(obj)); | 1026 ExtractStringReferences(entry, String::cast(obj)); |
| 1025 } else if (obj->IsSymbol()) { | 1027 } else if (obj->IsSymbol()) { |
| 1026 ExtractSymbolReferences(entry, Symbol::cast(obj)); | 1028 ExtractSymbolReferences(entry, Symbol::cast(obj)); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 | 1194 |
| 1193 void V8HeapExplorer::ExtractJSWeakCollectionReferences(int entry, | 1195 void V8HeapExplorer::ExtractJSWeakCollectionReferences(int entry, |
| 1194 JSWeakCollection* obj) { | 1196 JSWeakCollection* obj) { |
| 1195 if (obj->table()->IsHashTable()) { | 1197 if (obj->table()->IsHashTable()) { |
| 1196 ObjectHashTable* table = ObjectHashTable::cast(obj->table()); | 1198 ObjectHashTable* table = ObjectHashTable::cast(obj->table()); |
| 1197 TagFixedArraySubType(table, JS_WEAK_COLLECTION_SUB_TYPE); | 1199 TagFixedArraySubType(table, JS_WEAK_COLLECTION_SUB_TYPE); |
| 1198 } | 1200 } |
| 1199 SetInternalReference(obj, entry, "table", obj->table(), | 1201 SetInternalReference(obj, entry, "table", obj->table(), |
| 1200 JSWeakCollection::kTableOffset); | 1202 JSWeakCollection::kTableOffset); |
| 1201 } | 1203 } |
| 1204 void V8HeapExplorer::ExtractJSWeakRefReferences(int entry, |
| 1205 JSWeakRef* ref) { |
| 1206 SetInternalReference(ref, entry, "executor", ref->executor(), |
| 1207 JSWeakRef::kExecutorOffset); |
| 1208 SetInternalReference(ref, entry, "target", ref->target(), |
| 1209 JSWeakRef::kTargetOffset); |
| 1210 SetInternalReference(ref, entry, "holdings", ref->holdings(), |
| 1211 JSWeakRef::kHoldingsOffset); |
| 1212 } |
| 1202 | 1213 |
| 1203 void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) { | 1214 void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) { |
| 1204 if (context == context->declaration_context()) { | 1215 if (context == context->declaration_context()) { |
| 1205 ScopeInfo* scope_info = context->closure()->shared()->scope_info(); | 1216 ScopeInfo* scope_info = context->closure()->shared()->scope_info(); |
| 1206 // Add context allocated locals. | 1217 // Add context allocated locals. |
| 1207 int context_locals = scope_info->ContextLocalCount(); | 1218 int context_locals = scope_info->ContextLocalCount(); |
| 1208 for (int i = 0; i < context_locals; ++i) { | 1219 for (int i = 0; i < context_locals; ++i) { |
| 1209 String* local_name = scope_info->ContextLocalName(i); | 1220 String* local_name = scope_info->ContextLocalName(i); |
| 1210 int idx = Context::MIN_CONTEXT_SLOTS + i; | 1221 int idx = Context::MIN_CONTEXT_SLOTS + i; |
| 1211 SetContextReference(context, entry, local_name, context->get(idx), | 1222 SetContextReference(context, entry, local_name, context->get(idx), |
| (...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3136 for (int i = 1; i < sorted_strings.length(); ++i) { | 3147 for (int i = 1; i < sorted_strings.length(); ++i) { |
| 3137 writer_->AddCharacter(','); | 3148 writer_->AddCharacter(','); |
| 3138 SerializeString(sorted_strings[i]); | 3149 SerializeString(sorted_strings[i]); |
| 3139 if (writer_->aborted()) return; | 3150 if (writer_->aborted()) return; |
| 3140 } | 3151 } |
| 3141 } | 3152 } |
| 3142 | 3153 |
| 3143 | 3154 |
| 3144 } // namespace internal | 3155 } // namespace internal |
| 3145 } // namespace v8 | 3156 } // namespace v8 |
| OLD | NEW |