| 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 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 } else if (obj->IsString()) { | 1111 } else if (obj->IsString()) { |
| 1112 ExtractStringReferences(entry, String::cast(obj)); | 1112 ExtractStringReferences(entry, String::cast(obj)); |
| 1113 } else if (obj->IsSymbol()) { | 1113 } else if (obj->IsSymbol()) { |
| 1114 ExtractSymbolReferences(entry, Symbol::cast(obj)); | 1114 ExtractSymbolReferences(entry, Symbol::cast(obj)); |
| 1115 } else if (obj->IsMap()) { | 1115 } else if (obj->IsMap()) { |
| 1116 ExtractMapReferences(entry, Map::cast(obj)); | 1116 ExtractMapReferences(entry, Map::cast(obj)); |
| 1117 } else if (obj->IsSharedFunctionInfo()) { | 1117 } else if (obj->IsSharedFunctionInfo()) { |
| 1118 ExtractSharedFunctionInfoReferences(entry, SharedFunctionInfo::cast(obj)); | 1118 ExtractSharedFunctionInfoReferences(entry, SharedFunctionInfo::cast(obj)); |
| 1119 } else if (obj->IsScript()) { | 1119 } else if (obj->IsScript()) { |
| 1120 ExtractScriptReferences(entry, Script::cast(obj)); | 1120 ExtractScriptReferences(entry, Script::cast(obj)); |
| 1121 } else if (obj->IsAccessorInfo()) { |
| 1122 ExtractAccessorInfoReferences(entry, AccessorInfo::cast(obj)); |
| 1121 } else if (obj->IsAccessorPair()) { | 1123 } else if (obj->IsAccessorPair()) { |
| 1122 ExtractAccessorPairReferences(entry, AccessorPair::cast(obj)); | 1124 ExtractAccessorPairReferences(entry, AccessorPair::cast(obj)); |
| 1123 } else if (obj->IsCodeCache()) { | 1125 } else if (obj->IsCodeCache()) { |
| 1124 ExtractCodeCacheReferences(entry, CodeCache::cast(obj)); | 1126 ExtractCodeCacheReferences(entry, CodeCache::cast(obj)); |
| 1125 } else if (obj->IsCode()) { | 1127 } else if (obj->IsCode()) { |
| 1126 ExtractCodeReferences(entry, Code::cast(obj)); | 1128 ExtractCodeReferences(entry, Code::cast(obj)); |
| 1127 } else if (obj->IsBox()) { | 1129 } else if (obj->IsBox()) { |
| 1128 ExtractBoxReferences(entry, Box::cast(obj)); | 1130 ExtractBoxReferences(entry, Box::cast(obj)); |
| 1129 } else if (obj->IsCell()) { | 1131 } else if (obj->IsCell()) { |
| 1130 ExtractCellReferences(entry, Cell::cast(obj)); | 1132 ExtractCellReferences(entry, Cell::cast(obj)); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1462 SetInternalReference(obj, entry, | 1464 SetInternalReference(obj, entry, |
| 1463 "context_data", script->context_data(), | 1465 "context_data", script->context_data(), |
| 1464 Script::kContextOffset); | 1466 Script::kContextOffset); |
| 1465 TagObject(script->line_ends(), "(script line ends)"); | 1467 TagObject(script->line_ends(), "(script line ends)"); |
| 1466 SetInternalReference(obj, entry, | 1468 SetInternalReference(obj, entry, |
| 1467 "line_ends", script->line_ends(), | 1469 "line_ends", script->line_ends(), |
| 1468 Script::kLineEndsOffset); | 1470 Script::kLineEndsOffset); |
| 1469 } | 1471 } |
| 1470 | 1472 |
| 1471 | 1473 |
| 1474 void V8HeapExplorer::ExtractAccessorInfoReferences( |
| 1475 int entry, AccessorInfo* accessor_info) { |
| 1476 SetInternalReference(accessor_info, entry, "name", accessor_info->name(), |
| 1477 AccessorInfo::kNameOffset); |
| 1478 SetInternalReference(accessor_info, entry, "expected_receiver_type", |
| 1479 accessor_info->expected_receiver_type(), |
| 1480 AccessorInfo::kExpectedReceiverTypeOffset); |
| 1481 if (accessor_info->IsDeclaredAccessorInfo()) { |
| 1482 DeclaredAccessorInfo* declared_accessor_info = |
| 1483 DeclaredAccessorInfo::cast(accessor_info); |
| 1484 SetInternalReference(declared_accessor_info, entry, "descriptor", |
| 1485 declared_accessor_info->descriptor(), |
| 1486 DeclaredAccessorInfo::kDescriptorOffset); |
| 1487 } else if (accessor_info->IsExecutableAccessorInfo()) { |
| 1488 ExecutableAccessorInfo* executable_accessor_info = |
| 1489 ExecutableAccessorInfo::cast(accessor_info); |
| 1490 SetInternalReference(executable_accessor_info, entry, "getter", |
| 1491 executable_accessor_info->getter(), |
| 1492 ExecutableAccessorInfo::kGetterOffset); |
| 1493 SetInternalReference(executable_accessor_info, entry, "setter", |
| 1494 executable_accessor_info->setter(), |
| 1495 ExecutableAccessorInfo::kSetterOffset); |
| 1496 SetInternalReference(executable_accessor_info, entry, "data", |
| 1497 executable_accessor_info->data(), |
| 1498 ExecutableAccessorInfo::kDataOffset); |
| 1499 } |
| 1500 } |
| 1501 |
| 1502 |
| 1472 void V8HeapExplorer::ExtractAccessorPairReferences( | 1503 void V8HeapExplorer::ExtractAccessorPairReferences( |
| 1473 int entry, AccessorPair* accessors) { | 1504 int entry, AccessorPair* accessors) { |
| 1474 SetInternalReference(accessors, entry, "getter", accessors->getter(), | 1505 SetInternalReference(accessors, entry, "getter", accessors->getter(), |
| 1475 AccessorPair::kGetterOffset); | 1506 AccessorPair::kGetterOffset); |
| 1476 SetInternalReference(accessors, entry, "setter", accessors->setter(), | 1507 SetInternalReference(accessors, entry, "setter", accessors->setter(), |
| 1477 AccessorPair::kSetterOffset); | 1508 AccessorPair::kSetterOffset); |
| 1478 } | 1509 } |
| 1479 | 1510 |
| 1480 | 1511 |
| 1481 void V8HeapExplorer::ExtractCodeCacheReferences( | 1512 void V8HeapExplorer::ExtractCodeCacheReferences( |
| (...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3154 writer_->AddString("\"<dummy>\""); | 3185 writer_->AddString("\"<dummy>\""); |
| 3155 for (int i = 1; i < sorted_strings.length(); ++i) { | 3186 for (int i = 1; i < sorted_strings.length(); ++i) { |
| 3156 writer_->AddCharacter(','); | 3187 writer_->AddCharacter(','); |
| 3157 SerializeString(sorted_strings[i]); | 3188 SerializeString(sorted_strings[i]); |
| 3158 if (writer_->aborted()) return; | 3189 if (writer_->aborted()) return; |
| 3159 } | 3190 } |
| 3160 } | 3191 } |
| 3161 | 3192 |
| 3162 | 3193 |
| 3163 } } // namespace v8::internal | 3194 } } // namespace v8::internal |
| OLD | NEW |