[Kernel, VM runtime] Hook up bool checks in strong mode (fixes #32336).

Update kernel status file.

Change-Id: I08b153d431c15870e0251e7dd760213c795579c9
Reviewed-on: https://dart-review.googlesource.com/48707
Reviewed-by: Siva Annamalai <asiva@google.com>
This commit is contained in:
Régis Crelier 2018-03-29 16:10:52 +00:00
parent 4da52281aa
commit 7d90df42f1
12 changed files with 31 additions and 32 deletions

View file

@ -106,6 +106,7 @@ inference/mixin_inference_outwards_3: TypeCheckError
inference/mixin_inference_outwards_4: TypeCheckError
inference/mixin_inference_unification_1: TypeCheckError
inference/mixin_inference_unification_2: TypeCheckError
inference/override_equals: RuntimeError
inference/unresolved_super: TypeCheckError
inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1: Fail # Issue #25824
inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2: Fail # Issue #25824

View file

@ -437,14 +437,15 @@ static void EmitAssertBoolean(Register reg,
// Call the runtime if the object is not bool::true or bool::false.
ASSERT(locs->always_calls());
Label done;
Isolate* isolate = Isolate::Current();
if (Isolate::Current()->type_checks()) {
if (isolate->type_checks() || isolate->strong()) {
__ CompareObject(reg, Bool::True());
__ b(&done, EQ);
__ CompareObject(reg, Bool::False());
__ b(&done, EQ);
} else {
ASSERT(Isolate::Current()->asserts());
ASSERT(isolate->asserts());
__ CompareObject(reg, Object::null_instance());
__ b(&done, NE);
}

View file

@ -435,14 +435,15 @@ static void EmitAssertBoolean(Register reg,
// Call the runtime if the object is not bool::true or bool::false.
ASSERT(locs->always_calls());
Label done;
Isolate* isolate = Isolate::Current();
if (Isolate::Current()->type_checks()) {
if (isolate->type_checks() || isolate->strong()) {
__ CompareObject(reg, Bool::True());
__ b(&done, EQ);
__ CompareObject(reg, Bool::False());
__ b(&done, EQ);
} else {
ASSERT(Isolate::Current()->asserts());
ASSERT(isolate->asserts());
__ CompareObject(reg, Object::null_instance());
__ b(&done, NE);
}

View file

@ -195,7 +195,8 @@ EMIT_NATIVE_CODE(AssertBoolean,
if (compiler->is_optimizing()) {
__ Push(locs()->in(0).reg());
}
__ AssertBoolean(Isolate::Current()->type_checks() ? 1 : 0);
Isolate* isolate = Isolate::Current();
__ AssertBoolean((isolate->type_checks() || isolate->strong()) ? 1 : 0);
compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(),
token_pos());
compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);

View file

@ -310,14 +310,15 @@ static void EmitAssertBoolean(Register reg,
// Call the runtime if the object is not bool::true or bool::false.
ASSERT(locs->always_calls());
Label done;
Isolate* isolate = Isolate::Current();
if (Isolate::Current()->type_checks()) {
if (isolate->type_checks() || isolate->strong()) {
__ CompareObject(reg, Bool::True());
__ j(EQUAL, &done, Assembler::kNearJump);
__ CompareObject(reg, Bool::False());
__ j(EQUAL, &done, Assembler::kNearJump);
} else {
ASSERT(Isolate::Current()->asserts());
ASSERT(isolate->asserts());
__ CompareObject(reg, Object::null_instance());
__ j(NOT_EQUAL, &done, Assembler::kNearJump);
}

View file

@ -403,14 +403,15 @@ static void EmitAssertBoolean(Register reg,
// Call the runtime if the object is not bool::true or bool::false.
ASSERT(locs->always_calls());
Label done;
Isolate* isolate = Isolate::Current();
if (Isolate::Current()->type_checks()) {
if (isolate->type_checks() || isolate->strong()) {
__ CompareObject(reg, Bool::True());
__ j(EQUAL, &done, Assembler::kNearJump);
__ CompareObject(reg, Bool::False());
__ j(EQUAL, &done, Assembler::kNearJump);
} else {
ASSERT(Isolate::Current()->asserts());
ASSERT(isolate->asserts());
__ CompareObject(reg, Object::null_instance());
__ j(NOT_EQUAL, &done, Assembler::kNearJump);
}

View file

@ -945,7 +945,7 @@ BlockEntryInstr* TestGraphVisitor::CreateFalseSuccessor() const {
void TestGraphVisitor::ReturnValue(Value* value) {
Isolate* isolate = Isolate::Current();
if (isolate->type_checks() || isolate->asserts()) {
if (isolate->strong() || isolate->type_checks() || isolate->asserts()) {
value = Bind(new (Z) AssertBooleanInstr(condition_token_pos(), value,
owner()->GetNextDeoptId()));
}
@ -1290,7 +1290,7 @@ void EffectGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) {
node->left()->Visit(&for_left);
EffectGraphVisitor empty(owner());
Isolate* isolate = Isolate::Current();
if (isolate->type_checks() || isolate->asserts()) {
if (isolate->strong() || isolate->type_checks() || isolate->asserts()) {
ValueGraphVisitor for_right(owner());
node->right()->Visit(&for_right);
Value* right_value = for_right.value();
@ -1354,7 +1354,7 @@ void ValueGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) {
node->right()->Visit(&for_right);
Value* right_value = for_right.value();
Isolate* isolate = Isolate::Current();
if (isolate->type_checks() || isolate->asserts()) {
if (isolate->strong() || isolate->type_checks() || isolate->asserts()) {
right_value = for_right.Bind(new (Z) AssertBooleanInstr(
node->right()->token_pos(), right_value, owner()->GetNextDeoptId()));
}
@ -1626,7 +1626,7 @@ void EffectGraphVisitor::VisitComparisonNode(ComparisonNode* node) {
owner()->ic_data_array(), owner()->GetNextDeoptId());
if (node->kind() == Token::kNE) {
Isolate* isolate = Isolate::Current();
if (isolate->type_checks() || isolate->asserts()) {
if (isolate->strong() || isolate->type_checks() || isolate->asserts()) {
Value* value = Bind(result);
result = new (Z) AssertBooleanInstr(node->token_pos(), value,
owner()->GetNextDeoptId());
@ -1670,7 +1670,7 @@ void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) {
Append(for_value);
Value* value = for_value.value();
Isolate* isolate = Isolate::Current();
if (isolate->type_checks() || isolate->asserts()) {
if (isolate->strong() || isolate->type_checks() || isolate->asserts()) {
value = Bind(new (Z) AssertBooleanInstr(
node->operand()->token_pos(), value, owner()->GetNextDeoptId()));
}

View file

@ -2010,7 +2010,8 @@ void StreamingScopeBuilder::VisitFunctionType(bool simple) {
TypeParameterHelper helper(builder_);
helper.ReadUntilExcludingAndSetJustRead(TypeParameterHelper::kBound);
VisitDartType(); // read bound.
helper.ReadUntilExcludingAndSetJustRead(TypeParameterHelper::kDefaultType);
helper.ReadUntilExcludingAndSetJustRead(
TypeParameterHelper::kDefaultType);
if (builder_->ReadTag() == kSomething) {
VisitDartType(); // read default type.
}
@ -6490,8 +6491,8 @@ Fragment StreamingFlowGraphBuilder::BuildImplicitClosureCreation(
return flow_graph_builder_->BuildImplicitClosureCreation(target);
}
Fragment StreamingFlowGraphBuilder::CheckBooleanInCheckedMode() {
return flow_graph_builder_->CheckBooleanInCheckedMode();
Fragment StreamingFlowGraphBuilder::CheckBoolean() {
return flow_graph_builder_->CheckBoolean();
}
Fragment StreamingFlowGraphBuilder::CheckAssignableInCheckedMode(
@ -6550,7 +6551,7 @@ Fragment StreamingFlowGraphBuilder::TranslateCondition(bool* negate) {
SkipBytes(1); // Skip Not tag, thus go directly to the inner expression.
}
Fragment instructions = BuildExpression(); // read expression.
instructions += CheckBooleanInCheckedMode();
instructions += CheckBoolean();
return instructions;
}
@ -7785,7 +7786,7 @@ Fragment StreamingFlowGraphBuilder::BuildNot(TokenPosition* position) {
if (position != NULL) *position = TokenPosition::kNoSource;
Fragment instructions = BuildExpression(); // read expression.
instructions += CheckBooleanInCheckedMode();
instructions += CheckBoolean();
instructions += BooleanNegate();
return instructions;
}
@ -8569,7 +8570,7 @@ Fragment StreamingFlowGraphBuilder::BuildAssertStatement() {
instructions += BuildExpression(); // read condition.
instructions += PushArgument();
instructions += EvaluateAssertion();
instructions += CheckBooleanInCheckedMode();
instructions += CheckBoolean();
instructions += Constant(Bool::True());
instructions += BranchIfEqual(&then, &otherwise, false);

View file

@ -1316,7 +1316,7 @@ class StreamingFlowGraphBuilder {
JoinEntryInstr* BuildJoinEntry(intptr_t try_index);
Fragment Goto(JoinEntryInstr* destination);
Fragment BuildImplicitClosureCreation(const Function& target);
Fragment CheckBooleanInCheckedMode();
Fragment CheckBoolean();
Fragment CheckAssignableInCheckedMode(const AbstractType& dst_type,
const String& dst_name);
Fragment CheckArgumentType(LocalVariable* variable, const AbstractType& type);

View file

@ -2223,9 +2223,9 @@ Fragment FlowGraphBuilder::EvaluateAssertion() {
ICData::kStatic);
}
Fragment FlowGraphBuilder::CheckBooleanInCheckedMode() {
Fragment FlowGraphBuilder::CheckBoolean() {
Fragment instructions;
if (I->type_checks()) {
if (I->strong() || I->type_checks() || I->asserts()) {
LocalVariable* top_of_stack = MakeTemporary();
instructions += LoadLocal(top_of_stack);
instructions += AssertBool();

View file

@ -783,7 +783,7 @@ class FlowGraphBuilder : public BaseFlowGraphBuilder {
Fragment EvaluateAssertion();
Fragment CheckVariableTypeInCheckedMode(const AbstractType& dst_type,
const String& name_symbol);
Fragment CheckBooleanInCheckedMode();
Fragment CheckBoolean();
Fragment CheckAssignable(const AbstractType& dst_type,
const String& dst_name);

View file

@ -584,13 +584,9 @@ regress_30339_test: RuntimeError
type_variable_bounds4_test/01: RuntimeError
[ $compiler == dartk && $runtime == vm && !$checked && $strong ]
bool_check_test: RuntimeError
bool_condition_check_test: RuntimeError
compile_time_constant_static2_test/04: MissingCompileTimeError
compile_time_constant_static3_test/04: MissingCompileTimeError
conditional_rewrite_test: RuntimeError # Issue 31402 (Not)
field_override_optimization_test: RuntimeError
if_null_precedence_test/none: RuntimeError
type_error_test: RuntimeError # Issue 31402 (Variable declaration)
# ===== dartk + vm status lines =====
@ -888,13 +884,9 @@ type_variable_bounds4_test/01: RuntimeError
[ $compiler == dartkp && $runtime == dart_precompiled && !$checked && $strong ]
assertion_initializer_const_error_test/01: MissingCompileTimeError
assertion_initializer_const_function_error_test/01: MissingCompileTimeError
bool_check_test: RuntimeError
bool_condition_check_test: RuntimeError
compile_time_constant_static2_test/04: MissingCompileTimeError
compile_time_constant_static3_test/04: MissingCompileTimeError
conditional_rewrite_test: RuntimeError # Issue 31402 (Not)
field_override_optimization_test: RuntimeError
if_null_precedence_test/none: RuntimeError
implicit_downcast_during_combiner_test: RuntimeError
implicit_downcast_during_compound_assignment_test: RuntimeError
implicit_downcast_during_conditional_expression_test: RuntimeError