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