| 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 7915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7926 } | 7926 } |
| 7927 | 7927 |
| 7928 | 7928 |
| 7929 Object* AccessorPair::GetComponent(AccessorComponent component) { | 7929 Object* AccessorPair::GetComponent(AccessorComponent component) { |
| 7930 Object* accessor = get(component); | 7930 Object* accessor = get(component); |
| 7931 return accessor->IsTheHole() ? GetHeap()->undefined_value() : accessor; | 7931 return accessor->IsTheHole() ? GetHeap()->undefined_value() : accessor; |
| 7932 } | 7932 } |
| 7933 | 7933 |
| 7934 | 7934 |
| 7935 Handle<DeoptimizationInputData> DeoptimizationInputData::New( | 7935 Handle<DeoptimizationInputData> DeoptimizationInputData::New( |
| 7936 Isolate* isolate, int deopt_entry_count, int return_patch_address_count, | 7936 Isolate* isolate, int deopt_entry_count, PretenureFlag pretenure) { |
| 7937 PretenureFlag pretenure) { | 7937 DCHECK(deopt_entry_count > 0); |
| 7938 DCHECK(deopt_entry_count + return_patch_address_count > 0); | 7938 return Handle<DeoptimizationInputData>::cast( |
| 7939 Handle<FixedArray> deoptimization_data = | 7939 isolate->factory()->NewFixedArray(LengthFor(deopt_entry_count), |
| 7940 Handle<FixedArray>::cast(isolate->factory()->NewFixedArray( | 7940 pretenure)); |
| 7941 LengthFor(deopt_entry_count, return_patch_address_count), pretenure)); | |
| 7942 deoptimization_data->set(kDeoptEntryCountIndex, | |
| 7943 Smi::FromInt(deopt_entry_count)); | |
| 7944 deoptimization_data->set(kReturnAddressPatchEntryCountIndex, | |
| 7945 Smi::FromInt(return_patch_address_count)); | |
| 7946 return Handle<DeoptimizationInputData>::cast(deoptimization_data); | |
| 7947 } | 7941 } |
| 7948 | 7942 |
| 7949 | 7943 |
| 7950 Handle<DeoptimizationOutputData> DeoptimizationOutputData::New( | 7944 Handle<DeoptimizationOutputData> DeoptimizationOutputData::New( |
| 7951 Isolate* isolate, | 7945 Isolate* isolate, |
| 7952 int number_of_deopt_points, | 7946 int number_of_deopt_points, |
| 7953 PretenureFlag pretenure) { | 7947 PretenureFlag pretenure) { |
| 7954 Handle<FixedArray> result; | 7948 Handle<FixedArray> result; |
| 7955 if (number_of_deopt_points == 0) { | 7949 if (number_of_deopt_points == 0) { |
| 7956 result = isolate->factory()->empty_fixed_array(); | 7950 result = isolate->factory()->empty_fixed_array(); |
| (...skipping 2327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10284 } | 10278 } |
| 10285 } | 10279 } |
| 10286 it.next(); | 10280 it.next(); |
| 10287 } | 10281 } |
| 10288 return statement_position; | 10282 return statement_position; |
| 10289 } | 10283 } |
| 10290 | 10284 |
| 10291 | 10285 |
| 10292 SafepointEntry Code::GetSafepointEntry(Address pc) { | 10286 SafepointEntry Code::GetSafepointEntry(Address pc) { |
| 10293 SafepointTable table(this); | 10287 SafepointTable table(this); |
| 10294 SafepointEntry entry = table.FindEntry(pc); | 10288 return table.FindEntry(pc); |
| 10295 if (entry.is_valid() || !is_turbofanned()) { | |
| 10296 return entry; | |
| 10297 } | |
| 10298 | |
| 10299 // If the code is turbofanned, we might be looking for | |
| 10300 // an address that was patched by lazy deoptimization. | |
| 10301 // In that case look through the patch table, try to | |
| 10302 // lookup the original address there, and then use this | |
| 10303 // to find the safepoint entry. | |
| 10304 DeoptimizationInputData* deopt_data = | |
| 10305 DeoptimizationInputData::cast(deoptimization_data()); | |
| 10306 intptr_t offset = pc - instruction_start(); | |
| 10307 for (int i = 0; i < deopt_data->ReturnAddressPatchCount(); i++) { | |
| 10308 if (deopt_data->PatchedAddressPc(i)->value() == offset) { | |
| 10309 int original_offset = deopt_data->ReturnAddressPc(i)->value(); | |
| 10310 return table.FindEntry(instruction_start() + original_offset); | |
| 10311 } | |
| 10312 } | |
| 10313 return SafepointEntry(); | |
| 10314 } | 10289 } |
| 10315 | 10290 |
| 10316 | 10291 |
| 10317 Object* Code::FindNthObject(int n, Map* match_map) { | 10292 Object* Code::FindNthObject(int n, Map* match_map) { |
| 10318 DCHECK(is_inline_cache_stub()); | 10293 DCHECK(is_inline_cache_stub()); |
| 10319 DisallowHeapAllocation no_allocation; | 10294 DisallowHeapAllocation no_allocation; |
| 10320 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 10295 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
| 10321 for (RelocIterator it(this, mask); !it.done(); it.next()) { | 10296 for (RelocIterator it(this, mask); !it.done(); it.next()) { |
| 10322 RelocInfo* info = it.rinfo(); | 10297 RelocInfo* info = it.rinfo(); |
| 10323 Object* object = info->target_object(); | 10298 Object* object = info->target_object(); |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10856 case Translation::ARGUMENTS_OBJECT: | 10831 case Translation::ARGUMENTS_OBJECT: |
| 10857 case Translation::CAPTURED_OBJECT: { | 10832 case Translation::CAPTURED_OBJECT: { |
| 10858 int args_length = iterator.Next(); | 10833 int args_length = iterator.Next(); |
| 10859 os << "{length=" << args_length << "}"; | 10834 os << "{length=" << args_length << "}"; |
| 10860 break; | 10835 break; |
| 10861 } | 10836 } |
| 10862 } | 10837 } |
| 10863 os << "\n"; | 10838 os << "\n"; |
| 10864 } | 10839 } |
| 10865 } | 10840 } |
| 10866 | |
| 10867 int return_address_patch_count = ReturnAddressPatchCount(); | |
| 10868 if (return_address_patch_count != 0) { | |
| 10869 os << "Return address patch data (count = " << return_address_patch_count | |
| 10870 << ")\n"; | |
| 10871 os << " index pc patched_pc\n"; | |
| 10872 } | |
| 10873 for (int i = 0; i < return_address_patch_count; i++) { | |
| 10874 Vector<char> buf = Vector<char>::New(128); | |
| 10875 SNPrintF(buf, "%6d %6d %12d\n", i, ReturnAddressPc(i)->value(), | |
| 10876 PatchedAddressPc(i)->value()); | |
| 10877 os << buf.start(); | |
| 10878 } | |
| 10879 } | 10841 } |
| 10880 | 10842 |
| 10881 | 10843 |
| 10882 void DeoptimizationOutputData::DeoptimizationOutputDataPrint( | 10844 void DeoptimizationOutputData::DeoptimizationOutputDataPrint( |
| 10883 OStream& os) { // NOLINT | 10845 OStream& os) { // NOLINT |
| 10884 os << "Deoptimization Output Data (deopt points = " << this->DeoptPoints() | 10846 os << "Deoptimization Output Data (deopt points = " << this->DeoptPoints() |
| 10885 << ")\n"; | 10847 << ")\n"; |
| 10886 if (this->DeoptPoints() == 0) return; | 10848 if (this->DeoptPoints() == 0) return; |
| 10887 | 10849 |
| 10888 os << "ast id pc state\n"; | 10850 os << "ast id pc state\n"; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10999 table.PrintEntry(i, os); | 10961 table.PrintEntry(i, os); |
| 11000 os << " (sp -> fp) "; | 10962 os << " (sp -> fp) "; |
| 11001 SafepointEntry entry = table.GetEntry(i); | 10963 SafepointEntry entry = table.GetEntry(i); |
| 11002 if (entry.deoptimization_index() != Safepoint::kNoDeoptimizationIndex) { | 10964 if (entry.deoptimization_index() != Safepoint::kNoDeoptimizationIndex) { |
| 11003 Vector<char> buf2 = Vector<char>::New(30); | 10965 Vector<char> buf2 = Vector<char>::New(30); |
| 11004 SNPrintF(buf2, "%6d", entry.deoptimization_index()); | 10966 SNPrintF(buf2, "%6d", entry.deoptimization_index()); |
| 11005 os << buf2.start(); | 10967 os << buf2.start(); |
| 11006 } else { | 10968 } else { |
| 11007 os << "<none>"; | 10969 os << "<none>"; |
| 11008 } | 10970 } |
| 10971 if (entry.deoptimization_pc() != Safepoint::kNoDeoptimizationPc) { |
| 10972 Vector<char> buf2 = Vector<char>::New(30); |
| 10973 SNPrintF(buf2, "%6d", entry.deoptimization_pc()); |
| 10974 os << buf2.start(); |
| 10975 } else { |
| 10976 os << "<none>"; |
| 10977 } |
| 11009 if (entry.argument_count() > 0) { | 10978 if (entry.argument_count() > 0) { |
| 11010 os << " argc: " << entry.argument_count(); | 10979 os << " argc: " << entry.argument_count(); |
| 11011 } | 10980 } |
| 11012 os << "\n"; | 10981 os << "\n"; |
| 11013 } | 10982 } |
| 11014 os << "\n"; | 10983 os << "\n"; |
| 11015 } else if (kind() == FUNCTION) { | 10984 } else if (kind() == FUNCTION) { |
| 11016 unsigned offset = back_edge_table_offset(); | 10985 unsigned offset = back_edge_table_offset(); |
| 11017 // If there is no back edge table, the "table start" will be at or after | 10986 // If there is no back edge table, the "table start" will be at or after |
| 11018 // (due to alignment) the end of the instruction stream. | 10987 // (due to alignment) the end of the instruction stream. |
| (...skipping 5453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16472 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16441 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16473 static const char* error_messages_[] = { | 16442 static const char* error_messages_[] = { |
| 16474 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16443 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16475 }; | 16444 }; |
| 16476 #undef ERROR_MESSAGES_TEXTS | 16445 #undef ERROR_MESSAGES_TEXTS |
| 16477 return error_messages_[reason]; | 16446 return error_messages_[reason]; |
| 16478 } | 16447 } |
| 16479 | 16448 |
| 16480 | 16449 |
| 16481 } } // namespace v8::internal | 16450 } } // namespace v8::internal |
| OLD | NEW |