| 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 14480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14491 if (target->is_inline_cache_stub()) { | 14491 if (target->is_inline_cache_stub()) { |
| 14492 if (kind == NULL || *kind == target->kind()) { | 14492 if (kind == NULL || *kind == target->kind()) { |
| 14493 IC::Clear(this->GetIsolate(), info->pc(), | 14493 IC::Clear(this->GetIsolate(), info->pc(), |
| 14494 info->host()->constant_pool()); | 14494 info->host()->constant_pool()); |
| 14495 } | 14495 } |
| 14496 } | 14496 } |
| 14497 } | 14497 } |
| 14498 } | 14498 } |
| 14499 | 14499 |
| 14500 int AbstractCode::SourcePosition(int offset) { | 14500 int AbstractCode::SourcePosition(int offset) { |
| 14501 if (IsBytecodeArray()) return GetBytecodeArray()->SourcePosition(offset); | 14501 return IsBytecodeArray() ? GetBytecodeArray()->SourcePosition(offset) |
| 14502 return GetCode()->SourcePosition(offset); | 14502 : GetCode()->SourcePosition(offset); |
| 14503 } |
| 14504 |
| 14505 int AbstractCode::SourceStatementPosition(int offset) { |
| 14506 return IsBytecodeArray() ? GetBytecodeArray()->SourceStatementPosition(offset) |
| 14507 : GetCode()->SourceStatementPosition(offset); |
| 14503 } | 14508 } |
| 14504 | 14509 |
| 14505 void SharedFunctionInfo::ClearTypeFeedbackInfo() { | 14510 void SharedFunctionInfo::ClearTypeFeedbackInfo() { |
| 14506 feedback_vector()->ClearSlots(this); | 14511 feedback_vector()->ClearSlots(this); |
| 14507 } | 14512 } |
| 14508 | 14513 |
| 14509 | 14514 |
| 14510 void SharedFunctionInfo::ClearTypeFeedbackInfoAtGCTime() { | 14515 void SharedFunctionInfo::ClearTypeFeedbackInfoAtGCTime() { |
| 14511 feedback_vector()->ClearSlotsAtGCTime(this); | 14516 feedback_vector()->ClearSlotsAtGCTime(this); |
| 14512 } | 14517 } |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15187 | 15192 |
| 15188 os << "RelocInfo (size = " << relocation_size() << ")\n"; | 15193 os << "RelocInfo (size = " << relocation_size() << ")\n"; |
| 15189 for (RelocIterator it(this); !it.done(); it.next()) { | 15194 for (RelocIterator it(this); !it.done(); it.next()) { |
| 15190 it.rinfo()->Print(GetIsolate(), os); | 15195 it.rinfo()->Print(GetIsolate(), os); |
| 15191 } | 15196 } |
| 15192 os << "\n"; | 15197 os << "\n"; |
| 15193 } | 15198 } |
| 15194 #endif // ENABLE_DISASSEMBLER | 15199 #endif // ENABLE_DISASSEMBLER |
| 15195 | 15200 |
| 15196 int BytecodeArray::SourcePosition(int offset) { | 15201 int BytecodeArray::SourcePosition(int offset) { |
| 15197 return interpreter::SourcePositionTableIterator::PositionFromBytecodeOffset( | 15202 int last_position = 0; |
| 15198 this, offset); | 15203 for (interpreter::SourcePositionTableIterator iterator(this); |
| 15204 !iterator.done() && iterator.bytecode_offset() <= offset; |
| 15205 iterator.Advance()) { |
| 15206 last_position = iterator.source_position(); |
| 15207 } |
| 15208 return last_position; |
| 15209 } |
| 15210 |
| 15211 int BytecodeArray::SourceStatementPosition(int offset) { |
| 15212 // First find the position as close as possible using all position |
| 15213 // information. |
| 15214 int position = SourcePosition(offset); |
| 15215 // Now find the closest statement position before the position. |
| 15216 int statement_position = 0; |
| 15217 interpreter::SourcePositionTableIterator iterator(this); |
| 15218 while (!iterator.done()) { |
| 15219 if (iterator.is_statement()) { |
| 15220 int p = iterator.source_position(); |
| 15221 if (statement_position < p && p <= position) { |
| 15222 statement_position = p; |
| 15223 } |
| 15224 } |
| 15225 iterator.Advance(); |
| 15226 } |
| 15227 return statement_position; |
| 15199 } | 15228 } |
| 15200 | 15229 |
| 15201 void BytecodeArray::Disassemble(std::ostream& os) { | 15230 void BytecodeArray::Disassemble(std::ostream& os) { |
| 15202 os << "Parameter count " << parameter_count() << "\n"; | 15231 os << "Parameter count " << parameter_count() << "\n"; |
| 15203 os << "Frame size " << frame_size() << "\n"; | 15232 os << "Frame size " << frame_size() << "\n"; |
| 15204 Vector<char> buf = Vector<char>::New(50); | 15233 Vector<char> buf = Vector<char>::New(50); |
| 15205 | 15234 |
| 15206 const uint8_t* first_bytecode_address = GetFirstBytecodeAddress(); | 15235 const uint8_t* first_bytecode_address = GetFirstBytecodeAddress(); |
| 15207 int bytecode_size = 0; | 15236 int bytecode_size = 0; |
| 15208 | 15237 |
| (...skipping 4753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19962 if (cell->value() != *new_value) { | 19991 if (cell->value() != *new_value) { |
| 19963 cell->set_value(*new_value); | 19992 cell->set_value(*new_value); |
| 19964 Isolate* isolate = cell->GetIsolate(); | 19993 Isolate* isolate = cell->GetIsolate(); |
| 19965 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19994 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 19966 isolate, DependentCode::kPropertyCellChangedGroup); | 19995 isolate, DependentCode::kPropertyCellChangedGroup); |
| 19967 } | 19996 } |
| 19968 } | 19997 } |
| 19969 | 19998 |
| 19970 } // namespace internal | 19999 } // namespace internal |
| 19971 } // namespace v8 | 20000 } // namespace v8 |
| OLD | NEW |