OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 10806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10817 void Code::FindAndReplace(const FindAndReplacePattern& pattern) { | 10817 void Code::FindAndReplace(const FindAndReplacePattern& pattern) { |
10818 DCHECK(is_inline_cache_stub() || is_handler()); | 10818 DCHECK(is_inline_cache_stub() || is_handler()); |
10819 DisallowHeapAllocation no_allocation; | 10819 DisallowHeapAllocation no_allocation; |
10820 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 10820 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
10821 STATIC_ASSERT(FindAndReplacePattern::kMaxCount < 32); | 10821 STATIC_ASSERT(FindAndReplacePattern::kMaxCount < 32); |
10822 int current_pattern = 0; | 10822 int current_pattern = 0; |
10823 for (RelocIterator it(this, mask); !it.done(); it.next()) { | 10823 for (RelocIterator it(this, mask); !it.done(); it.next()) { |
10824 RelocInfo* info = it.rinfo(); | 10824 RelocInfo* info = it.rinfo(); |
10825 Object* object = info->target_object(); | 10825 Object* object = info->target_object(); |
10826 if (object->IsHeapObject()) { | 10826 if (object->IsHeapObject()) { |
10827 DCHECK(!object->IsWeakCell()); | 10827 if (object->IsWeakCell()) { |
| 10828 object = HeapObject::cast(WeakCell::cast(object)->value()); |
| 10829 } |
10828 Map* map = HeapObject::cast(object)->map(); | 10830 Map* map = HeapObject::cast(object)->map(); |
10829 if (map == *pattern.find_[current_pattern]) { | 10831 if (map == *pattern.find_[current_pattern]) { |
10830 info->set_target_object(*pattern.replace_[current_pattern]); | 10832 info->set_target_object(*pattern.replace_[current_pattern]); |
10831 if (++current_pattern == pattern.count_) return; | 10833 if (++current_pattern == pattern.count_) return; |
10832 } | 10834 } |
10833 } | 10835 } |
10834 } | 10836 } |
10835 UNREACHABLE(); | 10837 UNREACHABLE(); |
10836 } | 10838 } |
10837 | 10839 |
(...skipping 6266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17104 Handle<DependentCode> codes = | 17106 Handle<DependentCode> codes = |
17105 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 17107 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
17106 DependentCode::kPropertyCellChangedGroup, | 17108 DependentCode::kPropertyCellChangedGroup, |
17107 info->object_wrapper()); | 17109 info->object_wrapper()); |
17108 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 17110 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
17109 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 17111 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
17110 cell, info->zone()); | 17112 cell, info->zone()); |
17111 } | 17113 } |
17112 | 17114 |
17113 } } // namespace v8::internal | 17115 } } // namespace v8::internal |
OLD | NEW |