Nice, much cleaner than the language mode we had before.
I'd kinda like to rename SLOPPY in the enum to something else,
since "sloppy"
means the opposite of "strict", and this will no longer be true after more
modes
are added. "BASIC", "NORMAL", "NONE", "DEFAULT"?
Sloppy will continue to be the opposite of strict -- think of the new modes
as
submodes of strict. I'd much prefer to stick to the established terminology.
This is why I also didn't add a is_sloppy() helper, since that might get
confused with comparing against that particular enum value, whereas the
wanted
semantics is "is not strict".
See above, I think is_sloppy is perfectly adequate (and easier to read than
!is_strict).
https://codereview.chromium.org/894683003/diff/40001/src/globals.h
File src/globals.h (right):
https://codereview.chromium.org/894683003/diff/40001/src/globals.h#newcode234
src/globals.h:234: #define is_strict(language_mode) ((language_mode) &
STRICT)
Why a macro instead of an inline funciton?
https://codereview.chromium.org/894683003/diff/40001/src/objects-inl.h
File src/objects-inl.h (right):
https://codereview.chromium.org/894683003/diff/40001/src/objects-inl.h#newcode5818
src/objects-inl.h:5818: DCHECK(!is_strict(this->language_mode()) ||
is_strict(language_mode));
Maybe abstract that into an is_stricter_than predicate.
https://codereview.chromium.org/894683003/diff/40001/src/objects.cc
File src/objects.cc (right):
https://codereview.chromium.org/894683003/diff/40001/src/objects.cc#newcode14003
src/objects.cc:14003: DCHECK(language_unchecked == SLOPPY ||
language_unchecked == STRICT);
I suppose we could have a predicate is_valid_language_mode to avoid
repeating and maintaining these conditions.
https://codereview.chromium.org/894683003/diff/40001/src/parser.h
File src/parser.h (right):
https://codereview.chromium.org/894683003/diff/40001/src/parser.h#newcode49
src/parser.h:49: DCHECK(backing_[kLanguageModeIndex] == SLOPPY ||
Same here, could use is_valid_l_m
https://codereview.chromium.org/894683003/diff/40001/src/runtime/runtime-compiler.cc
File src/runtime/runtime-compiler.cc (right):
https://codereview.chromium.org/894683003/diff/40001/src/runtime/runtime-compiler.cc#newcode446
src/runtime/runtime-compiler.cc:446: DCHECK(args.smi_at(4) == STRICT ||
args.smi_at(4) == SLOPPY);
Could use predicate here as well.
https://codereview.chromium.org/894683003/diff/40001/src/runtime/runtime-utils.h
File src/runtime/runtime-utils.h (right):
https://codereview.chromium.org/894683003/diff/40001/src/runtime/runtime-utils.h#newcode78
src/runtime/runtime-utils.h:78: RUNTIME_ASSERT(args.smi_at(index) ==
STRICT || \
same here
https://codereview.chromium.org/894683003/diff/40001/test/unittests/compiler/js-typed-lowering-unittest.cc
File test/unittests/compiler/js-typed-lowering-unittest.cc (right):
https://codereview.chromium.org/894683003/diff/40001/test/unittests/compiler/js-typed-lowering-unittest.cc#newcode65
test/unittests/compiler/js-typed-lowering-unittest.cc:65: const
LanguageMode kLanguageModes[] = {SLOPPY, STRICT};
Maybe add a static assert here as well, so that we remember to extend
this?
https://codereview.chromium.org/894683003/
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.