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

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

Issue 14917020: Inline _OneByteString._setAt. The key knowledge is that _setAt is an internal method that has to be… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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/lib/string_patch.dart ('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) 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/flow_graph_builder.h" 9 #include "vm/flow_graph_builder.h"
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 MethodRecognizer::RecognizeKind(target); 1586 MethodRecognizer::RecognizeKind(target);
1587 1587
1588 if ((recognized_kind == MethodRecognizer::kStringBaseCodeUnitAt) && 1588 if ((recognized_kind == MethodRecognizer::kStringBaseCodeUnitAt) &&
1589 (ic_data.NumberOfChecks() == 1) && 1589 (ic_data.NumberOfChecks() == 1) &&
1590 ((class_ids[0] == kOneByteStringCid) || 1590 ((class_ids[0] == kOneByteStringCid) ||
1591 (class_ids[0] == kTwoByteStringCid))) { 1591 (class_ids[0] == kTwoByteStringCid))) {
1592 LoadIndexedInstr* instr = BuildStringCodeUnitAt(call, class_ids[0]); 1592 LoadIndexedInstr* instr = BuildStringCodeUnitAt(call, class_ids[0]);
1593 ReplaceCall(call, instr); 1593 ReplaceCall(call, instr);
1594 return true; 1594 return true;
1595 } 1595 }
1596 if ((recognized_kind == MethodRecognizer::kStringBaseCharAt) && 1596 if ((class_ids[0] == kOneByteStringCid) && (ic_data.NumberOfChecks() == 1)) {
1597 (ic_data.NumberOfChecks() == 1) && 1597 if (recognized_kind == MethodRecognizer::kStringBaseCharAt) {
1598 (class_ids[0] == kOneByteStringCid)) { 1598 // TODO(fschneider): Handle TwoByteString.
1599 // TODO(fschneider): Handle TwoByteString. 1599 LoadIndexedInstr* load_char_code =
1600 LoadIndexedInstr* load_char_code = 1600 BuildStringCodeUnitAt(call, class_ids[0]);
1601 BuildStringCodeUnitAt(call, class_ids[0]); 1601 InsertBefore(call, load_char_code, NULL, Definition::kValue);
1602 InsertBefore(call, load_char_code, NULL, Definition::kValue); 1602 StringFromCharCodeInstr* char_at =
1603 StringFromCharCodeInstr* char_at = 1603 new StringFromCharCodeInstr(new Value(load_char_code),
1604 new StringFromCharCodeInstr(new Value(load_char_code), 1604 kOneByteStringCid);
1605 kOneByteStringCid); 1605 ReplaceCall(call, char_at);
1606 ReplaceCall(call, char_at); 1606 return true;
1607 return true; 1607 } else if (recognized_kind == MethodRecognizer::kOneByteStringSetAt) {
Florian Schneider 2013/05/08 12:44:10 You could just use if instead of else-if because o
srdjan 2013/05/08 19:10:58 Done.
1608 // This is an internal method, no need to check argument types nor
1609 // range.
1610 Definition* str = call->ArgumentAt(0);
1611 Definition* index = call->ArgumentAt(1);
1612 Definition* value = call->ArgumentAt(2);
1613 StoreIndexedInstr* store_op = new StoreIndexedInstr(
1614 new Value(str),
1615 new Value(index),
1616 new Value(value),
1617 kNoStoreBarrier,
1618 1, // Index scale
1619 kOneByteStringCid,
1620 call->deopt_id());
1621 ReplaceCall(call, store_op);
1622 return true;
1623 } else {
Florian Schneider 2013/05/08 12:44:10 else not necessary because of the return
srdjan 2013/05/08 19:10:58 Done.
1624 return false;
1625 }
1608 } 1626 }
1609 1627
1610 if ((recognized_kind == MethodRecognizer::kIntegerToDouble) && 1628 if ((recognized_kind == MethodRecognizer::kIntegerToDouble) &&
1611 (ic_data.NumberOfChecks() == 1) && 1629 (ic_data.NumberOfChecks() == 1) &&
1612 (class_ids[0] == kSmiCid)) { 1630 (class_ids[0] == kSmiCid)) {
1613 AddReceiverCheck(call); 1631 AddReceiverCheck(call);
1614 ReplaceCall(call, new SmiToDoubleInstr(new Value(call->ArgumentAt(0)))); 1632 ReplaceCall(call, new SmiToDoubleInstr(new Value(call->ArgumentAt(0))));
1615 return true; 1633 return true;
1616 } 1634 }
1617 1635
(...skipping 4170 matching lines...) Expand 10 before | Expand all | Expand 10 after
5788 if (changed) { 5806 if (changed) {
5789 // We may have changed the block order and the dominator tree. 5807 // We may have changed the block order and the dominator tree.
5790 flow_graph->DiscoverBlocks(); 5808 flow_graph->DiscoverBlocks();
5791 GrowableArray<BitVector*> dominance_frontier; 5809 GrowableArray<BitVector*> dominance_frontier;
5792 flow_graph->ComputeDominators(&dominance_frontier); 5810 flow_graph->ComputeDominators(&dominance_frontier);
5793 } 5811 }
5794 } 5812 }
5795 5813
5796 5814
5797 } // namespace dart 5815 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/string_patch.dart ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698