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 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 } | 1164 } |
1165 | 1165 |
1166 | 1166 |
1167 void TransitionArray::PrintTransitions(std::ostream& os, | 1167 void TransitionArray::PrintTransitions(std::ostream& os, |
1168 bool print_header) { // NOLINT | 1168 bool print_header) { // NOLINT |
1169 if (print_header) { | 1169 if (print_header) { |
1170 os << "Transition array " << number_of_transitions() << "\n"; | 1170 os << "Transition array " << number_of_transitions() << "\n"; |
1171 } | 1171 } |
1172 for (int i = 0; i < number_of_transitions(); i++) { | 1172 for (int i = 0; i < number_of_transitions(); i++) { |
1173 Name* key = GetKey(i); | 1173 Name* key = GetKey(i); |
| 1174 Map* target = GetTarget(i); |
1174 os << " "; | 1175 os << " "; |
1175 #ifdef OBJECT_PRINT | 1176 #ifdef OBJECT_PRINT |
1176 key->NamePrint(os); | 1177 key->NamePrint(os); |
1177 #else | 1178 #else |
1178 key->ShortPrint(os); | 1179 key->ShortPrint(os); |
1179 #endif | 1180 #endif |
1180 os << ": "; | 1181 os << ": "; |
1181 if (key == GetHeap()->frozen_symbol()) { | 1182 if (key == GetHeap()->frozen_symbol()) { |
1182 os << " (transition to frozen)"; | 1183 os << " (transition to frozen)"; |
1183 } else if (key == GetHeap()->elements_transition_symbol()) { | 1184 } else if (key == GetHeap()->elements_transition_symbol()) { |
1184 os << " (transition to " | 1185 os << " (transition to " << ElementsKindToString(target->elements_kind()) |
1185 << ElementsKindToString(GetTarget(i)->elements_kind()) << ")"; | 1186 << ")"; |
1186 } else if (key == GetHeap()->observed_symbol()) { | 1187 } else if (key == GetHeap()->observed_symbol()) { |
1187 os << " (transition to Object.observe)"; | 1188 os << " (transition to Object.observe)"; |
1188 } else { | 1189 } else { |
1189 PropertyDetails details = GetTargetDetails(i); | 1190 PropertyDetails details = GetTargetDetails(key, target); |
1190 switch (details.type()) { | 1191 switch (details.type()) { |
1191 case FIELD: { | 1192 case FIELD: { |
1192 os << " (transition to field)"; | 1193 os << " (transition to field)"; |
1193 break; | 1194 break; |
1194 } | 1195 } |
1195 case CONSTANT: | 1196 case CONSTANT: |
1196 os << " (transition to constant " << Brief(GetTargetValue(i)) << ")"; | 1197 os << " (transition to constant " << Brief(GetTargetValue(i)) << ")"; |
1197 break; | 1198 break; |
1198 case CALLBACKS: | 1199 case CALLBACKS: |
1199 os << " (transition to callback " << Brief(GetTargetValue(i)) << ")"; | 1200 os << " (transition to callback " << Brief(GetTargetValue(i)) << ")"; |
1200 break; | 1201 break; |
1201 } | 1202 } |
1202 os << ", attrs: " << details.attributes(); | 1203 os << ", attrs: " << details.attributes(); |
1203 } | 1204 } |
1204 os << " -> " << Brief(GetTarget(i)) << "\n"; | 1205 os << " -> " << Brief(target) << "\n"; |
1205 } | 1206 } |
1206 } | 1207 } |
1207 | 1208 |
1208 | 1209 |
1209 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT | 1210 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT |
1210 if (!map()->HasTransitionArray()) return; | 1211 if (!map()->HasTransitionArray()) return; |
1211 map()->transitions()->PrintTransitions(os, false); | 1212 map()->transitions()->PrintTransitions(os, false); |
1212 } | 1213 } |
1213 #endif // defined(DEBUG) || defined(OBJECT_PRINT) | 1214 #endif // defined(DEBUG) || defined(OBJECT_PRINT) |
1214 } } // namespace v8::internal | 1215 } } // namespace v8::internal |
OLD | NEW |