Chromium Code Reviews| 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/interpreter/bytecodes.h" | |
| 10 #include "src/jsregexp.h" | 11 #include "src/jsregexp.h" |
| 11 #include "src/ostreams.h" | 12 #include "src/ostreams.h" |
| 12 | 13 |
| 13 namespace v8 { | 14 namespace v8 { |
| 14 namespace internal { | 15 namespace internal { |
| 15 | 16 |
| 16 #ifdef OBJECT_PRINT | 17 #ifdef OBJECT_PRINT |
| 17 | 18 |
| 18 void Object::Print() { | 19 void Object::Print() { |
| 19 OFStream os(stdout); | 20 OFStream os(stdout); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 break; | 66 break; |
| 66 case FIXED_DOUBLE_ARRAY_TYPE: | 67 case FIXED_DOUBLE_ARRAY_TYPE: |
| 67 FixedDoubleArray::cast(this)->FixedDoubleArrayPrint(os); | 68 FixedDoubleArray::cast(this)->FixedDoubleArrayPrint(os); |
| 68 break; | 69 break; |
| 69 case FIXED_ARRAY_TYPE: | 70 case FIXED_ARRAY_TYPE: |
| 70 FixedArray::cast(this)->FixedArrayPrint(os); | 71 FixedArray::cast(this)->FixedArrayPrint(os); |
| 71 break; | 72 break; |
| 72 case BYTE_ARRAY_TYPE: | 73 case BYTE_ARRAY_TYPE: |
| 73 ByteArray::cast(this)->ByteArrayPrint(os); | 74 ByteArray::cast(this)->ByteArrayPrint(os); |
| 74 break; | 75 break; |
| 76 case BYTECODE_ARRAY_TYPE: | |
| 77 BytecodeArray::cast(this)->BytecodeArrayPrint(os); | |
| 78 break; | |
| 75 case FREE_SPACE_TYPE: | 79 case FREE_SPACE_TYPE: |
| 76 FreeSpace::cast(this)->FreeSpacePrint(os); | 80 FreeSpace::cast(this)->FreeSpacePrint(os); |
| 77 break; | 81 break; |
| 78 | 82 |
| 79 #define PRINT_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size) \ | 83 #define PRINT_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size) \ |
| 80 case EXTERNAL_##TYPE##_ARRAY_TYPE: \ | 84 case EXTERNAL_##TYPE##_ARRAY_TYPE: \ |
| 81 External##Type##Array::cast(this)->External##Type##ArrayPrint(os); \ | 85 External##Type##Array::cast(this)->External##Type##ArrayPrint(os); \ |
| 82 break; | 86 break; |
| 83 | 87 |
| 84 TYPED_ARRAYS(PRINT_EXTERNAL_ARRAY) | 88 TYPED_ARRAYS(PRINT_EXTERNAL_ARRAY) |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 break; | 198 break; |
| 195 } | 199 } |
| 196 } | 200 } |
| 197 | 201 |
| 198 | 202 |
| 199 void ByteArray::ByteArrayPrint(std::ostream& os) { // NOLINT | 203 void ByteArray::ByteArrayPrint(std::ostream& os) { // NOLINT |
| 200 os << "byte array, data starts at " << GetDataStartAddress(); | 204 os << "byte array, data starts at " << GetDataStartAddress(); |
| 201 } | 205 } |
| 202 | 206 |
| 203 | 207 |
| 208 void BytecodeArray::BytecodeArrayPrint(std::ostream& os) { // NOLINT | |
| 209 os << "bytecode array, data starts at " << GetDataStartAddress(); | |
| 210 for (int i = 0; i < this->length(); i++) { | |
| 211 byte bc = this->get(i); | |
| 212 os << "\n" << i << " : " << this->get(i) << " " | |
| 213 << static_cast<interpreter::Bytecode>(bc); | |
|
rmcilroy
2015/07/15 13:33:38
How about we move this to a BytecodeArray::Dissass
oth
2015/07/16 09:15:50
Done.
| |
| 214 } | |
| 215 } | |
| 216 | |
| 217 | |
| 204 void FreeSpace::FreeSpacePrint(std::ostream& os) { // NOLINT | 218 void FreeSpace::FreeSpacePrint(std::ostream& os) { // NOLINT |
| 205 os << "free space, size " << Size(); | 219 os << "free space, size " << Size(); |
| 206 } | 220 } |
| 207 | 221 |
| 208 | 222 |
| 209 #define EXTERNAL_ARRAY_PRINTER(Type, type, TYPE, ctype, size) \ | 223 #define EXTERNAL_ARRAY_PRINTER(Type, type, TYPE, ctype, size) \ |
| 210 void External##Type##Array::External##Type##ArrayPrint(std::ostream& os) { \ | 224 void External##Type##Array::External##Type##ArrayPrint(std::ostream& os) { \ |
| 211 os << "external " #type " array"; \ | 225 os << "external " #type " array"; \ |
| 212 } | 226 } |
| 213 | 227 |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 759 // script()->Print(os); | 773 // script()->Print(os); |
| 760 os << "\n - function token position = " << function_token_position(); | 774 os << "\n - function token position = " << function_token_position(); |
| 761 os << "\n - start position = " << start_position(); | 775 os << "\n - start position = " << start_position(); |
| 762 os << "\n - end position = " << end_position(); | 776 os << "\n - end position = " << end_position(); |
| 763 os << "\n - is expression = " << is_expression(); | 777 os << "\n - is expression = " << is_expression(); |
| 764 os << "\n - debug info = " << Brief(debug_info()); | 778 os << "\n - debug info = " << Brief(debug_info()); |
| 765 os << "\n - length = " << length(); | 779 os << "\n - length = " << length(); |
| 766 os << "\n - optimized_code_map = " << Brief(optimized_code_map()); | 780 os << "\n - optimized_code_map = " << Brief(optimized_code_map()); |
| 767 os << "\n - feedback_vector = "; | 781 os << "\n - feedback_vector = "; |
| 768 feedback_vector()->FixedArrayPrint(os); | 782 feedback_vector()->FixedArrayPrint(os); |
| 783 // TODO(oth): implement real bytecode printer | |
|
rmcilroy
2015/07/15 13:33:38
Actually I think emitting the pointer here is fine
oth
2015/07/16 09:15:50
Done.
| |
| 784 os << "\n - bytecode_array = " << bytecode_array(); | |
| 769 os << "\n"; | 785 os << "\n"; |
| 770 } | 786 } |
| 771 | 787 |
| 772 | 788 |
| 773 void JSGlobalProxy::JSGlobalProxyPrint(std::ostream& os) { // NOLINT | 789 void JSGlobalProxy::JSGlobalProxyPrint(std::ostream& os) { // NOLINT |
| 774 os << "global_proxy "; | 790 os << "global_proxy "; |
| 775 JSObjectPrint(os); | 791 JSObjectPrint(os); |
| 776 os << "native context : " << Brief(native_context()); | 792 os << "native context : " << Brief(native_context()); |
| 777 os << "\n"; | 793 os << "\n"; |
| 778 } | 794 } |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1173 } | 1189 } |
| 1174 } | 1190 } |
| 1175 | 1191 |
| 1176 | 1192 |
| 1177 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT | 1193 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT |
| 1178 TransitionArray::PrintTransitions(os, map()->raw_transitions()); | 1194 TransitionArray::PrintTransitions(os, map()->raw_transitions()); |
| 1179 } | 1195 } |
| 1180 #endif // defined(DEBUG) || defined(OBJECT_PRINT) | 1196 #endif // defined(DEBUG) || defined(OBJECT_PRINT) |
| 1181 } // namespace internal | 1197 } // namespace internal |
| 1182 } // namespace v8 | 1198 } // namespace v8 |
| OLD | NEW |