| 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 <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "src/debug/debug.h" | 26 #include "src/debug/debug.h" |
| 27 #include "src/deoptimizer.h" | 27 #include "src/deoptimizer.h" |
| 28 #include "src/elements.h" | 28 #include "src/elements.h" |
| 29 #include "src/execution.h" | 29 #include "src/execution.h" |
| 30 #include "src/field-index-inl.h" | 30 #include "src/field-index-inl.h" |
| 31 #include "src/field-index.h" | 31 #include "src/field-index.h" |
| 32 #include "src/field-type.h" | 32 #include "src/field-type.h" |
| 33 #include "src/full-codegen/full-codegen.h" | 33 #include "src/full-codegen/full-codegen.h" |
| 34 #include "src/ic/ic.h" | 34 #include "src/ic/ic.h" |
| 35 #include "src/identity-map.h" | 35 #include "src/identity-map.h" |
| 36 #include "src/interpreter/bytecodes.h" | 36 #include "src/interpreter/bytecode-array-iterator.h" |
| 37 #include "src/interpreter/source-position-table.h" | 37 #include "src/interpreter/source-position-table.h" |
| 38 #include "src/isolate-inl.h" | 38 #include "src/isolate-inl.h" |
| 39 #include "src/keys.h" | 39 #include "src/keys.h" |
| 40 #include "src/list.h" | 40 #include "src/list.h" |
| 41 #include "src/log.h" | 41 #include "src/log.h" |
| 42 #include "src/lookup.h" | 42 #include "src/lookup.h" |
| 43 #include "src/macro-assembler.h" | 43 #include "src/macro-assembler.h" |
| 44 #include "src/messages.h" | 44 #include "src/messages.h" |
| 45 #include "src/objects-body-descriptors-inl.h" | 45 #include "src/objects-body-descriptors-inl.h" |
| 46 #include "src/profiler/cpu-profiler.h" | 46 #include "src/profiler/cpu-profiler.h" |
| (...skipping 14960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15007 iterator.Advance(); | 15007 iterator.Advance(); |
| 15008 } | 15008 } |
| 15009 return statement_position; | 15009 return statement_position; |
| 15010 } | 15010 } |
| 15011 | 15011 |
| 15012 void BytecodeArray::Disassemble(std::ostream& os) { | 15012 void BytecodeArray::Disassemble(std::ostream& os) { |
| 15013 os << "Parameter count " << parameter_count() << "\n"; | 15013 os << "Parameter count " << parameter_count() << "\n"; |
| 15014 os << "Frame size " << frame_size() << "\n"; | 15014 os << "Frame size " << frame_size() << "\n"; |
| 15015 Vector<char> buf = Vector<char>::New(50); | 15015 Vector<char> buf = Vector<char>::New(50); |
| 15016 | 15016 |
| 15017 const uint8_t* first_bytecode_address = GetFirstBytecodeAddress(); | 15017 const uint8_t* base_address = GetFirstBytecodeAddress(); |
| 15018 int bytecode_size = 0; | |
| 15019 | |
| 15020 interpreter::SourcePositionTableIterator source_positions( | 15018 interpreter::SourcePositionTableIterator source_positions( |
| 15021 source_position_table()); | 15019 source_position_table()); |
| 15022 | 15020 interpreter::BytecodeArrayIterator iterator(handle(this)); |
| 15023 for (int i = 0; i < this->length(); i += bytecode_size) { | 15021 while (!iterator.done()) { |
| 15024 const uint8_t* bytecode_start = &first_bytecode_address[i]; | 15022 if (!source_positions.done() && |
| 15025 interpreter::Bytecode bytecode = | 15023 iterator.current_offset() == source_positions.bytecode_offset()) { |
| 15026 interpreter::Bytecodes::FromByte(bytecode_start[0]); | |
| 15027 bytecode_size = interpreter::Bytecodes::Size(bytecode); | |
| 15028 | |
| 15029 if (!source_positions.done() && i == source_positions.bytecode_offset()) { | |
| 15030 os << std::setw(5) << source_positions.source_position(); | 15024 os << std::setw(5) << source_positions.source_position(); |
| 15031 os << (source_positions.is_statement() ? " S> " : " E> "); | 15025 os << (source_positions.is_statement() ? " S> " : " E> "); |
| 15032 source_positions.Advance(); | 15026 source_positions.Advance(); |
| 15033 } else { | 15027 } else { |
| 15034 os << " "; | 15028 os << " "; |
| 15035 } | 15029 } |
| 15036 | 15030 const uint8_t* current_address = base_address + iterator.current_offset(); |
| 15037 SNPrintF(buf, "%p", bytecode_start); | 15031 SNPrintF(buf, "%p", current_address); |
| 15038 os << buf.start() << " : "; | 15032 os << buf.start() << " : "; |
| 15039 interpreter::Bytecodes::Decode(os, bytecode_start, parameter_count()); | 15033 interpreter::Bytecodes::Decode(os, current_address, parameter_count()); |
| 15040 | 15034 if (interpreter::Bytecodes::IsJump(iterator.current_bytecode())) { |
| 15041 if (interpreter::Bytecodes::IsJumpConstantWide(bytecode)) { | 15035 SNPrintF(buf, " (%p)", base_address + iterator.GetJumpTargetOffset()); |
| 15042 DCHECK_EQ(bytecode_size, 3); | |
| 15043 int index = static_cast<int>(ReadUnalignedUInt16(bytecode_start + 1)); | |
| 15044 int offset = Smi::cast(constant_pool()->get(index))->value(); | |
| 15045 SNPrintF(buf, " (%p)", bytecode_start + offset); | |
| 15046 os << buf.start(); | |
| 15047 } else if (interpreter::Bytecodes::IsJumpConstant(bytecode)) { | |
| 15048 DCHECK_EQ(bytecode_size, 2); | |
| 15049 int index = static_cast<int>(bytecode_start[1]); | |
| 15050 int offset = Smi::cast(constant_pool()->get(index))->value(); | |
| 15051 SNPrintF(buf, " (%p)", bytecode_start + offset); | |
| 15052 os << buf.start(); | |
| 15053 } else if (interpreter::Bytecodes::IsJump(bytecode)) { | |
| 15054 DCHECK_EQ(bytecode_size, 2); | |
| 15055 int offset = static_cast<int8_t>(bytecode_start[1]); | |
| 15056 SNPrintF(buf, " (%p)", bytecode_start + offset); | |
| 15057 os << buf.start(); | 15036 os << buf.start(); |
| 15058 } | 15037 } |
| 15059 | |
| 15060 os << std::endl; | 15038 os << std::endl; |
| 15039 iterator.Advance(); |
| 15061 } | 15040 } |
| 15062 | 15041 |
| 15063 if (constant_pool()->length() > 0) { | 15042 if (constant_pool()->length() > 0) { |
| 15064 os << "Constant pool (size = " << constant_pool()->length() << ")\n"; | 15043 os << "Constant pool (size = " << constant_pool()->length() << ")\n"; |
| 15065 constant_pool()->Print(); | 15044 constant_pool()->Print(); |
| 15066 } | 15045 } |
| 15067 | 15046 |
| 15068 #ifdef ENABLE_DISASSEMBLER | 15047 #ifdef ENABLE_DISASSEMBLER |
| 15069 if (handler_table()->length() > 0) { | 15048 if (handler_table()->length() > 0) { |
| 15070 os << "Handler Table (size = " << handler_table()->Size() << ")\n"; | 15049 os << "Handler Table (size = " << handler_table()->Size() << ")\n"; |
| (...skipping 4713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19784 if (cell->value() != *new_value) { | 19763 if (cell->value() != *new_value) { |
| 19785 cell->set_value(*new_value); | 19764 cell->set_value(*new_value); |
| 19786 Isolate* isolate = cell->GetIsolate(); | 19765 Isolate* isolate = cell->GetIsolate(); |
| 19787 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19766 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 19788 isolate, DependentCode::kPropertyCellChangedGroup); | 19767 isolate, DependentCode::kPropertyCellChangedGroup); |
| 19789 } | 19768 } |
| 19790 } | 19769 } |
| 19791 | 19770 |
| 19792 } // namespace internal | 19771 } // namespace internal |
| 19793 } // namespace v8 | 19772 } // namespace v8 |
| OLD | NEW |