Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 10553040: Inline binary And operation for Mint and Smi in new compilers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698