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 12 matching lines...) Expand all Loading... |
23 #include "src/debug/debug.h" | 23 #include "src/debug/debug.h" |
24 #include "src/deoptimizer.h" | 24 #include "src/deoptimizer.h" |
25 #include "src/elements.h" | 25 #include "src/elements.h" |
26 #include "src/execution.h" | 26 #include "src/execution.h" |
27 #include "src/field-index.h" | 27 #include "src/field-index.h" |
28 #include "src/field-index-inl.h" | 28 #include "src/field-index-inl.h" |
29 #include "src/full-codegen/full-codegen.h" | 29 #include "src/full-codegen/full-codegen.h" |
30 #include "src/ic/ic.h" | 30 #include "src/ic/ic.h" |
31 #include "src/identity-map.h" | 31 #include "src/identity-map.h" |
32 #include "src/interpreter/bytecodes.h" | 32 #include "src/interpreter/bytecodes.h" |
| 33 #include "src/interpreter/source-position-table.h" |
33 #include "src/isolate-inl.h" | 34 #include "src/isolate-inl.h" |
34 #include "src/key-accumulator.h" | 35 #include "src/key-accumulator.h" |
35 #include "src/list.h" | 36 #include "src/list.h" |
36 #include "src/log.h" | 37 #include "src/log.h" |
37 #include "src/lookup.h" | 38 #include "src/lookup.h" |
38 #include "src/macro-assembler.h" | 39 #include "src/macro-assembler.h" |
39 #include "src/messages.h" | 40 #include "src/messages.h" |
40 #include "src/objects-inl.h" | 41 #include "src/objects-inl.h" |
41 #include "src/objects-body-descriptors-inl.h" | 42 #include "src/objects-body-descriptors-inl.h" |
42 #include "src/profiler/cpu-profiler.h" | 43 #include "src/profiler/cpu-profiler.h" |
(...skipping 14975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15018 | 15019 |
15019 os << "RelocInfo (size = " << relocation_size() << ")\n"; | 15020 os << "RelocInfo (size = " << relocation_size() << ")\n"; |
15020 for (RelocIterator it(this); !it.done(); it.next()) { | 15021 for (RelocIterator it(this); !it.done(); it.next()) { |
15021 it.rinfo()->Print(GetIsolate(), os); | 15022 it.rinfo()->Print(GetIsolate(), os); |
15022 } | 15023 } |
15023 os << "\n"; | 15024 os << "\n"; |
15024 } | 15025 } |
15025 #endif // ENABLE_DISASSEMBLER | 15026 #endif // ENABLE_DISASSEMBLER |
15026 | 15027 |
15027 int BytecodeArray::SourcePosition(int offset) { | 15028 int BytecodeArray::SourcePosition(int offset) { |
15028 // TODO(yangguo): implement this. | 15029 return interpreter::SourcePositionTableIterator::PositionFromBytecodeOffset( |
15029 return 0; | 15030 this, offset); |
15030 } | 15031 } |
15031 | 15032 |
15032 void BytecodeArray::Disassemble(std::ostream& os) { | 15033 void BytecodeArray::Disassemble(std::ostream& os) { |
15033 os << "Parameter count " << parameter_count() << "\n"; | 15034 os << "Parameter count " << parameter_count() << "\n"; |
15034 os << "Frame size " << frame_size() << "\n"; | 15035 os << "Frame size " << frame_size() << "\n"; |
15035 Vector<char> buf = Vector<char>::New(50); | 15036 Vector<char> buf = Vector<char>::New(50); |
15036 | 15037 |
15037 const uint8_t* first_bytecode_address = GetFirstBytecodeAddress(); | 15038 const uint8_t* first_bytecode_address = GetFirstBytecodeAddress(); |
15038 int bytecode_size = 0; | 15039 int bytecode_size = 0; |
| 15040 |
| 15041 interpreter::SourcePositionTableIterator source_positions(this); |
| 15042 |
15039 for (int i = 0; i < this->length(); i += bytecode_size) { | 15043 for (int i = 0; i < this->length(); i += bytecode_size) { |
15040 const uint8_t* bytecode_start = &first_bytecode_address[i]; | 15044 const uint8_t* bytecode_start = &first_bytecode_address[i]; |
15041 interpreter::Bytecode bytecode = | 15045 interpreter::Bytecode bytecode = |
15042 interpreter::Bytecodes::FromByte(bytecode_start[0]); | 15046 interpreter::Bytecodes::FromByte(bytecode_start[0]); |
15043 bytecode_size = interpreter::Bytecodes::Size(bytecode); | 15047 bytecode_size = interpreter::Bytecodes::Size(bytecode); |
15044 | 15048 |
| 15049 if (!source_positions.done() && i == source_positions.bytecode_offset()) { |
| 15050 os << std::setw(5) << source_positions.source_position(); |
| 15051 os << (source_positions.is_statement() ? " S> " : " E> "); |
| 15052 source_positions.Advance(); |
| 15053 } else { |
| 15054 os << " "; |
| 15055 } |
| 15056 |
15045 SNPrintF(buf, "%p", bytecode_start); | 15057 SNPrintF(buf, "%p", bytecode_start); |
15046 os << buf.start() << " : "; | 15058 os << buf.start() << " : "; |
15047 interpreter::Bytecodes::Decode(os, bytecode_start, parameter_count()); | 15059 interpreter::Bytecodes::Decode(os, bytecode_start, parameter_count()); |
15048 | 15060 |
15049 if (interpreter::Bytecodes::IsJumpConstantWide(bytecode)) { | 15061 if (interpreter::Bytecodes::IsJumpConstantWide(bytecode)) { |
15050 DCHECK_EQ(bytecode_size, 3); | 15062 DCHECK_EQ(bytecode_size, 3); |
15051 int index = static_cast<int>(ReadUnalignedUInt16(bytecode_start + 1)); | 15063 int index = static_cast<int>(ReadUnalignedUInt16(bytecode_start + 1)); |
15052 int offset = Smi::cast(constant_pool()->get(index))->value(); | 15064 int offset = Smi::cast(constant_pool()->get(index))->value(); |
15053 SNPrintF(buf, " (%p)", bytecode_start + offset); | 15065 SNPrintF(buf, " (%p)", bytecode_start + offset); |
15054 os << buf.start(); | 15066 os << buf.start(); |
15055 } else if (interpreter::Bytecodes::IsJumpConstant(bytecode)) { | 15067 } else if (interpreter::Bytecodes::IsJumpConstant(bytecode)) { |
15056 DCHECK_EQ(bytecode_size, 2); | 15068 DCHECK_EQ(bytecode_size, 2); |
15057 int index = static_cast<int>(bytecode_start[1]); | 15069 int index = static_cast<int>(bytecode_start[1]); |
15058 int offset = Smi::cast(constant_pool()->get(index))->value(); | 15070 int offset = Smi::cast(constant_pool()->get(index))->value(); |
15059 SNPrintF(buf, " (%p)", bytecode_start + offset); | 15071 SNPrintF(buf, " (%p)", bytecode_start + offset); |
15060 os << buf.start(); | 15072 os << buf.start(); |
15061 } else if (interpreter::Bytecodes::IsJump(bytecode)) { | 15073 } else if (interpreter::Bytecodes::IsJump(bytecode)) { |
15062 DCHECK_EQ(bytecode_size, 2); | 15074 DCHECK_EQ(bytecode_size, 2); |
15063 int offset = static_cast<int8_t>(bytecode_start[1]); | 15075 int offset = static_cast<int8_t>(bytecode_start[1]); |
15064 SNPrintF(buf, " (%p)", bytecode_start + offset); | 15076 SNPrintF(buf, " (%p)", bytecode_start + offset); |
15065 os << buf.start(); | 15077 os << buf.start(); |
15066 } | 15078 } |
15067 os << "\n"; | 15079 |
| 15080 os << std::endl; |
15068 } | 15081 } |
15069 | 15082 |
15070 if (constant_pool()->length() > 0) { | 15083 if (constant_pool()->length() > 0) { |
15071 os << "Constant pool (size = " << constant_pool()->length() << ")\n"; | 15084 os << "Constant pool (size = " << constant_pool()->length() << ")\n"; |
15072 constant_pool()->Print(); | 15085 constant_pool()->Print(); |
15073 } | 15086 } |
15074 | 15087 |
15075 #ifdef ENABLE_DISASSEMBLER | 15088 #ifdef ENABLE_DISASSEMBLER |
15076 if (handler_table()->length() > 0) { | 15089 if (handler_table()->length() > 0) { |
15077 os << "Handler Table (size = " << handler_table()->Size() << ")\n"; | 15090 os << "Handler Table (size = " << handler_table()->Size() << ")\n"; |
(...skipping 4692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19770 if (cell->value() != *new_value) { | 19783 if (cell->value() != *new_value) { |
19771 cell->set_value(*new_value); | 19784 cell->set_value(*new_value); |
19772 Isolate* isolate = cell->GetIsolate(); | 19785 Isolate* isolate = cell->GetIsolate(); |
19773 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19786 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19774 isolate, DependentCode::kPropertyCellChangedGroup); | 19787 isolate, DependentCode::kPropertyCellChangedGroup); |
19775 } | 19788 } |
19776 } | 19789 } |
19777 | 19790 |
19778 } // namespace internal | 19791 } // namespace internal |
19779 } // namespace v8 | 19792 } // namespace v8 |
OLD | NEW |