Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1418)

Unified Diff: src/heap/heap.cc

Issue 2702303002: [heap] Notify GC on potentially unsafe object layout changes. (Closed)
Patch Set: NULL -> nullptr Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/objects.h » ('j') | src/objects.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index a60b510492ab1762c59e538ebd56402428fd2082..2cc690366813c979256a17f04f6529fcaff79a7a 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -159,7 +159,8 @@ Heap::Heap()
local_embedder_heap_tracer_(nullptr),
fast_promotion_mode_(false),
force_oom_(false),
- delay_sweeper_tasks_for_testing_(false) {
+ delay_sweeper_tasks_for_testing_(false),
+ pending_layout_change_object_(nullptr) {
// Allow build-time customization of the max semispace size. Building
// V8 with snapshots and a non-default max semispace size is much
// easier if you can define it as part of the build environment.
@@ -4292,6 +4293,27 @@ void Heap::RegisterReservationsForBlackAllocation(Reservation* reservations) {
}
}
+void Heap::NotifyObjectLayoutChange(HeapObject* object,
Igor Sheludko 2017/02/21 10:22:25 WDYT about putting this to heap-inl.h?
+ const DisallowHeapAllocation&) {
+// TODO(ulan): Add synchronization with the concurrent marker.
+#ifdef VERIFY_HEAP
+ DCHECK(pending_layout_change_object_ == nullptr);
+ pending_layout_change_object_ = object;
+#endif
+}
+
+#ifdef VERIFY_HEAP
+void Heap::VerifyObjectLayoutChange(HeapObject* object, Map* new_map) {
+ if (pending_layout_change_object_ == nullptr) {
+ DCHECK(!object->IsJSObject() ||
+ !object->map()->TransitionRequiresSynchronizationWithGC(new_map));
+ } else {
+ DCHECK_EQ(pending_layout_change_object_, object);
+ pending_layout_change_object_ = nullptr;
+ }
+}
+#endif
+
GCIdleTimeHeapState Heap::ComputeHeapState() {
GCIdleTimeHeapState heap_state;
heap_state.contexts_disposed = contexts_disposed_;
« no previous file with comments | « src/heap/heap.h ('k') | src/objects.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698