v8/src/base
clemensh db0c86fa5f [base] Define CHECK comparison for signed vs. unsigned
The current CHECK/DCHECK implementation fails statically if a signed
value is compared against an unsigned value. The common solution is to
cast on each caller, which is tedious and error-prone (might hide bugs).
This CL implements signed vs. unsigned comparisons by executing up to
two comparisons. For example, if i is int32_t and u is uint_32_t, a
DCHECK_LE(i, u) would create the check
i <= 0 || static_cast<uint32_t>(i) <= u.
For checks against constants, at least one of the checks can be removed
by compiler optimizations.

The tradeoff we have to make is to sometimes silently execute an
additional comparison. And we increase code complexity of course, even
though the usage is just as easy (or even easier) as before.

The compile time impact seems to be minimal:
I ran 3 full compilations for Optdebug on my local machine, one time on
the current ToT, one time with this CL plus http://crrev.com/2524093002.
Before: 143.72 +- 1.21 seconds
Now: 144.18 +- 0.67 seconds

In order to check that the new comparisons are working, I refactored
some DCHECKs in wasm to use the new magic, and added unit test cases.

R=ishell@chromium.org, titzer@chromium.org
CC=ahaas@chromium.org, bmeurer@chromium.org

Committed: https://crrev.com/5925074a9dab5a8577766545b91b62f2c531d3dc
Review-Url: https://codereview.chromium.org/2526783002
Cr-Original-Commit-Position: refs/heads/master@{#41275}
Cr-Commit-Position: refs/heads/master@{#41411}
2016-12-01 08:53:04 +00:00
..
debug Reland of land "Turn libbase into a component" (patchset #1 id:1 of https://codereview.chromium.org/2396933002/ ) 2016-10-07 07:56:52 +00:00
platform Revert of [counters] RuntimeStats: fix wrong bookkeeping when dynamically changing counters. (patchset #10 id:180001 of https://codereview.chromium.org/2511093002/ ) 2016-11-21 16:00:56 +00:00
utils Reland of land "Turn libbase into a component" (patchset #1 id:1 of https://codereview.chromium.org/2396933002/ ) 2016-10-07 07:56:52 +00:00
adapters.h
atomic-utils.h Fix more -Wsign-compare warnings in heap, mips, base, etc. 2016-11-11 14:56:10 +00:00
atomicops_internals_atomicword_compat.h Reland Update implementation of atomics with latest Chromium version but use compiler builtin atomics 2016-10-21 10:05:42 +00:00
atomicops_internals_portable.h Reland Update implementation of atomics with latest Chromium version but use compiler builtin atomics 2016-10-21 10:05:42 +00:00
atomicops_internals_x86_msvc.h Reland Update implementation of atomics with latest Chromium version but use compiler builtin atomics 2016-10-21 10:05:42 +00:00
atomicops.h Reland Update implementation of atomics with latest Chromium version but use compiler builtin atomics 2016-10-21 10:05:42 +00:00
base-export.h Reland of land "Turn libbase into a component" (patchset #1 id:1 of https://codereview.chromium.org/2396933002/ ) 2016-10-07 07:56:52 +00:00
bits.cc [turbofan] Introduce integer multiplication with overflow. 2016-07-14 08:56:14 +00:00
bits.h Reland of land "Turn libbase into a component" (patchset #1 id:1 of https://codereview.chromium.org/2396933002/ ) 2016-10-07 07:56:52 +00:00
build_config.h PPC: [heap] Switch to 500k pages 2016-10-04 13:32:36 +00:00
compiler-specific.h Turn libplatform into a component 2016-10-10 08:52:06 +00:00
cpu.cc Fix -Wshorten-64-to-32 errors on clang ARM64 2016-11-11 20:19:57 +00:00
cpu.h Reland of land "Turn libbase into a component" (patchset #1 id:1 of https://codereview.chromium.org/2396933002/ ) 2016-10-07 07:56:52 +00:00
DEPS
division-by-constant.cc Move DivisionByConstant template instantiations to cpp file 2016-10-19 13:32:34 +00:00
division-by-constant.h Move DivisionByConstant template instantiations to cpp file 2016-10-19 13:32:34 +00:00
file-utils.cc Reland of land "Turn libbase into a component" (patchset #1 id:1 of https://codereview.chromium.org/2396933002/ ) 2016-10-07 07:56:52 +00:00
file-utils.h Reland of land "Turn libbase into a component" (patchset #1 id:1 of https://codereview.chromium.org/2396933002/ ) 2016-10-07 07:56:52 +00:00
flags.h [turbofan] Various performance enhancements for escape analysis 2016-01-13 15:30:48 +00:00
format-macros.h Fix printf formats 2016-04-12 16:14:03 +00:00
free_deleter.h Replace DumpBacktrace with Chromium's StackTrace implementation. 2016-08-18 14:25:52 +00:00
functional.cc
functional.h Reland of land "Turn libbase into a component" (patchset #1 id:1 of https://codereview.chromium.org/2396933002/ ) 2016-10-07 07:56:52 +00:00
hashmap-entry.h [base] Template hashmap on key and value 2016-09-20 08:40:33 +00:00
hashmap.h Fix zone in which temp-zone parsed data is allocated for the function scope on the boundary. 2016-11-24 16:07:05 +00:00
ieee754.cc Fix compilation error on gcc 4.8.5 on s390x 2016-09-01 13:30:53 +00:00
ieee754.h Reland of land "Turn libbase into a component" (patchset #1 id:1 of https://codereview.chromium.org/2396933002/ ) 2016-10-07 07:56:52 +00:00
iterator.h
lazy-instance.h [presubmit] Enable readability/namespace linter checking. 2015-09-30 13:47:11 +00:00
logging.cc [base] Pass scalar arguments by value in CHECK/DCHECK 2016-11-29 15:02:26 +00:00
logging.h [base] Define CHECK comparison for signed vs. unsigned 2016-12-01 08:53:04 +00:00
macros.h Remove comment discussing non-existent ARRAYSIZE_UNSAFE macro 2016-08-26 18:56:19 +00:00
once.cc [presubmit] Enable readability/namespace linter checking. 2015-09-30 13:47:11 +00:00
once.h Reland of land "Turn libbase into a component" (patchset #1 id:1 of https://codereview.chromium.org/2396933002/ ) 2016-10-07 07:56:52 +00:00
OWNERS
qnx-math.h
ring-buffer.h Introduce a CompilerDispatcherTracer and track how long jobs take 2016-10-14 08:12:44 +00:00
safe_conversions_impl.h Revert of Fix bitfield enums to not trigger upcoming Clang warning (patchset #3 id:40001 of https://codereview.chromium.org/2349153002/ ) 2016-09-23 13:22:41 +00:00
safe_conversions.h
safe_math_impl.h
safe_math.h
sys-info.cc Remove NaCl support. 2016-07-27 07:50:31 +00:00
sys-info.h Reland of land "Turn libbase into a component" (patchset #1 id:1 of https://codereview.chromium.org/2396933002/ ) 2016-10-07 07:56:52 +00:00
win32-headers.h [base] Implement CPU time on Windows. 2016-06-01 18:55:51 +00:00