Commit 3579968e authored by yangguo@chromium.org's avatar yangguo@chromium.org

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
parent 9e655afd
...@@ -52,14 +52,15 @@ Handle<T>::Handle(T* obj, Isolate* isolate) { ...@@ -52,14 +52,15 @@ Handle<T>::Handle(T* obj, Isolate* isolate) {
template <typename T> template <typename T>
inline bool Handle<T>::is_identical_to(const Handle<T> other) const { inline bool Handle<T>::is_identical_to(const Handle<T> o) const {
ASSERT(location_ == NULL || !(*location_)->IsFailure()); 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. // Dereferencing deferred handles to check object equality is safe.
SLOW_ASSERT(IsDereferenceAllowed(NO_DEFERRED_CHECK) && SLOW_ASSERT(
other.IsDereferenceAllowed(NO_DEFERRED_CHECK)); (location_ == NULL || IsDereferenceAllowed(NO_DEFERRED_CHECK)) &&
return *location_ == *other.location_; (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_;
} }
......
...@@ -84,8 +84,8 @@ void HEnvironmentLivenessAnalysisPhase::ZapEnvironmentSlotsInSuccessors( ...@@ -84,8 +84,8 @@ void HEnvironmentLivenessAnalysisPhase::ZapEnvironmentSlotsInSuccessors(
} }
HSimulate* simulate = first_simulate_.at(successor_id); HSimulate* simulate = first_simulate_.at(successor_id);
if (simulate == NULL) continue; if (simulate == NULL) continue;
ASSERT(simulate->closure().is_identical_to( ASSERT(VerifyClosures(simulate->closure(),
block->last_environment()->closure())); block->last_environment()->closure()));
ZapEnvironmentSlot(i, simulate); ZapEnvironmentSlot(i, simulate);
} }
} }
...@@ -97,7 +97,7 @@ void HEnvironmentLivenessAnalysisPhase::ZapEnvironmentSlotsForInstruction( ...@@ -97,7 +97,7 @@ void HEnvironmentLivenessAnalysisPhase::ZapEnvironmentSlotsForInstruction(
if (!marker->CheckFlag(HValue::kEndsLiveRange)) return; if (!marker->CheckFlag(HValue::kEndsLiveRange)) return;
HSimulate* simulate = marker->next_simulate(); HSimulate* simulate = marker->next_simulate();
if (simulate != NULL) { if (simulate != NULL) {
ASSERT(simulate->closure().is_identical_to(marker->closure())); ASSERT(VerifyClosures(simulate->closure(), marker->closure()));
ZapEnvironmentSlot(marker->index(), simulate); ZapEnvironmentSlot(marker->index(), simulate);
} }
} }
...@@ -241,4 +241,14 @@ void HEnvironmentLivenessAnalysisPhase::Run() { ...@@ -241,4 +241,14 @@ void HEnvironmentLivenessAnalysisPhase::Run() {
} }
} }
#ifdef DEBUG
bool HEnvironmentLivenessAnalysisPhase::VerifyClosures(
Handle<JSFunction> a, Handle<JSFunction> b) {
Heap::RelocationLock for_heap_access(isolate()->heap());
AllowHandleDereference for_verification;
return a.is_identical_to(b);
}
#endif
} } // namespace v8::internal } } // namespace v8::internal
...@@ -55,6 +55,9 @@ class HEnvironmentLivenessAnalysisPhase : public HPhase { ...@@ -55,6 +55,9 @@ class HEnvironmentLivenessAnalysisPhase : public HPhase {
void ZapEnvironmentSlotsForInstruction(HEnvironmentMarker* marker); void ZapEnvironmentSlotsForInstruction(HEnvironmentMarker* marker);
void UpdateLivenessAtBlockEnd(HBasicBlock* block, BitVector* live); void UpdateLivenessAtBlockEnd(HBasicBlock* block, BitVector* live);
void UpdateLivenessAtInstruction(HInstruction* instr, BitVector* live); void UpdateLivenessAtInstruction(HInstruction* instr, BitVector* live);
#ifdef DEBUG
bool VerifyClosures(Handle<JSFunction> a, Handle<JSFunction> b);
#endif
int block_count_; int block_count_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment