OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 7052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7063 #ifdef ENABLE_DISASSEMBLER | 7063 #ifdef ENABLE_DISASSEMBLER |
7064 | 7064 |
7065 void DeoptimizationInputData::DeoptimizationInputDataPrint(FILE* out) { | 7065 void DeoptimizationInputData::DeoptimizationInputDataPrint(FILE* out) { |
7066 disasm::NameConverter converter; | 7066 disasm::NameConverter converter; |
7067 int deopt_count = DeoptCount(); | 7067 int deopt_count = DeoptCount(); |
7068 PrintF(out, "Deoptimization Input Data (deopt points = %d)\n", deopt_count); | 7068 PrintF(out, "Deoptimization Input Data (deopt points = %d)\n", deopt_count); |
7069 if (0 == deopt_count) return; | 7069 if (0 == deopt_count) return; |
7070 | 7070 |
7071 PrintF(out, "%6s %6s %6s %12s\n", "index", "ast id", "argc", "commands"); | 7071 PrintF(out, "%6s %6s %6s %12s\n", "index", "ast id", "argc", "commands"); |
7072 for (int i = 0; i < deopt_count; i++) { | 7072 for (int i = 0; i < deopt_count; i++) { |
7073 int command_count = 0; | |
7074 PrintF(out, "%6d %6d %6d", | 7073 PrintF(out, "%6d %6d %6d", |
7075 i, AstId(i)->value(), ArgumentsStackHeight(i)->value()); | 7074 i, AstId(i)->value(), ArgumentsStackHeight(i)->value()); |
| 7075 |
| 7076 if (!FLAG_print_code_verbose) continue; |
| 7077 // Print details of the frame translation. |
7076 int translation_index = TranslationIndex(i)->value(); | 7078 int translation_index = TranslationIndex(i)->value(); |
7077 TranslationIterator iterator(TranslationByteArray(), translation_index); | 7079 TranslationIterator iterator(TranslationByteArray(), translation_index); |
7078 Translation::Opcode opcode = | 7080 Translation::Opcode opcode = |
7079 static_cast<Translation::Opcode>(iterator.Next()); | 7081 static_cast<Translation::Opcode>(iterator.Next()); |
7080 ASSERT(Translation::BEGIN == opcode); | 7082 ASSERT(Translation::BEGIN == opcode); |
7081 int frame_count = iterator.Next(); | 7083 int frame_count = iterator.Next(); |
7082 if (FLAG_print_code_verbose) { | 7084 PrintF(out, " %s {count=%d}\n", Translation::StringFor(opcode), |
7083 PrintF(out, " %s {count=%d}\n", Translation::StringFor(opcode), | 7085 frame_count); |
7084 frame_count); | |
7085 } | |
7086 | 7086 |
7087 for (int i = 0; i < frame_count; ++i) { | 7087 while (iterator.HasNext() && |
7088 opcode = static_cast<Translation::Opcode>(iterator.Next()); | 7088 Translation::BEGIN != |
7089 ASSERT(Translation::FRAME == opcode); | 7089 (opcode = static_cast<Translation::Opcode>(iterator.Next()))) { |
7090 int ast_id = iterator.Next(); | 7090 PrintF(out, "%24s %s ", "", Translation::StringFor(opcode)); |
7091 int function_id = iterator.Next(); | |
7092 JSFunction* function = | |
7093 JSFunction::cast(LiteralArray()->get(function_id)); | |
7094 unsigned height = iterator.Next(); | |
7095 if (FLAG_print_code_verbose) { | |
7096 PrintF(out, "%24s %s {ast_id=%d, function=", | |
7097 "", Translation::StringFor(opcode), ast_id); | |
7098 function->PrintName(out); | |
7099 PrintF(out, ", height=%u}\n", height); | |
7100 } | |
7101 | 7091 |
7102 // Size of translation is height plus all incoming arguments including | 7092 switch (opcode) { |
7103 // receiver. | 7093 case Translation::BEGIN: |
7104 int size = height + function->shared()->formal_parameter_count() + 1; | 7094 UNREACHABLE(); |
7105 command_count += size; | 7095 break; |
7106 for (int j = 0; j < size; ++j) { | 7096 |
7107 opcode = static_cast<Translation::Opcode>(iterator.Next()); | 7097 case Translation::FRAME: { |
7108 if (FLAG_print_code_verbose) { | 7098 int ast_id = iterator.Next(); |
7109 PrintF(out, "%24s %s ", "", Translation::StringFor(opcode)); | 7099 int function_id = iterator.Next(); |
| 7100 JSFunction* function = |
| 7101 JSFunction::cast(LiteralArray()->get(function_id)); |
| 7102 unsigned height = iterator.Next(); |
| 7103 PrintF(out, "{ast_id=%d, \nfunction=", ast_id); |
| 7104 function->PrintName(out); |
| 7105 PrintF(out, ", height=%u}", height); |
| 7106 break; |
7110 } | 7107 } |
7111 | 7108 |
7112 if (opcode == Translation::DUPLICATE) { | 7109 case Translation::DUPLICATE: |
7113 opcode = static_cast<Translation::Opcode>(iterator.Next()); | 7110 break; |
7114 if (FLAG_print_code_verbose) { | 7111 |
7115 PrintF(out, "%s ", Translation::StringFor(opcode)); | 7112 case Translation::REGISTER: { |
7116 } | 7113 int reg_code = iterator.Next(); |
7117 --j; // Two commands share the same frame index. | 7114 PrintF(out, "{input=%s}", converter.NameOfCPURegister(reg_code)); |
| 7115 break; |
7118 } | 7116 } |
7119 | 7117 |
7120 switch (opcode) { | 7118 case Translation::INT32_REGISTER: { |
7121 case Translation::BEGIN: | 7119 int reg_code = iterator.Next(); |
7122 case Translation::FRAME: | 7120 PrintF(out, "{input=%s}", converter.NameOfCPURegister(reg_code)); |
7123 case Translation::DUPLICATE: | 7121 break; |
7124 UNREACHABLE(); | 7122 } |
7125 break; | |
7126 | 7123 |
7127 case Translation::REGISTER: { | 7124 case Translation::DOUBLE_REGISTER: { |
7128 int reg_code = iterator.Next(); | 7125 int reg_code = iterator.Next(); |
7129 if (FLAG_print_code_verbose) { | 7126 PrintF(out, "{input=%s}", |
7130 PrintF(out, "{input=%s}", converter.NameOfCPURegister(reg_code)); | 7127 DoubleRegister::AllocationIndexToString(reg_code)); |
7131 } | 7128 break; |
7132 break; | 7129 } |
7133 } | |
7134 | 7130 |
7135 case Translation::INT32_REGISTER: { | 7131 case Translation::STACK_SLOT: { |
7136 int reg_code = iterator.Next(); | 7132 int input_slot_index = iterator.Next(); |
7137 if (FLAG_print_code_verbose) { | 7133 PrintF(out, "{input=%d}", input_slot_index); |
7138 PrintF(out, "{input=%s}", converter.NameOfCPURegister(reg_code)); | 7134 break; |
7139 } | 7135 } |
7140 break; | |
7141 } | |
7142 | 7136 |
7143 case Translation::DOUBLE_REGISTER: { | 7137 case Translation::INT32_STACK_SLOT: { |
7144 int reg_code = iterator.Next(); | 7138 int input_slot_index = iterator.Next(); |
7145 if (FLAG_print_code_verbose) { | 7139 PrintF(out, "{input=%d}", input_slot_index); |
7146 PrintF(out, "{input=%s}", | 7140 break; |
7147 DoubleRegister::AllocationIndexToString(reg_code)); | 7141 } |
7148 } | |
7149 break; | |
7150 } | |
7151 | 7142 |
7152 case Translation::STACK_SLOT: { | 7143 case Translation::DOUBLE_STACK_SLOT: { |
7153 int input_slot_index = iterator.Next(); | 7144 int input_slot_index = iterator.Next(); |
7154 if (FLAG_print_code_verbose) { | 7145 PrintF(out, "{input=%d}", input_slot_index); |
7155 PrintF(out, "{input=%d}", input_slot_index); | 7146 break; |
7156 } | 7147 } |
7157 break; | |
7158 } | |
7159 | 7148 |
7160 case Translation::INT32_STACK_SLOT: { | 7149 case Translation::LITERAL: { |
7161 int input_slot_index = iterator.Next(); | 7150 unsigned literal_index = iterator.Next(); |
7162 if (FLAG_print_code_verbose) { | 7151 PrintF(out, "{literal_id=%u}", literal_index); |
7163 PrintF(out, "{input=%d}", input_slot_index); | 7152 break; |
7164 } | 7153 } |
7165 break; | |
7166 } | |
7167 | 7154 |
7168 case Translation::DOUBLE_STACK_SLOT: { | 7155 case Translation::ARGUMENTS_OBJECT: |
7169 int input_slot_index = iterator.Next(); | 7156 break; |
7170 if (FLAG_print_code_verbose) { | |
7171 PrintF(out, "{input=%d}", input_slot_index); | |
7172 } | |
7173 break; | |
7174 } | |
7175 | |
7176 case Translation::LITERAL: { | |
7177 unsigned literal_index = iterator.Next(); | |
7178 if (FLAG_print_code_verbose) { | |
7179 PrintF(out, "{literal_id=%u}", literal_index); | |
7180 } | |
7181 break; | |
7182 } | |
7183 | |
7184 case Translation::ARGUMENTS_OBJECT: | |
7185 break; | |
7186 } | |
7187 if (FLAG_print_code_verbose) PrintF(out, "\n"); | |
7188 } | 7157 } |
| 7158 PrintF(out, "\n"); |
7189 } | 7159 } |
7190 if (!FLAG_print_code_verbose) PrintF(out, " %12d\n", command_count); | |
7191 } | 7160 } |
7192 } | 7161 } |
7193 | 7162 |
7194 | 7163 |
7195 void DeoptimizationOutputData::DeoptimizationOutputDataPrint(FILE* out) { | 7164 void DeoptimizationOutputData::DeoptimizationOutputDataPrint(FILE* out) { |
7196 PrintF(out, "Deoptimization Output Data (deopt points = %d)\n", | 7165 PrintF(out, "Deoptimization Output Data (deopt points = %d)\n", |
7197 this->DeoptPoints()); | 7166 this->DeoptPoints()); |
7198 if (this->DeoptPoints() == 0) return; | 7167 if (this->DeoptPoints() == 0) return; |
7199 | 7168 |
7200 PrintF("%6s %8s %s\n", "ast id", "pc", "state"); | 7169 PrintF("%6s %8s %s\n", "ast id", "pc", "state"); |
(...skipping 4519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11720 if (break_point_objects()->IsUndefined()) return 0; | 11689 if (break_point_objects()->IsUndefined()) return 0; |
11721 // Single break point. | 11690 // Single break point. |
11722 if (!break_point_objects()->IsFixedArray()) return 1; | 11691 if (!break_point_objects()->IsFixedArray()) return 1; |
11723 // Multiple break points. | 11692 // Multiple break points. |
11724 return FixedArray::cast(break_point_objects())->length(); | 11693 return FixedArray::cast(break_point_objects())->length(); |
11725 } | 11694 } |
11726 #endif | 11695 #endif |
11727 | 11696 |
11728 | 11697 |
11729 } } // namespace v8::internal | 11698 } } // namespace v8::internal |
OLD | NEW |