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

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

Issue 19695007: Optimize double min/max by reducing the code size (reusing left register as result removes the need… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 2528 matching lines...) Expand 10 before | Expand all | Expand 10 after
2539 } else if ((recognized_kind == MethodRecognizer::kMathMin) || 2539 } else if ((recognized_kind == MethodRecognizer::kMathMin) ||
2540 (recognized_kind == MethodRecognizer::kMathMax)) { 2540 (recognized_kind == MethodRecognizer::kMathMax)) {
2541 // We can handle only monomorphic min/max call sites with both arguments 2541 // We can handle only monomorphic min/max call sites with both arguments
2542 // being either doubles or Smi-s 2542 // being either doubles or Smi-s
2543 if (call->HasICData() && (call->ic_data()->NumberOfChecks() == 1)) { 2543 if (call->HasICData() && (call->ic_data()->NumberOfChecks() == 1)) {
2544 const ICData& ic_data = *call->ic_data(); 2544 const ICData& ic_data = *call->ic_data();
2545 intptr_t result_cid = kIllegalCid; 2545 intptr_t result_cid = kIllegalCid;
2546 if (ICDataHasReceiverArgumentClassIds(ic_data, kDoubleCid, kDoubleCid)) { 2546 if (ICDataHasReceiverArgumentClassIds(ic_data, kDoubleCid, kDoubleCid)) {
2547 result_cid = kDoubleCid; 2547 result_cid = kDoubleCid;
2548 } else if (ICDataHasReceiverArgumentClassIds(ic_data, kSmiCid, kSmiCid)) { 2548 } else if (ICDataHasReceiverArgumentClassIds(ic_data, kSmiCid, kSmiCid)) {
2549 // TODO(srdjan): Implement for Smi. 2549 result_cid = kSmiCid;
2550 result_cid = kIllegalCid;
2551 } 2550 }
2552 if (result_cid != kIllegalCid) { 2551 if (result_cid != kIllegalCid) {
2553 MathMinMaxInstr* min_max = new MathMinMaxInstr( 2552 MathMinMaxInstr* min_max = new MathMinMaxInstr(
2554 recognized_kind, 2553 recognized_kind,
2555 new Value(call->ArgumentAt(0)), 2554 new Value(call->ArgumentAt(0)),
2556 new Value(call->ArgumentAt(1)), 2555 new Value(call->ArgumentAt(1)),
2557 call->deopt_id(), 2556 call->deopt_id(),
2558 result_cid); 2557 result_cid);
2559 const ICData& unary_checks = 2558 const ICData& unary_checks =
2560 ICData::ZoneHandle(ic_data.AsUnaryClassChecks()); 2559 ICData::ZoneHandle(ic_data.AsUnaryClassChecks());
(...skipping 4681 matching lines...) Expand 10 before | Expand all | Expand 10 after
7242 7241
7243 // Insert materializations at environment uses. 7242 // Insert materializations at environment uses.
7244 const Class& cls = Class::Handle(alloc->constructor().Owner()); 7243 const Class& cls = Class::Handle(alloc->constructor().Owner());
7245 for (intptr_t i = 0; i < exits.length(); i++) { 7244 for (intptr_t i = 0; i < exits.length(); i++) {
7246 CreateMaterializationAt(exits[i], alloc, cls, *fields); 7245 CreateMaterializationAt(exits[i], alloc, cls, *fields);
7247 } 7246 }
7248 } 7247 }
7249 7248
7250 7249
7251 } // namespace dart 7250 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intermediate_language_arm.cc » ('j') | runtime/vm/intermediate_language_ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698