src: add DCHECK macros
The first commit adds DCHECK macros that are only enabled in debug build and are noops in release buidls.
The second commit refactors StreamBase::CallJSOnreadMethod
to use DCHECK instead of a ifdef DEBUG
switch.
Reasoning: IMO it's slightly more readable to use DCHECK
and it's a utility commonly used in V8 - we can be more generous about adding checks for the debug builds as general assertions to help finding subtle bugs.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows [commit guidelines] (https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md#commit-message-guidelines)