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 15030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15041 os << "RelocInfo (size = " << relocation_size() << ")\n"; | 15041 os << "RelocInfo (size = " << relocation_size() << ")\n"; |
15042 for (RelocIterator it(this); !it.done(); it.next()) { | 15042 for (RelocIterator it(this); !it.done(); it.next()) { |
15043 it.rinfo()->Print(GetIsolate(), os); | 15043 it.rinfo()->Print(GetIsolate(), os); |
15044 } | 15044 } |
15045 os << "\n"; | 15045 os << "\n"; |
15046 } | 15046 } |
15047 #endif // ENABLE_DISASSEMBLER | 15047 #endif // ENABLE_DISASSEMBLER |
15048 | 15048 |
15049 int BytecodeArray::SourcePosition(int offset) { | 15049 int BytecodeArray::SourcePosition(int offset) { |
15050 int last_position = 0; | 15050 int last_position = 0; |
15051 for (interpreter::SourcePositionTableIterator iterator(this); | 15051 for (interpreter::SourcePositionTableIterator iterator( |
| 15052 source_position_table()); |
15052 !iterator.done() && iterator.bytecode_offset() <= offset; | 15053 !iterator.done() && iterator.bytecode_offset() <= offset; |
15053 iterator.Advance()) { | 15054 iterator.Advance()) { |
15054 last_position = iterator.source_position(); | 15055 last_position = iterator.source_position(); |
15055 } | 15056 } |
15056 return last_position; | 15057 return last_position; |
15057 } | 15058 } |
15058 | 15059 |
15059 int BytecodeArray::SourceStatementPosition(int offset) { | 15060 int BytecodeArray::SourceStatementPosition(int offset) { |
15060 // First find the position as close as possible using all position | 15061 // First find the position as close as possible using all position |
15061 // information. | 15062 // information. |
15062 int position = SourcePosition(offset); | 15063 int position = SourcePosition(offset); |
15063 // Now find the closest statement position before the position. | 15064 // Now find the closest statement position before the position. |
15064 int statement_position = 0; | 15065 int statement_position = 0; |
15065 interpreter::SourcePositionTableIterator iterator(this); | 15066 interpreter::SourcePositionTableIterator iterator(source_position_table()); |
15066 while (!iterator.done()) { | 15067 while (!iterator.done()) { |
15067 if (iterator.is_statement()) { | 15068 if (iterator.is_statement()) { |
15068 int p = iterator.source_position(); | 15069 int p = iterator.source_position(); |
15069 if (statement_position < p && p <= position) { | 15070 if (statement_position < p && p <= position) { |
15070 statement_position = p; | 15071 statement_position = p; |
15071 } | 15072 } |
15072 } | 15073 } |
15073 iterator.Advance(); | 15074 iterator.Advance(); |
15074 } | 15075 } |
15075 return statement_position; | 15076 return statement_position; |
15076 } | 15077 } |
15077 | 15078 |
15078 void BytecodeArray::Disassemble(std::ostream& os) { | 15079 void BytecodeArray::Disassemble(std::ostream& os) { |
15079 os << "Parameter count " << parameter_count() << "\n"; | 15080 os << "Parameter count " << parameter_count() << "\n"; |
15080 os << "Frame size " << frame_size() << "\n"; | 15081 os << "Frame size " << frame_size() << "\n"; |
15081 Vector<char> buf = Vector<char>::New(50); | 15082 Vector<char> buf = Vector<char>::New(50); |
15082 | 15083 |
15083 const uint8_t* first_bytecode_address = GetFirstBytecodeAddress(); | 15084 const uint8_t* first_bytecode_address = GetFirstBytecodeAddress(); |
15084 int bytecode_size = 0; | 15085 int bytecode_size = 0; |
15085 | 15086 |
15086 interpreter::SourcePositionTableIterator source_positions(this); | 15087 interpreter::SourcePositionTableIterator source_positions( |
| 15088 source_position_table()); |
15087 | 15089 |
15088 for (int i = 0; i < this->length(); i += bytecode_size) { | 15090 for (int i = 0; i < this->length(); i += bytecode_size) { |
15089 const uint8_t* bytecode_start = &first_bytecode_address[i]; | 15091 const uint8_t* bytecode_start = &first_bytecode_address[i]; |
15090 interpreter::Bytecode bytecode = | 15092 interpreter::Bytecode bytecode = |
15091 interpreter::Bytecodes::FromByte(bytecode_start[0]); | 15093 interpreter::Bytecodes::FromByte(bytecode_start[0]); |
15092 bytecode_size = interpreter::Bytecodes::Size(bytecode); | 15094 bytecode_size = interpreter::Bytecodes::Size(bytecode); |
15093 | 15095 |
15094 if (!source_positions.done() && i == source_positions.bytecode_offset()) { | 15096 if (!source_positions.done() && i == source_positions.bytecode_offset()) { |
15095 os << std::setw(5) << source_positions.source_position(); | 15097 os << std::setw(5) << source_positions.source_position(); |
15096 os << (source_positions.is_statement() ? " S> " : " E> "); | 15098 os << (source_positions.is_statement() ? " S> " : " E> "); |
(...skipping 4758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19855 if (cell->value() != *new_value) { | 19857 if (cell->value() != *new_value) { |
19856 cell->set_value(*new_value); | 19858 cell->set_value(*new_value); |
19857 Isolate* isolate = cell->GetIsolate(); | 19859 Isolate* isolate = cell->GetIsolate(); |
19858 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19860 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19859 isolate, DependentCode::kPropertyCellChangedGroup); | 19861 isolate, DependentCode::kPropertyCellChangedGroup); |
19860 } | 19862 } |
19861 } | 19863 } |
19862 | 19864 |
19863 } // namespace internal | 19865 } // namespace internal |
19864 } // namespace v8 | 19866 } // namespace v8 |
OLD | NEW |