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