From 3579968e865abd3af110ccc892b06b18f05b2a7c Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Fri, 28 Mar 2014 08:49:58 +0000 Subject: [PATCH] Fix TSAN issue wrt assertions in the optimizing compiler thread. R=hpayer@chromium.org Review URL: https://codereview.chromium.org/212603013 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20322 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/handles-inl.h | 13 +++++++------ src/hydrogen-environment-liveness.cc | 16 +++++++++++++--- src/hydrogen-environment-liveness.h | 3 +++ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/handles-inl.h b/src/handles-inl.h index a25b4a2..19a02cc 100644 --- a/src/handles-inl.h +++ b/src/handles-inl.h @@ -52,14 +52,15 @@ Handle::Handle(T* obj, Isolate* isolate) { template -inline bool Handle::is_identical_to(const Handle other) const { +inline bool Handle::is_identical_to(const Handle o) const { ASSERT(location_ == NULL || !(*location_)->IsFailure()); - if (location_ == other.location_) return true; - if (location_ == NULL || other.location_ == NULL) return false; // Dereferencing deferred handles to check object equality is safe. - SLOW_ASSERT(IsDereferenceAllowed(NO_DEFERRED_CHECK) && - other.IsDereferenceAllowed(NO_DEFERRED_CHECK)); - return *location_ == *other.location_; + SLOW_ASSERT( + (location_ == NULL || IsDereferenceAllowed(NO_DEFERRED_CHECK)) && + (o.location_ == NULL || o.IsDereferenceAllowed(NO_DEFERRED_CHECK))); + if (location_ == o.location_) return true; + if (location_ == NULL || o.location_ == NULL) return false; + return *location_ == *o.location_; } diff --git a/src/hydrogen-environment-liveness.cc b/src/hydrogen-environment-liveness.cc index d7501ac..726198d 100644 --- a/src/hydrogen-environment-liveness.cc +++ b/src/hydrogen-environment-liveness.cc @@ -84,8 +84,8 @@ void HEnvironmentLivenessAnalysisPhase::ZapEnvironmentSlotsInSuccessors( } HSimulate* simulate = first_simulate_.at(successor_id); if (simulate == NULL) continue; - ASSERT(simulate->closure().is_identical_to( - block->last_environment()->closure())); + ASSERT(VerifyClosures(simulate->closure(), + block->last_environment()->closure())); ZapEnvironmentSlot(i, simulate); } } @@ -97,7 +97,7 @@ void HEnvironmentLivenessAnalysisPhase::ZapEnvironmentSlotsForInstruction( if (!marker->CheckFlag(HValue::kEndsLiveRange)) return; HSimulate* simulate = marker->next_simulate(); if (simulate != NULL) { - ASSERT(simulate->closure().is_identical_to(marker->closure())); + ASSERT(VerifyClosures(simulate->closure(), marker->closure())); ZapEnvironmentSlot(marker->index(), simulate); } } @@ -241,4 +241,14 @@ void HEnvironmentLivenessAnalysisPhase::Run() { } } + +#ifdef DEBUG +bool HEnvironmentLivenessAnalysisPhase::VerifyClosures( + Handle a, Handle b) { + Heap::RelocationLock for_heap_access(isolate()->heap()); + AllowHandleDereference for_verification; + return a.is_identical_to(b); +} +#endif + } } // namespace v8::internal diff --git a/src/hydrogen-environment-liveness.h b/src/hydrogen-environment-liveness.h index 248ec5c..6ad02d7 100644 --- a/src/hydrogen-environment-liveness.h +++ b/src/hydrogen-environment-liveness.h @@ -55,6 +55,9 @@ class HEnvironmentLivenessAnalysisPhase : public HPhase { void ZapEnvironmentSlotsForInstruction(HEnvironmentMarker* marker); void UpdateLivenessAtBlockEnd(HBasicBlock* block, BitVector* live); void UpdateLivenessAtInstruction(HInstruction* instr, BitVector* live); +#ifdef DEBUG + bool VerifyClosures(Handle a, Handle b); +#endif int block_count_; -- 2.7.4