It's complicated and for the details, you'll have to look at build configuration files (start with BUILD.gn and gni/v8.gni, if needed continue with generated .ninja files in the output directory), but the short answer is that the three build modes affect C++ compilation as follows:
release: -O3
debug: -O0 -DDEBUG
optdebug: -O2 -DDEBUG
Additionally, there is a flag --debug-code that controls whether extra checks are emitted in generated code. It is on by default in when DEBUG is defined, and off by default otherwise, but can be overridden.
So for your purposes, you probably want an optdebug build and the --nodebug-code command-line flag.
Please double-check everything I've said here before blindly trusting any results.