[vm/asserts] Allow --enable-asserts flag in product builds.

Product builds of gen_snapshot are used by dart cli tools. So if we are to allow --enable-asserts for 'dart compile' commands, we need to allow this flag in product mode.

BUG=dartbug.com/53343
TEST=ci

Change-Id: I6252b6ee42ed45a25df2046f4a6642c880e8ee14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361122
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
This commit is contained in:
Alexander Aprelev 2024-04-05 22:48:17 +00:00 committed by Commit Queue
parent e0dd628552
commit 03a2f7da12
3 changed files with 12 additions and 9 deletions

View file

@ -85,12 +85,16 @@ DEFINE_NATIVE_ENTRY(AssertionError_throwNew, 0, 3) {
auto& condition_text = String::Handle();
// Extract the assertion condition text (if source is available).
intptr_t from_line = -1, from_column = -1;
if (script.GetTokenLocation(assertion_start, &from_line, &from_column)) {
// Extract the assertion condition text (if source is available).
intptr_t to_line, to_column;
script.GetTokenLocation(assertion_end, &to_line, &to_column);
condition_text =
script.GetSnippet(from_line, from_column, to_line, to_column);
String& url = String::Handle();
if (!script.IsNull()) {
if (script.GetTokenLocation(assertion_start, &from_line, &from_column)) {
// Extract the assertion condition text (if source is available).
intptr_t to_line, to_column;
script.GetTokenLocation(assertion_end, &to_line, &to_column);
condition_text =
script.GetSnippet(from_line, from_column, to_line, to_column);
}
url = script.url();
}
if (condition_text.IsNull()) {
condition_text = Symbols::OptimizedOut().ptr();
@ -98,7 +102,7 @@ DEFINE_NATIVE_ENTRY(AssertionError_throwNew, 0, 3) {
args.SetAt(0, condition_text);
// Initialize location arguments starting at position 1.
args.SetAt(1, String::Handle(script.url()));
args.SetAt(1, url);
args.SetAt(2, Smi::Handle(Smi::New(from_line)));
args.SetAt(3, Smi::Handle(Smi::New(from_column)));
args.SetAt(4, message);

View file

@ -106,7 +106,7 @@ constexpr bool FLAG_support_il_printer = false;
R(dump_megamorphic_stats, false, bool, false, \
"Dump megamorphic cache statistics") \
R(dump_symbol_stats, false, bool, false, "Dump symbol table statistics") \
R(enable_asserts, false, bool, false, "Enable assert statements.") \
P(enable_asserts, bool, false, "Enable assert statements.") \
P(inline_alloc, bool, true, "Whether to use inline allocation fast paths.") \
R(null_assertions, false, bool, false, \
"Enable null assertions for parameters.") \

View file

@ -43,7 +43,6 @@ void/*: Skip # https://github.com/dart-lang/sdk/issues/34015
class/large_class_declaration_test: Slow, Pass
[ $mode == product ]
assert/assert_test: SkipByDesign # Requires checked mode.
generic/generic_test: SkipByDesign # Requires checked mode.
map/literal4_test: SkipByDesign # Requires checked mode.
parameter/named_type_test/01: SkipByDesign # Requires checked mode.