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

Side by Side Diff: vm/flow_graph_optimizer.cc

Issue 10834311: Split ToDouble into two IL instruction to make it work with SSA. (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
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 #include "vm/parser.h" 10 #include "vm/parser.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 if ((ic_data.NumberOfChecks() == 0) || !HasOneTarget(ic_data)) { 371 if ((ic_data.NumberOfChecks() == 0) || !HasOneTarget(ic_data)) {
372 // No type feedback collected. 372 // No type feedback collected.
373 return false; 373 return false;
374 } 374 }
375 Function& target = Function::Handle(); 375 Function& target = Function::Handle();
376 GrowableArray<intptr_t> class_ids; 376 GrowableArray<intptr_t> class_ids;
377 ic_data.GetCheckAt(0, &class_ids, &target); 377 ic_data.GetCheckAt(0, &class_ids, &target);
378 MethodRecognizer::Kind recognized_kind = 378 MethodRecognizer::Kind recognized_kind =
379 MethodRecognizer::RecognizeKind(target); 379 MethodRecognizer::RecognizeKind(target);
380 380
381 intptr_t from_class_id; 381 if ((recognized_kind == MethodRecognizer::kDoubleToDouble) &&
382 if (recognized_kind == MethodRecognizer::kDoubleToDouble) { 382 (class_ids[0] == kDoubleCid)) {
383 from_class_id = kDoubleCid; 383 DoubleToDoubleComp* d2d_comp =
384 } else if (recognized_kind == MethodRecognizer::kIntegerToDouble) { 384 new DoubleToDoubleComp(comp->ArgumentAt(0)->value(), comp);
385 from_class_id = kSmiCid; 385 instr->set_computation(d2d_comp);
386 } else { 386 RemovePushArguments(comp);
387 return false; 387 return true;
388 } else if ((recognized_kind == MethodRecognizer::kIntegerToDouble) &&
389 (class_ids[0] == kSmiCid)) {
srdjan 2012/08/14 21:21:26 No else needed, previous if terminates with a retu
Florian Schneider 2012/08/15 10:27:23 Done.
390 SmiToDoubleComp* s2d_comp = new SmiToDoubleComp(comp);
391 instr->set_computation(s2d_comp);
392 // Pushed arguments are not removed because SmiToDouble is implemented
393 // as a call.
394 return true;
388 } 395 }
389 396 return false;
390 if (class_ids[0] != from_class_id) {
391 return false;
392 }
393 ToDoubleComp* coerce = new ToDoubleComp(
394 comp->ArgumentAt(0)->value(), from_class_id, comp);
395 instr->set_computation(coerce);
396 RemovePushArguments(comp);
397 return true;
398 } 397 }
399 398
400 399
401 void FlowGraphOptimizer::VisitInstanceCall(InstanceCallComp* comp, 400 void FlowGraphOptimizer::VisitInstanceCall(InstanceCallComp* comp,
402 BindInstr* instr) { 401 BindInstr* instr) {
403 if (comp->HasICData() && (comp->ic_data()->NumberOfChecks() > 0)) { 402 if (comp->HasICData() && (comp->ic_data()->NumberOfChecks() > 0)) {
404 const Token::Kind op_kind = comp->token_kind(); 403 const Token::Kind op_kind = comp->token_kind();
405 if (Token::IsBinaryToken(op_kind) && 404 if (Token::IsBinaryToken(op_kind) &&
406 TryReplaceWithBinaryOp(instr, comp, op_kind)) { 405 TryReplaceWithBinaryOp(instr, comp, op_kind)) {
407 return; 406 return;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 LocationSummary* locs = it.Current()->locs(); 717 LocationSummary* locs = it.Current()->locs();
719 if ((locs != NULL) && locs->contains_call()) { 718 if ((locs != NULL) && locs->contains_call()) {
720 is_leaf_ = false; 719 is_leaf_ = false;
721 return; 720 return;
722 } 721 }
723 } 722 }
724 } 723 }
725 } 724 }
726 725
727 } // namespace dart 726 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698