It's a very common idiom in the V8 codebase. A conjunction of asserts is almost always written as separate asserts so we can see easily which conjunct failed.
And in general, code after a failed assert *will* crash somewhere anyway. Might as well be the next assert. 2009/5/14 Søren Gjesse <[email protected]> > I cannot see how this changes anything. When a V8 ASSERT is hit OS::Abort() > is called, so I can't see how you can continue after the first ASSERT > anyway. Also 'return *location_' will dereference the NULL pointer causing a > crash. > Regards, > Søren > > > On Thu, May 14, 2009 at 21:34, <[email protected]> wrote: > >> >> Reviewers: Mads Ager, >> >> Message: >> Hej Mads, >> >> Got the first assert and when I continued the browser crashed since its >> deref-ing a NULL pointer. >> >> >> >> Description: >> Modify assert so it doesn't crash when 'location' is NULL. >> Saw this when testing the new printing code (not checked in yet). >> >> >> Please review this at http://codereview.chromium.org/113409 >> >> SVN Base: http://v8.googlecode.com/svn/trunk/ >> >> Affected files: >> M src/handles-inl.h >> >> >> Index: src/handles-inl.h >> =================================================================== >> --- src/handles-inl.h (revision 1927) >> +++ src/handles-inl.h (working copy) >> @@ -44,8 +44,8 @@ >> >> template <class T> >> inline T* Handle<T>::operator*() const { >> - ASSERT(location_ != NULL); >> - ASSERT(reinterpret_cast<Address>(*location_) != kHandleZapValue); >> + ASSERT(location_ != NULL && >> + reinterpret_cast<Address>(*location_) != kHandleZapValue); >> return *location_; >> } >> >> >> >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
