| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/heap/mark-compact.h" | 5 #include "src/heap/mark-compact.h" |
| 6 | 6 |
| 7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/base/sys-info.h" | 9 #include "src/base/sys-info.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 | 1239 |
| 1240 // Works by setting the current sweep_generation (as a smi) in the | 1240 // Works by setting the current sweep_generation (as a smi) in the |
| 1241 // code object place in the data array of the RegExp and keeps a copy | 1241 // code object place in the data array of the RegExp and keeps a copy |
| 1242 // around that can be reinstated if we reuse the RegExp before flushing. | 1242 // around that can be reinstated if we reuse the RegExp before flushing. |
| 1243 // If we did not use the code for kRegExpCodeThreshold mark sweep GCs | 1243 // If we did not use the code for kRegExpCodeThreshold mark sweep GCs |
| 1244 // we flush the code. | 1244 // we flush the code. |
| 1245 static void VisitRegExpAndFlushCode(Map* map, HeapObject* object) { | 1245 static void VisitRegExpAndFlushCode(Map* map, HeapObject* object) { |
| 1246 Heap* heap = map->GetHeap(); | 1246 Heap* heap = map->GetHeap(); |
| 1247 MarkCompactCollector* collector = heap->mark_compact_collector(); | 1247 MarkCompactCollector* collector = heap->mark_compact_collector(); |
| 1248 if (!collector->is_code_flushing_enabled()) { | 1248 if (!collector->is_code_flushing_enabled()) { |
| 1249 VisitJSRegExp(map, object); | 1249 JSObjectVisitor::Visit(map, object); |
| 1250 return; | 1250 return; |
| 1251 } | 1251 } |
| 1252 JSRegExp* re = reinterpret_cast<JSRegExp*>(object); | 1252 JSRegExp* re = reinterpret_cast<JSRegExp*>(object); |
| 1253 // Flush code or set age on both one byte and two byte code. | 1253 // Flush code or set age on both one byte and two byte code. |
| 1254 UpdateRegExpCodeAgeAndFlush(heap, re, true); | 1254 UpdateRegExpCodeAgeAndFlush(heap, re, true); |
| 1255 UpdateRegExpCodeAgeAndFlush(heap, re, false); | 1255 UpdateRegExpCodeAgeAndFlush(heap, re, false); |
| 1256 // Visit the fields of the RegExp, including the updated FixedArray. | 1256 // Visit the fields of the RegExp, including the updated FixedArray. |
| 1257 VisitJSRegExp(map, object); | 1257 JSObjectVisitor::Visit(map, object); |
| 1258 } | 1258 } |
| 1259 }; | 1259 }; |
| 1260 | 1260 |
| 1261 | 1261 |
| 1262 void MarkCompactMarkingVisitor::Initialize() { | 1262 void MarkCompactMarkingVisitor::Initialize() { |
| 1263 StaticMarkingVisitor<MarkCompactMarkingVisitor>::Initialize(); | 1263 StaticMarkingVisitor<MarkCompactMarkingVisitor>::Initialize(); |
| 1264 | 1264 |
| 1265 table_.Register(kVisitJSRegExp, &VisitRegExpAndFlushCode); | 1265 table_.Register(kVisitJSRegExp, &VisitRegExpAndFlushCode); |
| 1266 } | 1266 } |
| 1267 | 1267 |
| (...skipping 2730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3998 // The target is always in old space, we don't have to record the slot in | 3998 // The target is always in old space, we don't have to record the slot in |
| 3999 // the old-to-new remembered set. | 3999 // the old-to-new remembered set. |
| 4000 DCHECK(!heap()->InNewSpace(target)); | 4000 DCHECK(!heap()->InNewSpace(target)); |
| 4001 RecordRelocSlot(host, &rinfo, target); | 4001 RecordRelocSlot(host, &rinfo, target); |
| 4002 } | 4002 } |
| 4003 } | 4003 } |
| 4004 } | 4004 } |
| 4005 | 4005 |
| 4006 } // namespace internal | 4006 } // namespace internal |
| 4007 } // namespace v8 | 4007 } // namespace v8 |
| OLD | NEW |