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 14993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15036 | 15037 |
15037 os << "RelocInfo (size = " << relocation_size() << ")\n"; | 15038 os << "RelocInfo (size = " << relocation_size() << ")\n"; |
15038 for (RelocIterator it(this); !it.done(); it.next()) { | 15039 for (RelocIterator it(this); !it.done(); it.next()) { |
15039 it.rinfo()->Print(GetIsolate(), os); | 15040 it.rinfo()->Print(GetIsolate(), os); |
15040 } | 15041 } |
15041 os << "\n"; | 15042 os << "\n"; |
15042 } | 15043 } |
15043 #endif // ENABLE_DISASSEMBLER | 15044 #endif // ENABLE_DISASSEMBLER |
15044 | 15045 |
15045 int BytecodeArray::SourcePosition(int offset) { | 15046 int BytecodeArray::SourcePosition(int offset) { |
15046 // TODO(yangguo): implement this. | 15047 return interpreter::SourcePositionTableIterator::PositionFromBytecodeOffset( |
15047 return 0; | 15048 this, offset); |
15048 } | 15049 } |
15049 | 15050 |
15050 void BytecodeArray::Disassemble(std::ostream& os) { | 15051 void BytecodeArray::Disassemble(std::ostream& os) { |
15051 os << "Parameter count " << parameter_count() << "\n"; | 15052 os << "Parameter count " << parameter_count() << "\n"; |
15052 os << "Frame size " << frame_size() << "\n"; | 15053 os << "Frame size " << frame_size() << "\n"; |
15053 Vector<char> buf = Vector<char>::New(50); | 15054 Vector<char> buf = Vector<char>::New(50); |
15054 | 15055 |
15055 const uint8_t* first_bytecode_address = GetFirstBytecodeAddress(); | 15056 const uint8_t* first_bytecode_address = GetFirstBytecodeAddress(); |
15056 int bytecode_size = 0; | 15057 int bytecode_size = 0; |
| 15058 |
| 15059 interpreter::SourcePositionTableIterator source_positions(this); |
| 15060 source_positions.Next(); |
| 15061 |
15057 for (int i = 0; i < this->length(); i += bytecode_size) { | 15062 for (int i = 0; i < this->length(); i += bytecode_size) { |
15058 const uint8_t* bytecode_start = &first_bytecode_address[i]; | 15063 const uint8_t* bytecode_start = &first_bytecode_address[i]; |
15059 interpreter::Bytecode bytecode = | 15064 interpreter::Bytecode bytecode = |
15060 interpreter::Bytecodes::FromByte(bytecode_start[0]); | 15065 interpreter::Bytecodes::FromByte(bytecode_start[0]); |
15061 bytecode_size = interpreter::Bytecodes::Size(bytecode); | 15066 bytecode_size = interpreter::Bytecodes::Size(bytecode); |
15062 | 15067 |
| 15068 if (i == source_positions.bytecode_offset()) { |
| 15069 os << std::setw(5) << source_positions.source_position(); |
| 15070 os << (source_positions.is_statement() ? " S> " : " E> "); |
| 15071 source_positions.Next(); |
| 15072 } else { |
| 15073 os << " "; |
| 15074 } |
| 15075 |
15063 SNPrintF(buf, "%p", bytecode_start); | 15076 SNPrintF(buf, "%p", bytecode_start); |
15064 os << buf.start() << " : "; | 15077 os << buf.start() << " : "; |
15065 interpreter::Bytecodes::Decode(os, bytecode_start, parameter_count()); | 15078 interpreter::Bytecodes::Decode(os, bytecode_start, parameter_count()); |
15066 | 15079 |
15067 if (interpreter::Bytecodes::IsJumpConstantWide(bytecode)) { | 15080 if (interpreter::Bytecodes::IsJumpConstantWide(bytecode)) { |
15068 DCHECK_EQ(bytecode_size, 3); | 15081 DCHECK_EQ(bytecode_size, 3); |
15069 int index = static_cast<int>(ReadUnalignedUInt16(bytecode_start + 1)); | 15082 int index = static_cast<int>(ReadUnalignedUInt16(bytecode_start + 1)); |
15070 int offset = Smi::cast(constant_pool()->get(index))->value(); | 15083 int offset = Smi::cast(constant_pool()->get(index))->value(); |
15071 SNPrintF(buf, " (%p)", bytecode_start + offset); | 15084 SNPrintF(buf, " (%p)", bytecode_start + offset); |
15072 os << buf.start(); | 15085 os << buf.start(); |
15073 } else if (interpreter::Bytecodes::IsJumpConstant(bytecode)) { | 15086 } else if (interpreter::Bytecodes::IsJumpConstant(bytecode)) { |
15074 DCHECK_EQ(bytecode_size, 2); | 15087 DCHECK_EQ(bytecode_size, 2); |
15075 int index = static_cast<int>(bytecode_start[1]); | 15088 int index = static_cast<int>(bytecode_start[1]); |
15076 int offset = Smi::cast(constant_pool()->get(index))->value(); | 15089 int offset = Smi::cast(constant_pool()->get(index))->value(); |
15077 SNPrintF(buf, " (%p)", bytecode_start + offset); | 15090 SNPrintF(buf, " (%p)", bytecode_start + offset); |
15078 os << buf.start(); | 15091 os << buf.start(); |
15079 } else if (interpreter::Bytecodes::IsJump(bytecode)) { | 15092 } else if (interpreter::Bytecodes::IsJump(bytecode)) { |
15080 DCHECK_EQ(bytecode_size, 2); | 15093 DCHECK_EQ(bytecode_size, 2); |
15081 int offset = static_cast<int8_t>(bytecode_start[1]); | 15094 int offset = static_cast<int8_t>(bytecode_start[1]); |
15082 SNPrintF(buf, " (%p)", bytecode_start + offset); | 15095 SNPrintF(buf, " (%p)", bytecode_start + offset); |
15083 os << buf.start(); | 15096 os << buf.start(); |
15084 } | 15097 } |
15085 os << "\n"; | 15098 |
| 15099 os << std::endl; |
15086 } | 15100 } |
15087 | 15101 |
15088 if (constant_pool()->length() > 0) { | 15102 if (constant_pool()->length() > 0) { |
15089 os << "Constant pool (size = " << constant_pool()->length() << ")\n"; | 15103 os << "Constant pool (size = " << constant_pool()->length() << ")\n"; |
15090 constant_pool()->Print(); | 15104 constant_pool()->Print(); |
15091 } | 15105 } |
15092 | 15106 |
15093 #ifdef ENABLE_DISASSEMBLER | 15107 #ifdef ENABLE_DISASSEMBLER |
15094 if (handler_table()->length() > 0) { | 15108 if (handler_table()->length() > 0) { |
15095 os << "Handler Table (size = " << handler_table()->Size() << ")\n"; | 15109 os << "Handler Table (size = " << handler_table()->Size() << ")\n"; |
(...skipping 4692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19788 if (cell->value() != *new_value) { | 19802 if (cell->value() != *new_value) { |
19789 cell->set_value(*new_value); | 19803 cell->set_value(*new_value); |
19790 Isolate* isolate = cell->GetIsolate(); | 19804 Isolate* isolate = cell->GetIsolate(); |
19791 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19805 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19792 isolate, DependentCode::kPropertyCellChangedGroup); | 19806 isolate, DependentCode::kPropertyCellChangedGroup); |
19793 } | 19807 } |
19794 } | 19808 } |
19795 | 19809 |
19796 } // namespace internal | 19810 } // namespace internal |
19797 } // namespace v8 | 19811 } // namespace v8 |
OLD | NEW |