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