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

Side by Side Diff: vm/flow_graph_optimizer.cc

Issue 10826097: Use explicit push-argument for InstanceSetter instruction. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « vm/flow_graph_builder.cc ('k') | vm/il_printer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/flow_graph_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/flow_graph_builder.h" 7 #include "vm/flow_graph_builder.h"
8 #include "vm/il_printer.h" 8 #include "vm/il_printer.h"
9 #include "vm/object_store.h" 9 #include "vm/object_store.h"
10 10
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 if (target.kind() != RawFunction::kImplicitSetter) { 425 if (target.kind() != RawFunction::kImplicitSetter) {
426 // Not an implicit setter. 426 // Not an implicit setter.
427 // TODO(srdjan): Inline special setters. 427 // TODO(srdjan): Inline special setters.
428 return false; 428 return false;
429 } 429 }
430 // Inline implicit instance setter. 430 // Inline implicit instance setter.
431 const Field& field = Field::Handle(GetField(class_id, comp->field_name())); 431 const Field& field = Field::Handle(GetField(class_id, comp->field_name()));
432 ASSERT(!field.IsNull()); 432 ASSERT(!field.IsNull());
433 StoreInstanceFieldComp* store = new StoreInstanceFieldComp( 433 StoreInstanceFieldComp* store = new StoreInstanceFieldComp(
434 field, 434 field,
435 comp->InputAt(0), 435 comp->ArgumentAt(0)->value(),
436 comp->InputAt(1), 436 comp->ArgumentAt(1)->value(),
437 comp); 437 comp);
438 store->set_ic_data(comp->ic_data()); 438 store->set_ic_data(comp->ic_data());
439 instr->set_computation(store); 439 instr->set_computation(store);
440 // Remove original push arguments.
441 for (intptr_t i = 0; i < comp->ArgumentCount(); ++i) {
442 comp->ArgumentAt(i)->RemoveFromGraph();
443 }
440 return true; 444 return true;
441 } 445 }
442 446
443 447
444 448
445 void FlowGraphOptimizer::VisitInstanceSetter(InstanceSetterComp* comp, 449 void FlowGraphOptimizer::VisitInstanceSetter(InstanceSetterComp* comp,
446 BindInstr* instr) { 450 BindInstr* instr) {
447 // TODO(srdjan): Add assignable check node if --enable_type_checks. 451 // TODO(srdjan): Add assignable check node if --enable_type_checks.
448 if (comp->HasICData() && !FLAG_enable_type_checks) { 452 if (comp->HasICData() && !FLAG_enable_type_checks) {
449 if (TryInlineInstanceSetter(instr, comp)) { 453 if (TryInlineInstanceSetter(instr, comp)) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 const ICData& ic_data = *comp->ic_data(); 513 const ICData& ic_data = *comp->ic_data();
510 if (ic_data.NumberOfChecks() == 0) return; 514 if (ic_data.NumberOfChecks() == 0) return;
511 // TODO(srdjan): Add multiple receiver type support. 515 // TODO(srdjan): Add multiple receiver type support.
512 if (ic_data.NumberOfChecks() != 1) return; 516 if (ic_data.NumberOfChecks() != 1) return;
513 ASSERT(HasOneTarget(ic_data)); 517 ASSERT(HasOneTarget(ic_data));
514 518
515 if (HasOnlyTwoSmi(ic_data)) { 519 if (HasOnlyTwoSmi(ic_data)) {
516 comp->set_operands_class_id(kSmi); 520 comp->set_operands_class_id(kSmi);
517 } else if (HasOnlyTwoDouble(ic_data)) { 521 } else if (HasOnlyTwoDouble(ic_data)) {
518 comp->set_operands_class_id(kDouble); 522 comp->set_operands_class_id(kDouble);
519 } else {
520 return;
521 } 523 }
522 } 524 }
523 525
524 526
525 void FlowGraphOptimizer::VisitEqualityCompare(EqualityCompareComp* comp, 527 void FlowGraphOptimizer::VisitEqualityCompare(EqualityCompareComp* comp,
526 BindInstr* instr) { 528 BindInstr* instr) {
527 if (comp->HasICData() && (comp->ic_data()->NumberOfChecks() == 1)) { 529 if (comp->HasICData() && (comp->ic_data()->NumberOfChecks() == 1)) {
528 ASSERT(comp->ic_data()->num_args_tested() == 2); 530 ASSERT(comp->ic_data()->num_args_tested() == 2);
529 GrowableArray<intptr_t> class_ids; 531 GrowableArray<intptr_t> class_ids;
530 Function& target = Function::Handle(); 532 Function& target = Function::Handle();
(...skipping 22 matching lines...) Expand all
553 LocationSummary* locs = it.Current()->locs(); 555 LocationSummary* locs = it.Current()->locs();
554 if ((locs != NULL) && locs->is_call()) { 556 if ((locs != NULL) && locs->is_call()) {
555 is_leaf_ = false; 557 is_leaf_ = false;
556 return; 558 return;
557 } 559 }
558 } 560 }
559 } 561 }
560 } 562 }
561 563
562 } // namespace dart 564 } // namespace dart
OLDNEW
« no previous file with comments | « vm/flow_graph_builder.cc ('k') | vm/il_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698