From e2b88eea9596b10772c959cf5bdcecd45423624b Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Thu, 10 Dec 2020 20:10:07 +0000 Subject: [PATCH] [vm] Fix gcc build. TEST=local build Change-Id: Ia4c28bda4b353e9f353ddbbf854df085adf831c1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175562 Reviewed-by: Liam Appelbe Commit-Queue: Ryan Macnak --- runtime/vm/raw_object.h | 66 ++++++++++++++++++------------------- runtime/vm/source_report.cc | 7 ---- 2 files changed, 32 insertions(+), 41 deletions(-) diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h index 15af026ae71..19a19347ec6 100644 --- a/runtime/vm/raw_object.h +++ b/runtime/vm/raw_object.h @@ -568,6 +568,38 @@ class ObjectLayout { } } + template + void StoreArrayPointer(type const* addr, type value) { + reinterpret_cast*>(const_cast(addr)) + ->store(value, order); + if (value->IsHeapObject()) { + CheckArrayPointerStore(addr, value, Thread::Current()); + } + } + + template + void StoreArrayPointer(type const* addr, type value, Thread* thread) { + *const_cast(addr) = value; + if (value->IsHeapObject()) { + CheckArrayPointerStore(addr, value, thread); + } + } + + template + type LoadSmi(type const* addr) const { + return reinterpret_cast*>(const_cast(addr)) + ->load(order); + } + // Use for storing into an explicitly Smi-typed field of an object + // (i.e., both the previous and new value are Smis). + template + void StoreSmi(SmiPtr const* addr, SmiPtr value) { + // Can't use Contains, as array length is initialized through this method. + ASSERT(reinterpret_cast(addr) >= ObjectLayout::ToAddr(this)); + reinterpret_cast*>(const_cast(addr)) + ->store(value, order); + } + private: DART_FORCE_INLINE void CheckHeapPointerStore(ObjectPtr value, Thread* thread) { @@ -597,23 +629,6 @@ class ObjectLayout { } } - template - void StoreArrayPointer(type const* addr, type value) { - reinterpret_cast*>(const_cast(addr)) - ->store(value, order); - if (value->IsHeapObject()) { - CheckArrayPointerStore(addr, value, Thread::Current()); - } - } - - template - void StoreArrayPointer(type const* addr, type value, Thread* thread) { - *const_cast(addr) = value; - if (value->IsHeapObject()) { - CheckArrayPointerStore(addr, value, thread); - } - } - template DART_FORCE_INLINE void CheckArrayPointerStore(type const* addr, ObjectPtr value, @@ -650,26 +665,9 @@ class ObjectLayout { } } - protected: - template - type LoadSmi(type const* addr) const { - return reinterpret_cast*>(const_cast(addr)) - ->load(order); - } - // Use for storing into an explicitly Smi-typed field of an object - // (i.e., both the previous and new value are Smis). - template - void StoreSmi(SmiPtr const* addr, SmiPtr value) { - // Can't use Contains, as array length is initialized through this method. - ASSERT(reinterpret_cast(addr) >= ObjectLayout::ToAddr(this)); - reinterpret_cast*>(const_cast(addr)) - ->store(value, order); - } - friend class StoreBufferUpdateVisitor; // RememberCard void RememberCard(ObjectPtr const* slot); - private: friend class Array; friend class ByteBuffer; friend class CidRewriteVisitor; diff --git a/runtime/vm/source_report.cc b/runtime/vm/source_report.cc index 3f074ffd7f0..b52f017f80b 100644 --- a/runtime/vm/source_report.cc +++ b/runtime/vm/source_report.cc @@ -634,13 +634,6 @@ void SourceReport::CollectConstConstructorCoverageFromScripts( // Now output the wanted constant coverage. for (intptr_t i = 0; i < local_script_table_entries->length(); i++) { const Script* script = local_script_table_entries->At(i)->script; - bool script_ok = true; - if (script_ != NULL && !script_->IsNull()) { - if (script->raw() != script_->raw()) { - // This is the wrong script. - script_ok = false; - } - } // Whether we want *this* script or not we need to look at the constant // constructor coverage. Any of those could be in a script we *do* want.