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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 112243002: Some cleanups, fixes. Parts of the cid guessing CL that was revrted. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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 | « runtime/vm/compiler.cc ('k') | runtime/vm/flow_graph_type_propagator.cc » ('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 31083)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -101,7 +101,6 @@
ASSERT(call->HasICData());
if (call->ic_data()->NumberOfChecks() > 0) {
// This occurs when an instance call has too many checks.
- // TODO(srdjan): Replace IC call with megamorphic call.
return false;
}
GrowableArray<intptr_t> class_ids(call->ic_data()->num_args_tested());
@@ -110,40 +109,45 @@
intptr_t cid = call->PushArgumentAt(i)->value()->Type()->ToCid();
class_ids.Add(cid);
}
- if (class_ids[0] != kDynamicCid) {
- ArgumentsDescriptor args_desc(
- Array::Handle(ArgumentsDescriptor::New(call->ArgumentCount(),
- call->argument_names())));
- const Class& receiver_class = Class::Handle(
- Isolate::Current()->class_table()->At(class_ids[0]));
- const Function& function = Function::Handle(
- Resolver::ResolveDynamicForReceiverClass(
- receiver_class,
- call->function_name(),
- args_desc));
- if (function.IsNull()) {
+
+ for (intptr_t i = 0; i < class_ids.length(); i++) {
+ if (class_ids[i] == kDynamicCid) {
+ // Not all cid-s known.
return false;
}
- // Create new ICData, do not modify the one attached to the instruction
- // since it is attached to the assembly instruction itself.
- // TODO(srdjan): Prevent modification of ICData object that is
- // referenced in assembly code.
- ICData& ic_data = ICData::ZoneHandle(ICData::New(
- flow_graph_->parsed_function().function(),
- call->function_name(),
- Object::empty_array(), // Dummy argument descriptor.
- call->deopt_id(),
- class_ids.length()));
- if (class_ids.length() > 1) {
- ic_data.AddCheck(class_ids, function);
- } else {
- ASSERT(class_ids.length() == 1);
- ic_data.AddReceiverCheck(class_ids[0], function);
- }
- call->set_ic_data(&ic_data);
- return true;
}
- return false;
+
+ ArgumentsDescriptor args_desc(
+ Array::Handle(ArgumentsDescriptor::New(call->ArgumentCount(),
+ call->argument_names())));
+ const Class& receiver_class = Class::Handle(
+ Isolate::Current()->class_table()->At(class_ids[0]));
+ const Function& function = Function::Handle(
+ Resolver::ResolveDynamicForReceiverClass(
+ receiver_class,
+ call->function_name(),
+ args_desc));
+ if (function.IsNull()) {
+ return false;
+ }
+ // Create new ICData, do not modify the one attached to the instruction
+ // since it is attached to the assembly instruction itself.
+ // TODO(srdjan): Prevent modification of ICData object that is
+ // referenced in assembly code.
+ ICData& ic_data = ICData::ZoneHandle(ICData::New(
+ flow_graph_->parsed_function().function(),
+ call->function_name(),
+ Object::empty_array(), // Dummy argument descriptor.
+ call->deopt_id(),
+ class_ids.length()));
+ if (class_ids.length() > 1) {
+ ic_data.AddCheck(class_ids, function);
+ } else {
+ ASSERT(class_ids.length() == 1);
+ ic_data.AddReceiverCheck(class_ids[0], function);
+ }
+ call->set_ic_data(&ic_data);
+ return true;
}
@@ -6906,20 +6910,17 @@
}
-void ConstantPropagator::VisitBinaryMintOp(
- BinaryMintOpInstr* instr) {
+void ConstantPropagator::VisitBinaryMintOp(BinaryMintOpInstr* instr) {
HandleBinaryOp(instr, instr->op_kind(), *instr->left(), *instr->right());
}
-void ConstantPropagator::VisitShiftMintOp(
- ShiftMintOpInstr* instr) {
+void ConstantPropagator::VisitShiftMintOp(ShiftMintOpInstr* instr) {
HandleBinaryOp(instr, instr->op_kind(), *instr->left(), *instr->right());
}
-void ConstantPropagator::VisitUnaryMintOp(
- UnaryMintOpInstr* instr) {
+void ConstantPropagator::VisitUnaryMintOp(UnaryMintOpInstr* instr) {
// TODO(kmillikin): Handle unary operations.
SetValue(instr, non_constant_);
}
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/flow_graph_type_propagator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698