OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 14488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14499 DCHECK(kind() == OPTIMIZED_FUNCTION); | 14499 DCHECK(kind() == OPTIMIZED_FUNCTION); |
14500 Object* weak_cell_cache = | 14500 Object* weak_cell_cache = |
14501 DeoptimizationInputData::cast(deoptimization_data())->WeakCellCache(); | 14501 DeoptimizationInputData::cast(deoptimization_data())->WeakCellCache(); |
14502 if (weak_cell_cache->IsWeakCell()) { | 14502 if (weak_cell_cache->IsWeakCell()) { |
14503 DCHECK(this == WeakCell::cast(weak_cell_cache)->value()); | 14503 DCHECK(this == WeakCell::cast(weak_cell_cache)->value()); |
14504 return WeakCell::cast(weak_cell_cache); | 14504 return WeakCell::cast(weak_cell_cache); |
14505 } | 14505 } |
14506 return NULL; | 14506 return NULL; |
14507 } | 14507 } |
14508 | 14508 |
| 14509 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) |
| 14510 |
| 14511 const char* Code::ICState2String(InlineCacheState state) { |
| 14512 switch (state) { |
| 14513 case UNINITIALIZED: |
| 14514 return "UNINITIALIZED"; |
| 14515 case PREMONOMORPHIC: |
| 14516 return "PREMONOMORPHIC"; |
| 14517 case MONOMORPHIC: |
| 14518 return "MONOMORPHIC"; |
| 14519 case RECOMPUTE_HANDLER: |
| 14520 return "RECOMPUTE_HANDLER"; |
| 14521 case POLYMORPHIC: |
| 14522 return "POLYMORPHIC"; |
| 14523 case MEGAMORPHIC: |
| 14524 return "MEGAMORPHIC"; |
| 14525 case GENERIC: |
| 14526 return "GENERIC"; |
| 14527 } |
| 14528 UNREACHABLE(); |
| 14529 return NULL; |
| 14530 } |
| 14531 |
| 14532 void Code::PrintExtraICState(std::ostream& os, // NOLINT |
| 14533 Kind kind, ExtraICState extra) { |
| 14534 os << "extra_ic_state = "; |
| 14535 if ((kind == STORE_IC || kind == KEYED_STORE_IC) && |
| 14536 is_strict(static_cast<LanguageMode>(extra))) { |
| 14537 os << "STRICT\n"; |
| 14538 } else { |
| 14539 os << extra << "\n"; |
| 14540 } |
| 14541 } |
| 14542 |
| 14543 #endif // defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) |
| 14544 |
14509 #ifdef ENABLE_DISASSEMBLER | 14545 #ifdef ENABLE_DISASSEMBLER |
14510 | 14546 |
14511 void DeoptimizationInputData::DeoptimizationInputDataPrint( | 14547 void DeoptimizationInputData::DeoptimizationInputDataPrint( |
14512 std::ostream& os) { // NOLINT | 14548 std::ostream& os) { // NOLINT |
14513 disasm::NameConverter converter; | 14549 disasm::NameConverter converter; |
14514 int const inlined_function_count = InlinedFunctionCount()->value(); | 14550 int const inlined_function_count = InlinedFunctionCount()->value(); |
14515 os << "Inlined functions (count = " << inlined_function_count << ")\n"; | 14551 os << "Inlined functions (count = " << inlined_function_count << ")\n"; |
14516 for (int id = 0; id < inlined_function_count; ++id) { | 14552 for (int id = 0; id < inlined_function_count; ++id) { |
14517 Object* info = LiteralArray()->get(id); | 14553 Object* info = LiteralArray()->get(id); |
14518 os << " " << Brief(SharedFunctionInfo::cast(info)) << "\n"; | 14554 os << " " << Brief(SharedFunctionInfo::cast(info)) << "\n"; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14755 int pc_offset = Smi::cast(get(i + kReturnOffsetIndex))->value(); | 14791 int pc_offset = Smi::cast(get(i + kReturnOffsetIndex))->value(); |
14756 int handler_field = Smi::cast(get(i + kReturnHandlerIndex))->value(); | 14792 int handler_field = Smi::cast(get(i + kReturnHandlerIndex))->value(); |
14757 int handler_offset = HandlerOffsetField::decode(handler_field); | 14793 int handler_offset = HandlerOffsetField::decode(handler_field); |
14758 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); | 14794 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); |
14759 os << " " << std::setw(4) << pc_offset << " -> " << std::setw(4) | 14795 os << " " << std::setw(4) << pc_offset << " -> " << std::setw(4) |
14760 << handler_offset << " (prediction=" << prediction << ")\n"; | 14796 << handler_offset << " (prediction=" << prediction << ")\n"; |
14761 } | 14797 } |
14762 } | 14798 } |
14763 | 14799 |
14764 | 14800 |
14765 const char* Code::ICState2String(InlineCacheState state) { | |
14766 switch (state) { | |
14767 case UNINITIALIZED: return "UNINITIALIZED"; | |
14768 case PREMONOMORPHIC: return "PREMONOMORPHIC"; | |
14769 case MONOMORPHIC: return "MONOMORPHIC"; | |
14770 case RECOMPUTE_HANDLER: | |
14771 return "RECOMPUTE_HANDLER"; | |
14772 case POLYMORPHIC: return "POLYMORPHIC"; | |
14773 case MEGAMORPHIC: return "MEGAMORPHIC"; | |
14774 case GENERIC: return "GENERIC"; | |
14775 } | |
14776 UNREACHABLE(); | |
14777 return NULL; | |
14778 } | |
14779 | |
14780 | |
14781 void Code::PrintExtraICState(std::ostream& os, // NOLINT | |
14782 Kind kind, ExtraICState extra) { | |
14783 os << "extra_ic_state = "; | |
14784 if ((kind == STORE_IC || kind == KEYED_STORE_IC) && | |
14785 is_strict(static_cast<LanguageMode>(extra))) { | |
14786 os << "STRICT\n"; | |
14787 } else { | |
14788 os << extra << "\n"; | |
14789 } | |
14790 } | |
14791 | |
14792 | |
14793 void Code::Disassemble(const char* name, std::ostream& os) { // NOLINT | 14801 void Code::Disassemble(const char* name, std::ostream& os) { // NOLINT |
14794 os << "kind = " << Kind2String(kind()) << "\n"; | 14802 os << "kind = " << Kind2String(kind()) << "\n"; |
14795 if (IsCodeStubOrIC()) { | 14803 if (IsCodeStubOrIC()) { |
14796 const char* n = CodeStub::MajorName(CodeStub::GetMajorKey(this)); | 14804 const char* n = CodeStub::MajorName(CodeStub::GetMajorKey(this)); |
14797 os << "major_key = " << (n == NULL ? "null" : n) << "\n"; | 14805 os << "major_key = " << (n == NULL ? "null" : n) << "\n"; |
14798 } | 14806 } |
14799 if (is_inline_cache_stub()) { | 14807 if (is_inline_cache_stub()) { |
14800 if (!IC::ICUseVector(kind())) { | 14808 if (!IC::ICUseVector(kind())) { |
14801 InlineCacheState ic_state = IC::StateFromCode(this); | 14809 InlineCacheState ic_state = IC::StateFromCode(this); |
14802 os << "ic_state = " << ICState2String(ic_state) << "\n"; | 14810 os << "ic_state = " << ICState2String(ic_state) << "\n"; |
(...skipping 5376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20179 ns, Accessors::ModuleNamespaceEntryInfo(isolate, name, attr)) | 20187 ns, Accessors::ModuleNamespaceEntryInfo(isolate, name, attr)) |
20180 .Check(); | 20188 .Check(); |
20181 } | 20189 } |
20182 JSObject::PreventExtensions(ns, THROW_ON_ERROR).ToChecked(); | 20190 JSObject::PreventExtensions(ns, THROW_ON_ERROR).ToChecked(); |
20183 | 20191 |
20184 return ns; | 20192 return ns; |
20185 } | 20193 } |
20186 | 20194 |
20187 } // namespace internal | 20195 } // namespace internal |
20188 } // namespace v8 | 20196 } // namespace v8 |
OLD | NEW |