OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/disasm.h" | 7 #include "src/disasm.h" |
8 #include "src/disassembler.h" | 8 #include "src/disassembler.h" |
9 #include "src/heap/objects-visiting.h" | 9 #include "src/heap/objects-visiting.h" |
10 #include "src/jsregexp.h" | 10 #include "src/jsregexp.h" |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 if (is_access_check_needed()) os << " - access_check_needed\n"; | 425 if (is_access_check_needed()) os << " - access_check_needed\n"; |
426 if (!is_extensible()) os << " - non-extensible\n"; | 426 if (!is_extensible()) os << " - non-extensible\n"; |
427 if (is_observed()) os << " - observed\n"; | 427 if (is_observed()) os << " - observed\n"; |
428 os << " - back pointer: " << Brief(GetBackPointer()); | 428 os << " - back pointer: " << Brief(GetBackPointer()); |
429 os << "\n - instance descriptors " << (owns_descriptors() ? "(own) " : "") | 429 os << "\n - instance descriptors " << (owns_descriptors() ? "(own) " : "") |
430 << "#" << NumberOfOwnDescriptors() << ": " | 430 << "#" << NumberOfOwnDescriptors() << ": " |
431 << Brief(instance_descriptors()); | 431 << Brief(instance_descriptors()); |
432 if (FLAG_unbox_double_fields) { | 432 if (FLAG_unbox_double_fields) { |
433 os << "\n - layout descriptor: " << Brief(layout_descriptor()); | 433 os << "\n - layout descriptor: " << Brief(layout_descriptor()); |
434 } | 434 } |
435 if (HasTransitionArray()) { | 435 if (TransitionArray::NumberOfTransitions(raw_transitions()) > 0) { |
436 os << "\n - transitions: " << Brief(transitions()); | 436 os << "\n - transitions: "; |
| 437 TransitionArray::PrintTransitions(os, raw_transitions()); |
437 } | 438 } |
438 os << "\n - prototype: " << Brief(prototype()); | 439 os << "\n - prototype: " << Brief(prototype()); |
439 os << "\n - constructor: " << Brief(GetConstructor()); | 440 os << "\n - constructor: " << Brief(GetConstructor()); |
440 os << "\n - code cache: " << Brief(code_cache()); | 441 os << "\n - code cache: " << Brief(code_cache()); |
441 os << "\n - dependent code: " << Brief(dependent_code()); | 442 os << "\n - dependent code: " << Brief(dependent_code()); |
442 os << "\n"; | 443 os << "\n"; |
443 } | 444 } |
444 | 445 |
445 | 446 |
446 void CodeCache::CodeCachePrint(std::ostream& os) { // NOLINT | 447 void CodeCache::CodeCachePrint(std::ostream& os) { // NOLINT |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 Descriptor desc; | 1132 Descriptor desc; |
1132 Get(i, &desc); | 1133 Get(i, &desc); |
1133 os << " " << i << ": " << desc << "\n"; | 1134 os << " " << i << ": " << desc << "\n"; |
1134 } | 1135 } |
1135 os << "\n"; | 1136 os << "\n"; |
1136 } | 1137 } |
1137 | 1138 |
1138 | 1139 |
1139 void TransitionArray::Print() { | 1140 void TransitionArray::Print() { |
1140 OFStream os(stdout); | 1141 OFStream os(stdout); |
1141 this->PrintTransitions(os); | 1142 TransitionArray::PrintTransitions(os, this); |
1142 os << std::flush; | 1143 os << std::flush; |
1143 } | 1144 } |
1144 | 1145 |
1145 | 1146 |
1146 void TransitionArray::PrintTransitions(std::ostream& os, | 1147 void TransitionArray::PrintTransitions(std::ostream& os, Object* transitions, |
1147 bool print_header) { // NOLINT | 1148 bool print_header) { // NOLINT |
| 1149 int num_transitions = NumberOfTransitions(transitions); |
1148 if (print_header) { | 1150 if (print_header) { |
1149 os << "Transition array " << number_of_transitions() << "\n"; | 1151 os << "Transition array " << num_transitions << "\n"; |
1150 } | 1152 } |
1151 for (int i = 0; i < number_of_transitions(); i++) { | 1153 for (int i = 0; i < num_transitions; i++) { |
1152 Name* key = GetKey(i); | 1154 Name* key = GetKey(transitions, i); |
1153 Map* target = GetTarget(i); | 1155 Map* target = GetTarget(transitions, i); |
1154 os << " "; | 1156 os << " "; |
1155 #ifdef OBJECT_PRINT | 1157 #ifdef OBJECT_PRINT |
1156 key->NamePrint(os); | 1158 key->NamePrint(os); |
1157 #else | 1159 #else |
1158 key->ShortPrint(os); | 1160 key->ShortPrint(os); |
1159 #endif | 1161 #endif |
1160 os << ": "; | 1162 os << ": "; |
1161 if (key == GetHeap()->nonextensible_symbol()) { | 1163 Heap* heap = key->GetHeap(); |
| 1164 if (key == heap->nonextensible_symbol()) { |
1162 os << " (transition to non-extensible)"; | 1165 os << " (transition to non-extensible)"; |
1163 } else if (key == GetHeap()->sealed_symbol()) { | 1166 } else if (key == heap->sealed_symbol()) { |
1164 os << " (transition to sealed)"; | 1167 os << " (transition to sealed)"; |
1165 } else if (key == GetHeap()->frozen_symbol()) { | 1168 } else if (key == heap->frozen_symbol()) { |
1166 os << " (transition to frozen)"; | 1169 os << " (transition to frozen)"; |
1167 } else if (key == GetHeap()->elements_transition_symbol()) { | 1170 } else if (key == heap->elements_transition_symbol()) { |
1168 os << " (transition to " << ElementsKindToString(target->elements_kind()) | 1171 os << " (transition to " << ElementsKindToString(target->elements_kind()) |
1169 << ")"; | 1172 << ")"; |
1170 } else if (key == GetHeap()->observed_symbol()) { | 1173 } else if (key == heap->observed_symbol()) { |
1171 os << " (transition to Object.observe)"; | 1174 os << " (transition to Object.observe)"; |
1172 } else { | 1175 } else { |
1173 PropertyDetails details = GetTargetDetails(key, target); | 1176 PropertyDetails details = GetTargetDetails(key, target); |
1174 os << " (transition to "; | 1177 os << " (transition to "; |
1175 if (details.location() == kDescriptor) { | 1178 if (details.location() == kDescriptor) { |
1176 os << "immutable "; | 1179 os << "immutable "; |
1177 } | 1180 } |
1178 os << (details.kind() == kData ? "data" : "accessor"); | 1181 os << (details.kind() == kData ? "data" : "accessor"); |
1179 if (details.location() == kDescriptor) { | 1182 if (details.location() == kDescriptor) { |
1180 os << " " << Brief(GetTargetValue(i)); | 1183 Object* value = |
| 1184 target->instance_descriptors()->GetValue(target->LastAdded()); |
| 1185 os << " " << Brief(value); |
1181 } | 1186 } |
1182 os << "), attrs: " << details.attributes(); | 1187 os << "), attrs: " << details.attributes(); |
1183 } | 1188 } |
1184 os << " -> " << Brief(target) << "\n"; | 1189 os << " -> " << Brief(target) << "\n"; |
1185 } | 1190 } |
1186 } | 1191 } |
1187 | 1192 |
1188 | 1193 |
1189 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT | 1194 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT |
1190 if (!map()->HasTransitionArray()) return; | 1195 TransitionArray::PrintTransitions(os, map()->raw_transitions()); |
1191 map()->transitions()->PrintTransitions(os, false); | |
1192 } | 1196 } |
1193 #endif // defined(DEBUG) || defined(OBJECT_PRINT) | 1197 #endif // defined(DEBUG) || defined(OBJECT_PRINT) |
1194 } } // namespace v8::internal | 1198 } } // namespace v8::internal |
OLD | NEW |