| Index: runtime/vm/flow_graph_builder.cc
|
| ===================================================================
|
| --- runtime/vm/flow_graph_builder.cc (revision 6532)
|
| +++ runtime/vm/flow_graph_builder.cc (working copy)
|
| @@ -507,6 +507,7 @@
|
| // <Expression> :: Comparison { kind: Token::Kind
|
| // left: <Expression>
|
| // right: <Expression> }
|
| +// TODO(srdjan): Implement new equality.
|
| void EffectGraphVisitor::VisitComparisonNode(ComparisonNode* node) {
|
| if (Token::IsInstanceofOperator(node->kind())) {
|
| BuildInstanceOf(node);
|
| @@ -526,6 +527,27 @@
|
| return;
|
| }
|
|
|
| + if ((node->kind() == Token::kEQ) || (node->kind() == Token::kNE)) {
|
| + ValueGraphVisitor for_left_value(owner(), temp_index());
|
| + node->left()->Visit(&for_left_value);
|
| + Append(for_left_value);
|
| + ValueGraphVisitor for_right_value(owner(), for_left_value.temp_index());
|
| + node->right()->Visit(&for_right_value);
|
| + Append(for_right_value);
|
| + EqualityCompareComp* comp = new EqualityCompareComp(
|
| + node->id(), node->token_index(), owner()->try_index(),
|
| + for_left_value.value(), for_right_value.value());
|
| + if (node->kind() == Token::kEQ) {
|
| + ReturnComputation(comp);
|
| + } else {
|
| + AddInstruction(new BindInstr(temp_index(), comp));
|
| + Value* eq_result = new TempVal(temp_index());
|
| + BooleanNegateComp* negate = new BooleanNegateComp(eq_result);
|
| + ReturnComputation(negate);
|
| + }
|
| + return;
|
| + }
|
| +
|
| ArgumentGraphVisitor for_left_value(owner(), temp_index());
|
| node->left()->Visit(&for_left_value);
|
| Append(for_left_value);
|
| @@ -535,27 +557,11 @@
|
| ZoneGrowableArray<Value*>* arguments = new ZoneGrowableArray<Value*>(2);
|
| arguments->Add(for_left_value.value());
|
| arguments->Add(for_right_value.value());
|
| - // 'kNE' is not overloadable, must implement as kEQ and negation.
|
| - // Boolean negation '!' cannot be overloaded neither.
|
| - if (node->kind() == Token::kNE) {
|
| - const String& name = String::ZoneHandle(String::NewSymbol("=="));
|
| - InstanceCallComp* call_equal = new InstanceCallComp(
|
| - node->id(), node->token_index(), owner()->try_index(), name,
|
| - arguments, Array::ZoneHandle(), 2);
|
| - AddInstruction(new BindInstr(temp_index(), call_equal));
|
| - Value* eq_result = new TempVal(temp_index());
|
| - if (FLAG_enable_type_checks) {
|
| - Bailout("GenerateConditionTypeCheck in kNE");
|
| - }
|
| - BooleanNegateComp* negate = new BooleanNegateComp(eq_result);
|
| - ReturnComputation(negate);
|
| - } else {
|
| - const String& name = String::ZoneHandle(String::NewSymbol(node->Name()));
|
| - InstanceCallComp* call = new InstanceCallComp(
|
| - node->id(), node->token_index(), owner()->try_index(), name,
|
| - arguments, Array::ZoneHandle(), 2);
|
| - ReturnComputation(call);
|
| - }
|
| + const String& name = String::ZoneHandle(String::NewSymbol(node->Name()));
|
| + InstanceCallComp* call = new InstanceCallComp(
|
| + node->id(), node->token_index(), owner()->try_index(), name,
|
| + arguments, Array::ZoneHandle(), 2);
|
| + ReturnComputation(call);
|
| }
|
|
|
|
|
| @@ -2195,7 +2201,14 @@
|
| }
|
|
|
|
|
| +void FlowGraphPrinter::VisitEqualityCompare(EqualityCompareComp* comp) {
|
| + comp->left()->Accept(this);
|
| + OS::Print(" == ");
|
| + comp->right()->Accept(this);
|
| +}
|
|
|
| +
|
| +
|
| void FlowGraphPrinter::VisitStaticCall(StaticCallComp* comp) {
|
| OS::Print("StaticCall(%s",
|
| String::Handle(comp->function().name()).ToCString());
|
|
|