| 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 12960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12971 #define DECLARE_TAG(ignore1, ignore2, name) name, | 12971 #define DECLARE_TAG(ignore1, ignore2, name) name, |
| 12972 const char* const VisitorSynchronization::kTagNames[ | 12972 const char* const VisitorSynchronization::kTagNames[ |
| 12973 VisitorSynchronization::kNumberOfSyncTags] = { | 12973 VisitorSynchronization::kNumberOfSyncTags] = { |
| 12974 VISITOR_SYNCHRONIZATION_TAGS_LIST(DECLARE_TAG) | 12974 VISITOR_SYNCHRONIZATION_TAGS_LIST(DECLARE_TAG) |
| 12975 }; | 12975 }; |
| 12976 #undef DECLARE_TAG | 12976 #undef DECLARE_TAG |
| 12977 | 12977 |
| 12978 | 12978 |
| 12979 void ObjectVisitor::VisitCodeTarget(RelocInfo* rinfo) { | 12979 void ObjectVisitor::VisitCodeTarget(RelocInfo* rinfo) { |
| 12980 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode())); | 12980 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode())); |
| 12981 Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 12981 Object* old_pointer = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
| 12982 Object* old_target = target; | 12982 Object* new_pointer = old_pointer; |
| 12983 VisitPointer(&target); | 12983 VisitPointer(&new_pointer); |
| 12984 CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target. | 12984 DCHECK_EQ(old_pointer, new_pointer); |
| 12985 } | 12985 } |
| 12986 | 12986 |
| 12987 | 12987 |
| 12988 void ObjectVisitor::VisitCodeAgeSequence(RelocInfo* rinfo) { | 12988 void ObjectVisitor::VisitCodeAgeSequence(RelocInfo* rinfo) { |
| 12989 DCHECK(RelocInfo::IsCodeAgeSequence(rinfo->rmode())); | 12989 DCHECK(RelocInfo::IsCodeAgeSequence(rinfo->rmode())); |
| 12990 Object* stub = rinfo->code_age_stub(); | 12990 Object* old_pointer = rinfo->code_age_stub(); |
| 12991 if (stub) { | 12991 Object* new_pointer = old_pointer; |
| 12992 VisitPointer(&stub); | 12992 if (old_pointer != nullptr) { |
| 12993 VisitPointer(&new_pointer); |
| 12994 DCHECK_EQ(old_pointer, new_pointer); |
| 12993 } | 12995 } |
| 12994 } | 12996 } |
| 12995 | 12997 |
| 12996 | 12998 |
| 12997 void ObjectVisitor::VisitCodeEntry(Address entry_address) { | 12999 void ObjectVisitor::VisitCodeEntry(Address entry_address) { |
| 12998 Object* code = Code::GetObjectFromEntryAddress(entry_address); | 13000 Object* old_pointer = Code::GetObjectFromEntryAddress(entry_address); |
| 12999 Object* old_code = code; | 13001 Object* new_pointer = old_pointer; |
| 13000 VisitPointer(&code); | 13002 VisitPointer(&new_pointer); |
| 13001 if (code != old_code) { | 13003 DCHECK_EQ(old_pointer, new_pointer); |
| 13002 Memory::Address_at(entry_address) = reinterpret_cast<Code*>(code)->entry(); | |
| 13003 } | |
| 13004 } | 13004 } |
| 13005 | 13005 |
| 13006 | 13006 |
| 13007 void ObjectVisitor::VisitCell(RelocInfo* rinfo) { | 13007 void ObjectVisitor::VisitCell(RelocInfo* rinfo) { |
| 13008 DCHECK(rinfo->rmode() == RelocInfo::CELL); | 13008 DCHECK(rinfo->rmode() == RelocInfo::CELL); |
| 13009 Object* cell = rinfo->target_cell(); | 13009 Object* old_pointer = rinfo->target_cell(); |
| 13010 Object* old_cell = cell; | 13010 Object* new_pointer = old_pointer; |
| 13011 VisitPointer(&cell); | 13011 VisitPointer(&new_pointer); |
| 13012 if (cell != old_cell) { | 13012 DCHECK_EQ(old_pointer, new_pointer); |
| 13013 rinfo->set_target_cell(reinterpret_cast<Cell*>(cell)); | |
| 13014 } | |
| 13015 } | 13013 } |
| 13016 | 13014 |
| 13017 | 13015 |
| 13018 void ObjectVisitor::VisitDebugTarget(RelocInfo* rinfo) { | 13016 void ObjectVisitor::VisitDebugTarget(RelocInfo* rinfo) { |
| 13019 DCHECK(RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && | 13017 DCHECK(RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && |
| 13020 rinfo->IsPatchedDebugBreakSlotSequence()); | 13018 rinfo->IsPatchedDebugBreakSlotSequence()); |
| 13021 Object* target = Code::GetCodeFromTargetAddress(rinfo->debug_call_address()); | 13019 Object* old_pointer = |
| 13022 Object* old_target = target; | 13020 Code::GetCodeFromTargetAddress(rinfo->debug_call_address()); |
| 13023 VisitPointer(&target); | 13021 Object* new_pointer = old_pointer; |
| 13024 CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target. | 13022 VisitPointer(&new_pointer); |
| 13023 DCHECK_EQ(old_pointer, new_pointer); |
| 13025 } | 13024 } |
| 13026 | 13025 |
| 13027 | 13026 |
| 13028 void ObjectVisitor::VisitEmbeddedPointer(RelocInfo* rinfo) { | 13027 void ObjectVisitor::VisitEmbeddedPointer(RelocInfo* rinfo) { |
| 13029 DCHECK(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); | 13028 DCHECK(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); |
| 13030 Object* p = rinfo->target_object(); | 13029 Object* old_pointer = rinfo->target_object(); |
| 13031 VisitPointer(&p); | 13030 Object* new_pointer = old_pointer; |
| 13031 VisitPointer(&new_pointer); |
| 13032 DCHECK_EQ(old_pointer, new_pointer); |
| 13032 } | 13033 } |
| 13033 | 13034 |
| 13034 | 13035 |
| 13035 void ObjectVisitor::VisitExternalReference(RelocInfo* rinfo) { | 13036 void ObjectVisitor::VisitExternalReference(RelocInfo* rinfo) { |
| 13036 Address p = rinfo->target_external_reference(); | 13037 Address old_reference = rinfo->target_external_reference(); |
| 13037 VisitExternalReference(&p); | 13038 Address new_reference = old_reference; |
| 13039 VisitExternalReference(&new_reference); |
| 13040 DCHECK_EQ(old_reference, new_reference); |
| 13038 } | 13041 } |
| 13039 | 13042 |
| 13040 | 13043 |
| 13041 void Code::InvalidateRelocation() { | 13044 void Code::InvalidateRelocation() { |
| 13042 InvalidateEmbeddedObjects(); | 13045 InvalidateEmbeddedObjects(); |
| 13043 set_relocation_info(GetHeap()->empty_byte_array()); | 13046 set_relocation_info(GetHeap()->empty_byte_array()); |
| 13044 } | 13047 } |
| 13045 | 13048 |
| 13046 | 13049 |
| 13047 void Code::InvalidateEmbeddedObjects() { | 13050 void Code::InvalidateEmbeddedObjects() { |
| (...skipping 5333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18381 if (cell->value() != *new_value) { | 18384 if (cell->value() != *new_value) { |
| 18382 cell->set_value(*new_value); | 18385 cell->set_value(*new_value); |
| 18383 Isolate* isolate = cell->GetIsolate(); | 18386 Isolate* isolate = cell->GetIsolate(); |
| 18384 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 18387 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 18385 isolate, DependentCode::kPropertyCellChangedGroup); | 18388 isolate, DependentCode::kPropertyCellChangedGroup); |
| 18386 } | 18389 } |
| 18387 } | 18390 } |
| 18388 | 18391 |
| 18389 } // namespace internal | 18392 } // namespace internal |
| 18390 } // namespace v8 | 18393 } // namespace v8 |
| OLD | NEW |