Chromium Code Reviews| Index: runtime/vm/flow_graph_optimizer.cc |
| =================================================================== |
| --- runtime/vm/flow_graph_optimizer.cc (revision 8804) |
| +++ runtime/vm/flow_graph_optimizer.cc (working copy) |
| @@ -50,10 +50,10 @@ |
| } |
| -static bool ICDataHasTwoReceiverClasses(const ICData& ic_data, |
| - const Class& cls1, |
| - const Class& cls2) { |
| - ASSERT(!cls1.IsNull() && !cls2.IsNull()); |
| +static bool ICDataHasReceiverArgumentClasses(const ICData& ic_data, |
| + const Class& receiver_cls, |
| + const Class& argument_cls) { |
| + ASSERT(!receiver_cls.IsNull() && !argument_cls.IsNull()); |
| if (ic_data.num_args_tested() != 2) { |
| return false; |
| } |
| @@ -62,8 +62,8 @@ |
| GrowableArray<const Class*> classes; |
| ic_data.GetCheckAt(i, &classes, &target); |
| ASSERT(classes.length() == 2); |
| - if (classes[0]->raw() == cls1.raw()) { |
| - if (classes[1]->raw() == cls2.raw()) { |
| + if (classes[0]->raw() == receiver_cls.raw()) { |
| + if (classes[1]->raw() == argument_cls.raw()) { |
| return true; |
| } |
| } |
| @@ -82,10 +82,19 @@ |
| static bool HasTwoSmi(const ICData& ic_data) { |
| const Class& smi_class = |
| Class::Handle(Isolate::Current()->object_store()->smi_class()); |
| - return ICDataHasTwoReceiverClasses(ic_data, smi_class, smi_class); |
| + return ICDataHasReceiverArgumentClasses(ic_data, smi_class, smi_class); |
| } |
| +static bool HasMintSmi(const ICData& ic_data) { |
| + const Class& mint_class = |
| + Class::Handle(Isolate::Current()->object_store()->mint_class()); |
| + const Class& smi_class = |
| + Class::Handle(Isolate::Current()->object_store()->smi_class()); |
| + return ICDataHasReceiverArgumentClasses(ic_data, mint_class, smi_class); |
|
srdjan
2012/06/18 20:32:36
Maybe we should modify ICDataHasReceiverArgumentCl
regis
2012/06/18 21:55:25
Done.
|
| +} |
| + |
| + |
| static bool HasOneDouble(const ICData& ic_data) { |
| const Class& double_class = |
| Class::Handle(Isolate::Current()->object_store()->double_class()); |
| @@ -96,19 +105,30 @@ |
| static bool HasTwoDouble(const ICData& ic_data) { |
| const Class& double_class = |
| Class::Handle(Isolate::Current()->object_store()->double_class()); |
| - return ICDataHasTwoReceiverClasses(ic_data, double_class, double_class); |
| + return ICDataHasReceiverArgumentClasses(ic_data, double_class, double_class); |
| } |
| bool FlowGraphOptimizer::TryReplaceWithBinaryOp(InstanceCallComp* comp, |
| Token::Kind op_kind) { |
| + BinaryOpComp::OperandsType operands_type; |
| + |
| + if (HasMintSmi(*comp->ic_data())) { |
| + // We check for Mint receiver and Smi argument, but we try to support any |
| + // combination of Mint and Smi. |
| + if (op_kind != Token::kBIT_AND) { |
| + // TODO(regis): Not yet supported. |
| + return false; |
| + } |
| + |
| + operands_type = BinaryOpComp::kMintOperands; |
| + } |
| + |
| if (comp->ic_data()->NumberOfChecks() != 1) { |
| // TODO(srdjan): Not yet supported. |
| return false; |
| } |
| - BinaryOpComp::OperandsType operands_type; |
| - |
| if (HasTwoSmi(*comp->ic_data())) { |
| if (op_kind == Token::kDIV || |
| op_kind == Token::kMOD) { |