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

Side by Side Diff: runtime/vm/flow_graph_optimizer.cc

Issue 10536162: Add token kind into InstanceCallComp so that we do not need to extract it from name (addresses vego… (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/intermediate_language.h » ('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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 return false; 437 return false;
438 } 438 }
439 ToDoubleComp* coerce = new ToDoubleComp( 439 ToDoubleComp* coerce = new ToDoubleComp(
440 comp->InputAt(0), from_kind, comp); 440 comp->InputAt(0), from_kind, comp);
441 coerce->set_instr(comp->instr()); 441 coerce->set_instr(comp->instr());
442 comp->instr()->replace_computation(coerce); 442 comp->instr()->replace_computation(coerce);
443 return true; 443 return true;
444 } 444 }
445 445
446 446
447
448
447 void FlowGraphOptimizer::VisitInstanceCall(InstanceCallComp* comp) { 449 void FlowGraphOptimizer::VisitInstanceCall(InstanceCallComp* comp) {
448 if (comp->HasICData() && (comp->ic_data()->NumberOfChecks() > 0)) { 450 if (comp->HasICData() && (comp->ic_data()->NumberOfChecks() > 0)) {
449 const String& function_name = comp->function_name(); 451 const Token::Kind op_kind = comp->token_kind();
450 Token::Kind op_kind = Token::GetBinaryOp(function_name); 452 if (Token::IsBinaryToken(op_kind) &&
451 if ((op_kind != Token::kILLEGAL) && TryReplaceWithBinaryOp(comp, op_kind)) { 453 TryReplaceWithBinaryOp(comp, op_kind)) {
452 return; 454 return;
453 } 455 }
454 op_kind = Token::GetUnaryOp(function_name); 456 if (Token::IsUnaryToken(op_kind) && TryReplaceWithUnaryOp(comp, op_kind)) {
455 if ((op_kind != Token::kILLEGAL) && TryReplaceWithUnaryOp(comp, op_kind)) {
456 return; 457 return;
457 } 458 }
458 if ((Field::IsGetterName(function_name)) && TryInlineInstanceGetter(comp)) { 459 if ((op_kind == Token::kGET) && TryInlineInstanceGetter(comp)) {
459 return; 460 return;
460 } 461 }
461 if (TryInlineInstanceMethod(comp)) { 462 if (TryInlineInstanceMethod(comp)) {
462 return; 463 return;
463 } 464 }
464 const intptr_t kMaxChecks = 4; 465 const intptr_t kMaxChecks = 4;
465 if (comp->ic_data()->num_args_tested() <= kMaxChecks) { 466 if (comp->ic_data()->num_args_tested() <= kMaxChecks) {
466 ZoneGrowableArray<intptr_t>* class_ids = 467 ZoneGrowableArray<intptr_t>* class_ids =
467 new ZoneGrowableArray<intptr_t>(); 468 new ZoneGrowableArray<intptr_t>();
468 ZoneGrowableArray<Function*>* targets = 469 ZoneGrowableArray<Function*>* targets =
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 instr->computation()->Accept(this); 642 instr->computation()->Accept(this);
642 } 643 }
643 644
644 645
645 void FlowGraphOptimizer::VisitBind(BindInstr* instr) { 646 void FlowGraphOptimizer::VisitBind(BindInstr* instr) {
646 instr->computation()->Accept(this); 647 instr->computation()->Accept(this);
647 } 648 }
648 649
649 650
650 } // namespace dart 651 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698