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 15161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15172 os << "RelocInfo (size = " << relocation_size() << ")\n"; | 15172 os << "RelocInfo (size = " << relocation_size() << ")\n"; |
15173 for (RelocIterator it(this); !it.done(); it.next()) { | 15173 for (RelocIterator it(this); !it.done(); it.next()) { |
15174 it.rinfo()->Print(GetIsolate(), os); | 15174 it.rinfo()->Print(GetIsolate(), os); |
15175 } | 15175 } |
15176 os << "\n"; | 15176 os << "\n"; |
15177 } | 15177 } |
15178 #endif // ENABLE_DISASSEMBLER | 15178 #endif // ENABLE_DISASSEMBLER |
15179 | 15179 |
15180 int BytecodeArray::SourcePosition(int offset) { | 15180 int BytecodeArray::SourcePosition(int offset) { |
15181 int last_position = 0; | 15181 int last_position = 0; |
15182 for (interpreter::SourcePositionTableIterator iterator(this); | 15182 for (interpreter::SourcePositionTableIterator iterator( |
| 15183 source_position_table()); |
15183 !iterator.done() && iterator.bytecode_offset() <= offset; | 15184 !iterator.done() && iterator.bytecode_offset() <= offset; |
15184 iterator.Advance()) { | 15185 iterator.Advance()) { |
15185 last_position = iterator.source_position(); | 15186 last_position = iterator.source_position(); |
15186 } | 15187 } |
15187 return last_position; | 15188 return last_position; |
15188 } | 15189 } |
15189 | 15190 |
15190 int BytecodeArray::SourceStatementPosition(int offset) { | 15191 int BytecodeArray::SourceStatementPosition(int offset) { |
15191 // First find the position as close as possible using all position | 15192 // First find the position as close as possible using all position |
15192 // information. | 15193 // information. |
15193 int position = SourcePosition(offset); | 15194 int position = SourcePosition(offset); |
15194 // Now find the closest statement position before the position. | 15195 // Now find the closest statement position before the position. |
15195 int statement_position = 0; | 15196 int statement_position = 0; |
15196 interpreter::SourcePositionTableIterator iterator(this); | 15197 interpreter::SourcePositionTableIterator iterator(source_position_table()); |
15197 while (!iterator.done()) { | 15198 while (!iterator.done()) { |
15198 if (iterator.is_statement()) { | 15199 if (iterator.is_statement()) { |
15199 int p = iterator.source_position(); | 15200 int p = iterator.source_position(); |
15200 if (statement_position < p && p <= position) { | 15201 if (statement_position < p && p <= position) { |
15201 statement_position = p; | 15202 statement_position = p; |
15202 } | 15203 } |
15203 } | 15204 } |
15204 iterator.Advance(); | 15205 iterator.Advance(); |
15205 } | 15206 } |
15206 return statement_position; | 15207 return statement_position; |
15207 } | 15208 } |
15208 | 15209 |
15209 void BytecodeArray::Disassemble(std::ostream& os) { | 15210 void BytecodeArray::Disassemble(std::ostream& os) { |
15210 os << "Parameter count " << parameter_count() << "\n"; | 15211 os << "Parameter count " << parameter_count() << "\n"; |
15211 os << "Frame size " << frame_size() << "\n"; | 15212 os << "Frame size " << frame_size() << "\n"; |
15212 Vector<char> buf = Vector<char>::New(50); | 15213 Vector<char> buf = Vector<char>::New(50); |
15213 | 15214 |
15214 const uint8_t* first_bytecode_address = GetFirstBytecodeAddress(); | 15215 const uint8_t* first_bytecode_address = GetFirstBytecodeAddress(); |
15215 int bytecode_size = 0; | 15216 int bytecode_size = 0; |
15216 | 15217 |
15217 interpreter::SourcePositionTableIterator source_positions(this); | 15218 interpreter::SourcePositionTableIterator source_positions( |
| 15219 source_position_table()); |
15218 | 15220 |
15219 for (int i = 0; i < this->length(); i += bytecode_size) { | 15221 for (int i = 0; i < this->length(); i += bytecode_size) { |
15220 const uint8_t* bytecode_start = &first_bytecode_address[i]; | 15222 const uint8_t* bytecode_start = &first_bytecode_address[i]; |
15221 interpreter::Bytecode bytecode = | 15223 interpreter::Bytecode bytecode = |
15222 interpreter::Bytecodes::FromByte(bytecode_start[0]); | 15224 interpreter::Bytecodes::FromByte(bytecode_start[0]); |
15223 bytecode_size = interpreter::Bytecodes::Size(bytecode); | 15225 bytecode_size = interpreter::Bytecodes::Size(bytecode); |
15224 | 15226 |
15225 if (!source_positions.done() && i == source_positions.bytecode_offset()) { | 15227 if (!source_positions.done() && i == source_positions.bytecode_offset()) { |
15226 os << std::setw(5) << source_positions.source_position(); | 15228 os << std::setw(5) << source_positions.source_position(); |
15227 os << (source_positions.is_statement() ? " S> " : " E> "); | 15229 os << (source_positions.is_statement() ? " S> " : " E> "); |
(...skipping 4742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19970 if (cell->value() != *new_value) { | 19972 if (cell->value() != *new_value) { |
19971 cell->set_value(*new_value); | 19973 cell->set_value(*new_value); |
19972 Isolate* isolate = cell->GetIsolate(); | 19974 Isolate* isolate = cell->GetIsolate(); |
19973 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19975 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19974 isolate, DependentCode::kPropertyCellChangedGroup); | 19976 isolate, DependentCode::kPropertyCellChangedGroup); |
19975 } | 19977 } |
19976 } | 19978 } |
19977 | 19979 |
19978 } // namespace internal | 19980 } // namespace internal |
19979 } // namespace v8 | 19981 } // namespace v8 |
OLD | NEW |