| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/heap-snapshot-generator-inl.h" | 7 #include "src/heap-snapshot-generator-inl.h" |
| 8 | 8 |
| 9 #include "src/allocation-tracker.h" | 9 #include "src/allocation-tracker.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/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)); | |
| 1104 } else if (obj->IsJSObject()) { | 1100 } else if (obj->IsJSObject()) { |
| 1101 if (obj->IsJSWeakSet()) { |
| 1102 ExtractJSWeakCollectionReferences(entry, JSWeakSet::cast(obj)); |
| 1103 } else if (obj->IsJSWeakMap()) { |
| 1104 ExtractJSWeakCollectionReferences(entry, JSWeakMap::cast(obj)); |
| 1105 } else if (obj->IsJSSet()) { |
| 1106 ExtractJSCollectionReferences(entry, JSSet::cast(obj)); |
| 1107 } else if (obj->IsJSMap()) { |
| 1108 ExtractJSCollectionReferences(entry, JSMap::cast(obj)); |
| 1109 } |
| 1105 ExtractJSObjectReferences(entry, JSObject::cast(obj)); | 1110 ExtractJSObjectReferences(entry, JSObject::cast(obj)); |
| 1106 } else if (obj->IsString()) { | 1111 } else if (obj->IsString()) { |
| 1107 ExtractStringReferences(entry, String::cast(obj)); | 1112 ExtractStringReferences(entry, String::cast(obj)); |
| 1108 } else if (obj->IsSymbol()) { | 1113 } else if (obj->IsSymbol()) { |
| 1109 ExtractSymbolReferences(entry, Symbol::cast(obj)); | 1114 ExtractSymbolReferences(entry, Symbol::cast(obj)); |
| 1110 } else if (obj->IsMap()) { | 1115 } else if (obj->IsMap()) { |
| 1111 ExtractMapReferences(entry, Map::cast(obj)); | 1116 ExtractMapReferences(entry, Map::cast(obj)); |
| 1112 } else if (obj->IsSharedFunctionInfo()) { | 1117 } else if (obj->IsSharedFunctionInfo()) { |
| 1113 ExtractSharedFunctionInfoReferences(entry, SharedFunctionInfo::cast(obj)); | 1118 ExtractSharedFunctionInfoReferences(entry, SharedFunctionInfo::cast(obj)); |
| 1114 } else if (obj->IsScript()) { | 1119 } else if (obj->IsScript()) { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 } | 1258 } |
| 1254 | 1259 |
| 1255 | 1260 |
| 1256 void V8HeapExplorer::ExtractSymbolReferences(int entry, Symbol* symbol) { | 1261 void V8HeapExplorer::ExtractSymbolReferences(int entry, Symbol* symbol) { |
| 1257 SetInternalReference(symbol, entry, | 1262 SetInternalReference(symbol, entry, |
| 1258 "name", symbol->name(), | 1263 "name", symbol->name(), |
| 1259 Symbol::kNameOffset); | 1264 Symbol::kNameOffset); |
| 1260 } | 1265 } |
| 1261 | 1266 |
| 1262 | 1267 |
| 1268 void V8HeapExplorer::ExtractJSCollectionReferences(int entry, |
| 1269 JSCollection* collection) { |
| 1270 SetInternalReference(collection, entry, "table", collection->table(), |
| 1271 JSCollection::kTableOffset); |
| 1272 } |
| 1273 |
| 1274 |
| 1263 void V8HeapExplorer::ExtractJSWeakCollectionReferences( | 1275 void V8HeapExplorer::ExtractJSWeakCollectionReferences( |
| 1264 int entry, JSWeakCollection* collection) { | 1276 int entry, JSWeakCollection* collection) { |
| 1265 MarkAsWeakContainer(collection->table()); | 1277 MarkAsWeakContainer(collection->table()); |
| 1266 SetInternalReference(collection, entry, | 1278 SetInternalReference(collection, entry, |
| 1267 "table", collection->table(), | 1279 "table", collection->table(), |
| 1268 JSWeakCollection::kTableOffset); | 1280 JSWeakCollection::kTableOffset); |
| 1269 } | 1281 } |
| 1270 | 1282 |
| 1271 | 1283 |
| 1272 void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) { | 1284 void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) { |
| (...skipping 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3172 writer_->AddString("\"<dummy>\""); | 3184 writer_->AddString("\"<dummy>\""); |
| 3173 for (int i = 1; i < sorted_strings.length(); ++i) { | 3185 for (int i = 1; i < sorted_strings.length(); ++i) { |
| 3174 writer_->AddCharacter(','); | 3186 writer_->AddCharacter(','); |
| 3175 SerializeString(sorted_strings[i]); | 3187 SerializeString(sorted_strings[i]); |
| 3176 if (writer_->aborted()) return; | 3188 if (writer_->aborted()) return; |
| 3177 } | 3189 } |
| 3178 } | 3190 } |
| 3179 | 3191 |
| 3180 | 3192 |
| 3181 } } // namespace v8::internal | 3193 } } // namespace v8::internal |
| OLD | NEW |