OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 10708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10719 } | 10719 } |
10720 } | 10720 } |
10721 it.next(); | 10721 it.next(); |
10722 } | 10722 } |
10723 return statement_position; | 10723 return statement_position; |
10724 } | 10724 } |
10725 | 10725 |
10726 | 10726 |
10727 SafepointEntry Code::GetSafepointEntry(Address pc) { | 10727 SafepointEntry Code::GetSafepointEntry(Address pc) { |
10728 SafepointTable table(this); | 10728 SafepointTable table(this); |
10729 return table.FindEntry(pc); | 10729 SafepointEntry entry = table.FindEntry(pc); |
| 10730 if (entry.is_valid() || !is_turbofanned()) { |
| 10731 return entry; |
| 10732 } |
| 10733 |
| 10734 // If the code is turbofanned, we might be looking for |
| 10735 // an address that was patched by lazy deoptimization. |
| 10736 // In that case look through the patch table, try to |
| 10737 // lookup the original address there, and then use this |
| 10738 // to find the safepoint entry. |
| 10739 DeoptimizationInputData* deopt_data = |
| 10740 DeoptimizationInputData::cast(deoptimization_data()); |
| 10741 intptr_t offset = pc - instruction_start(); |
| 10742 for (int i = 0; i < deopt_data->ReturnAddressPatchCount(); i++) { |
| 10743 if (deopt_data->PatchedAddressPc(i)->value() == offset) { |
| 10744 int original_offset = deopt_data->ReturnAddressPc(i)->value(); |
| 10745 return table.FindEntry(instruction_start() + original_offset); |
| 10746 } |
| 10747 } |
| 10748 return SafepointEntry(); |
10730 } | 10749 } |
10731 | 10750 |
10732 | 10751 |
10733 Object* Code::FindNthObject(int n, Map* match_map) { | 10752 Object* Code::FindNthObject(int n, Map* match_map) { |
10734 DCHECK(is_inline_cache_stub()); | 10753 DCHECK(is_inline_cache_stub()); |
10735 DisallowHeapAllocation no_allocation; | 10754 DisallowHeapAllocation no_allocation; |
10736 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 10755 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
10737 for (RelocIterator it(this, mask); !it.done(); it.next()) { | 10756 for (RelocIterator it(this, mask); !it.done(); it.next()) { |
10738 RelocInfo* info = it.rinfo(); | 10757 RelocInfo* info = it.rinfo(); |
10739 Object* object = info->target_object(); | 10758 Object* object = info->target_object(); |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11121 | 11140 |
11122 #ifdef ENABLE_DISASSEMBLER | 11141 #ifdef ENABLE_DISASSEMBLER |
11123 | 11142 |
11124 void DeoptimizationInputData::DeoptimizationInputDataPrint( | 11143 void DeoptimizationInputData::DeoptimizationInputDataPrint( |
11125 OStream& os) { // NOLINT | 11144 OStream& os) { // NOLINT |
11126 disasm::NameConverter converter; | 11145 disasm::NameConverter converter; |
11127 int deopt_count = DeoptCount(); | 11146 int deopt_count = DeoptCount(); |
11128 os << "Deoptimization Input Data (deopt points = " << deopt_count << ")\n"; | 11147 os << "Deoptimization Input Data (deopt points = " << deopt_count << ")\n"; |
11129 if (0 != deopt_count) { | 11148 if (0 != deopt_count) { |
11130 os << " index ast id argc pc"; | 11149 os << " index ast id argc pc"; |
11131 if (FLAG_print_code_verbose) os << "commands"; | 11150 if (FLAG_print_code_verbose) os << " commands"; |
11132 os << "\n"; | 11151 os << "\n"; |
11133 } | 11152 } |
11134 for (int i = 0; i < deopt_count; i++) { | 11153 for (int i = 0; i < deopt_count; i++) { |
11135 // TODO(svenpanne) Add some basic formatting to our streams. | 11154 // TODO(svenpanne) Add some basic formatting to our streams. |
11136 Vector<char> buf1 = Vector<char>::New(128); | 11155 Vector<char> buf1 = Vector<char>::New(128); |
11137 SNPrintF(buf1, "%6d %6d %6d %6d", i, AstId(i).ToInt(), | 11156 SNPrintF(buf1, "%6d %6d %6d %6d", i, AstId(i).ToInt(), |
11138 ArgumentsStackHeight(i)->value(), Pc(i)->value()); | 11157 ArgumentsStackHeight(i)->value(), Pc(i)->value()); |
11139 os << buf1.start(); | 11158 os << buf1.start(); |
11140 | 11159 |
11141 if (!FLAG_print_code_verbose) { | 11160 if (!FLAG_print_code_verbose) { |
11142 os << "\n"; | 11161 os << "\n"; |
11143 continue; | 11162 continue; |
11144 } | 11163 } |
11145 // Print details of the frame translation. | 11164 // Print details of the frame translation. |
11146 int translation_index = TranslationIndex(i)->value(); | 11165 int translation_index = TranslationIndex(i)->value(); |
11147 TranslationIterator iterator(TranslationByteArray(), translation_index); | 11166 TranslationIterator iterator(TranslationByteArray(), translation_index); |
11148 Translation::Opcode opcode = | 11167 Translation::Opcode opcode = |
11149 static_cast<Translation::Opcode>(iterator.Next()); | 11168 static_cast<Translation::Opcode>(iterator.Next()); |
11150 DCHECK(Translation::BEGIN == opcode); | 11169 DCHECK(Translation::BEGIN == opcode); |
11151 int frame_count = iterator.Next(); | 11170 int frame_count = iterator.Next(); |
11152 int jsframe_count = iterator.Next(); | 11171 int jsframe_count = iterator.Next(); |
11153 os << " " << Translation::StringFor(opcode) | 11172 os << " " << Translation::StringFor(opcode) |
11154 << " {frame count=" << frame_count | 11173 << " {frame count=" << frame_count |
11155 << ", js frame count=" << jsframe_count << "}\n"; | 11174 << ", js frame count=" << jsframe_count << "}\n"; |
11156 | 11175 |
11157 while (iterator.HasNext() && | 11176 while (iterator.HasNext() && |
11158 Translation::BEGIN != | 11177 Translation::BEGIN != |
11159 (opcode = static_cast<Translation::Opcode>(iterator.Next()))) { | 11178 (opcode = static_cast<Translation::Opcode>(iterator.Next()))) { |
11160 Vector<char> buf2 = Vector<char>::New(128); | 11179 Vector<char> buf2 = Vector<char>::New(128); |
11161 SNPrintF(buf2, "%24s %s ", "", Translation::StringFor(opcode)); | 11180 SNPrintF(buf2, "%27s %s ", "", Translation::StringFor(opcode)); |
11162 os << buf2.start(); | 11181 os << buf2.start(); |
11163 | 11182 |
11164 switch (opcode) { | 11183 switch (opcode) { |
11165 case Translation::BEGIN: | 11184 case Translation::BEGIN: |
11166 UNREACHABLE(); | 11185 UNREACHABLE(); |
11167 break; | 11186 break; |
11168 | 11187 |
11169 case Translation::JS_FRAME: { | 11188 case Translation::JS_FRAME: { |
11170 int ast_id = iterator.Next(); | 11189 int ast_id = iterator.Next(); |
11171 int function_id = iterator.Next(); | 11190 int function_id = iterator.Next(); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11277 } | 11296 } |
11278 } | 11297 } |
11279 os << "\n"; | 11298 os << "\n"; |
11280 } | 11299 } |
11281 } | 11300 } |
11282 | 11301 |
11283 int return_address_patch_count = ReturnAddressPatchCount(); | 11302 int return_address_patch_count = ReturnAddressPatchCount(); |
11284 if (return_address_patch_count != 0) { | 11303 if (return_address_patch_count != 0) { |
11285 os << "Return address patch data (count = " << return_address_patch_count | 11304 os << "Return address patch data (count = " << return_address_patch_count |
11286 << ")\n"; | 11305 << ")\n"; |
11287 os << "index pc patched_pc\n"; | 11306 os << " index pc patched_pc\n"; |
11288 } | 11307 } |
11289 for (int i = 0; i < return_address_patch_count; i++) { | 11308 for (int i = 0; i < return_address_patch_count; i++) { |
11290 Vector<char> buf = Vector<char>::New(128); | 11309 Vector<char> buf = Vector<char>::New(128); |
11291 SNPrintF(buf, "%6d %6d %10d", i, ReturnAddressPc(i)->value(), | 11310 SNPrintF(buf, "%6d %6d %12d\n", i, ReturnAddressPc(i)->value(), |
11292 PatchedAddressPc(i)->value()); | 11311 PatchedAddressPc(i)->value()); |
11293 os << buf.start(); | 11312 os << buf.start(); |
11294 } | 11313 } |
11295 } | 11314 } |
11296 | 11315 |
11297 | 11316 |
11298 void DeoptimizationOutputData::DeoptimizationOutputDataPrint( | 11317 void DeoptimizationOutputData::DeoptimizationOutputDataPrint( |
11299 OStream& os) { // NOLINT | 11318 OStream& os) { // NOLINT |
11300 os << "Deoptimization Output Data (deopt points = " << this->DeoptPoints() | 11319 os << "Deoptimization Output Data (deopt points = " << this->DeoptPoints() |
11301 << ")\n"; | 11320 << ")\n"; |
(...skipping 5596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16898 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16917 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16899 static const char* error_messages_[] = { | 16918 static const char* error_messages_[] = { |
16900 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16919 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16901 }; | 16920 }; |
16902 #undef ERROR_MESSAGES_TEXTS | 16921 #undef ERROR_MESSAGES_TEXTS |
16903 return error_messages_[reason]; | 16922 return error_messages_[reason]; |
16904 } | 16923 } |
16905 | 16924 |
16906 | 16925 |
16907 } } // namespace v8::internal | 16926 } } // namespace v8::internal |
OLD | NEW |