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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "heap-snapshot-generator-inl.h" | 7 #include "heap-snapshot-generator-inl.h" |
8 | 8 |
9 #include "allocation-tracker.h" | 9 #include "allocation-tracker.h" |
10 #include "code-stubs.h" | 10 #include "code-stubs.h" |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 }; | 1090 }; |
1091 | 1091 |
1092 | 1092 |
1093 bool V8HeapExplorer::ExtractReferencesPass1(int entry, HeapObject* obj) { | 1093 bool V8HeapExplorer::ExtractReferencesPass1(int entry, HeapObject* obj) { |
1094 if (obj->IsFixedArray()) return false; // FixedArrays are processed on pass 2 | 1094 if (obj->IsFixedArray()) return false; // FixedArrays are processed on pass 2 |
1095 | 1095 |
1096 if (obj->IsJSGlobalProxy()) { | 1096 if (obj->IsJSGlobalProxy()) { |
1097 ExtractJSGlobalProxyReferences(entry, JSGlobalProxy::cast(obj)); | 1097 ExtractJSGlobalProxyReferences(entry, JSGlobalProxy::cast(obj)); |
1098 } else if (obj->IsJSArrayBuffer()) { | 1098 } else if (obj->IsJSArrayBuffer()) { |
1099 ExtractJSArrayBufferReferences(entry, JSArrayBuffer::cast(obj)); | 1099 ExtractJSArrayBufferReferences(entry, JSArrayBuffer::cast(obj)); |
| 1100 } else if (obj->IsJSWeakSet()) { |
| 1101 ExtractJSWeakCollectionReferences(entry, JSWeakSet::cast(obj)); |
| 1102 } else if (obj->IsJSWeakMap()) { |
| 1103 ExtractJSWeakCollectionReferences(entry, JSWeakMap::cast(obj)); |
1100 } else if (obj->IsJSObject()) { | 1104 } else if (obj->IsJSObject()) { |
1101 ExtractJSObjectReferences(entry, JSObject::cast(obj)); | 1105 ExtractJSObjectReferences(entry, JSObject::cast(obj)); |
1102 } else if (obj->IsString()) { | 1106 } else if (obj->IsString()) { |
1103 ExtractStringReferences(entry, String::cast(obj)); | 1107 ExtractStringReferences(entry, String::cast(obj)); |
1104 } else if (obj->IsSymbol()) { | 1108 } else if (obj->IsSymbol()) { |
1105 ExtractSymbolReferences(entry, Symbol::cast(obj)); | 1109 ExtractSymbolReferences(entry, Symbol::cast(obj)); |
1106 } else if (obj->IsMap()) { | 1110 } else if (obj->IsMap()) { |
1107 ExtractMapReferences(entry, Map::cast(obj)); | 1111 ExtractMapReferences(entry, Map::cast(obj)); |
1108 } else if (obj->IsSharedFunctionInfo()) { | 1112 } else if (obj->IsSharedFunctionInfo()) { |
1109 ExtractSharedFunctionInfoReferences(entry, SharedFunctionInfo::cast(obj)); | 1113 ExtractSharedFunctionInfoReferences(entry, SharedFunctionInfo::cast(obj)); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 } | 1253 } |
1250 | 1254 |
1251 | 1255 |
1252 void V8HeapExplorer::ExtractSymbolReferences(int entry, Symbol* symbol) { | 1256 void V8HeapExplorer::ExtractSymbolReferences(int entry, Symbol* symbol) { |
1253 SetInternalReference(symbol, entry, | 1257 SetInternalReference(symbol, entry, |
1254 "name", symbol->name(), | 1258 "name", symbol->name(), |
1255 Symbol::kNameOffset); | 1259 Symbol::kNameOffset); |
1256 } | 1260 } |
1257 | 1261 |
1258 | 1262 |
| 1263 void V8HeapExplorer::ExtractJSWeakCollectionReferences( |
| 1264 int entry, JSWeakCollection* collection) { |
| 1265 MarkAsWeakContainer(collection->table()); |
| 1266 SetInternalReference(collection, entry, |
| 1267 "table", collection->table(), |
| 1268 JSWeakCollection::kTableOffset); |
| 1269 } |
| 1270 |
| 1271 |
1259 void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) { | 1272 void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) { |
1260 if (context == context->declaration_context()) { | 1273 if (context == context->declaration_context()) { |
1261 ScopeInfo* scope_info = context->closure()->shared()->scope_info(); | 1274 ScopeInfo* scope_info = context->closure()->shared()->scope_info(); |
1262 // Add context allocated locals. | 1275 // Add context allocated locals. |
1263 int context_locals = scope_info->ContextLocalCount(); | 1276 int context_locals = scope_info->ContextLocalCount(); |
1264 for (int i = 0; i < context_locals; ++i) { | 1277 for (int i = 0; i < context_locals; ++i) { |
1265 String* local_name = scope_info->ContextLocalName(i); | 1278 String* local_name = scope_info->ContextLocalName(i); |
1266 int idx = Context::MIN_CONTEXT_SLOTS + i; | 1279 int idx = Context::MIN_CONTEXT_SLOTS + i; |
1267 SetContextReference(context, entry, local_name, context->get(idx), | 1280 SetContextReference(context, entry, local_name, context->get(idx), |
1268 Context::OffsetOfElementAt(idx)); | 1281 Context::OffsetOfElementAt(idx)); |
(...skipping 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3157 writer_->AddString("\"<dummy>\""); | 3170 writer_->AddString("\"<dummy>\""); |
3158 for (int i = 1; i < sorted_strings.length(); ++i) { | 3171 for (int i = 1; i < sorted_strings.length(); ++i) { |
3159 writer_->AddCharacter(','); | 3172 writer_->AddCharacter(','); |
3160 SerializeString(sorted_strings[i]); | 3173 SerializeString(sorted_strings[i]); |
3161 if (writer_->aborted()) return; | 3174 if (writer_->aborted()) return; |
3162 } | 3175 } |
3163 } | 3176 } |
3164 | 3177 |
3165 | 3178 |
3166 } } // namespace v8::internal | 3179 } } // namespace v8::internal |
OLD | NEW |