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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/string_patch.dart ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 22468)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -1593,18 +1593,36 @@
ReplaceCall(call, instr);
return true;
}
- if ((recognized_kind == MethodRecognizer::kStringBaseCharAt) &&
- (ic_data.NumberOfChecks() == 1) &&
- (class_ids[0] == kOneByteStringCid)) {
- // TODO(fschneider): Handle TwoByteString.
- LoadIndexedInstr* load_char_code =
- BuildStringCodeUnitAt(call, class_ids[0]);
- InsertBefore(call, load_char_code, NULL, Definition::kValue);
- StringFromCharCodeInstr* char_at =
- new StringFromCharCodeInstr(new Value(load_char_code),
- kOneByteStringCid);
- ReplaceCall(call, char_at);
- return true;
+ if ((class_ids[0] == kOneByteStringCid) && (ic_data.NumberOfChecks() == 1)) {
+ if (recognized_kind == MethodRecognizer::kStringBaseCharAt) {
+ // TODO(fschneider): Handle TwoByteString.
+ LoadIndexedInstr* load_char_code =
+ BuildStringCodeUnitAt(call, class_ids[0]);
+ InsertBefore(call, load_char_code, NULL, Definition::kValue);
+ StringFromCharCodeInstr* char_at =
+ new StringFromCharCodeInstr(new Value(load_char_code),
+ kOneByteStringCid);
+ ReplaceCall(call, char_at);
+ return true;
+ } 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.
+ // This is an internal method, no need to check argument types nor
+ // range.
+ Definition* str = call->ArgumentAt(0);
+ Definition* index = call->ArgumentAt(1);
+ Definition* value = call->ArgumentAt(2);
+ StoreIndexedInstr* store_op = new StoreIndexedInstr(
+ new Value(str),
+ new Value(index),
+ new Value(value),
+ kNoStoreBarrier,
+ 1, // Index scale
+ kOneByteStringCid,
+ call->deopt_id());
+ ReplaceCall(call, store_op);
+ return true;
+ } else {
Florian Schneider 2013/05/08 12:44:10 else not necessary because of the return
srdjan 2013/05/08 19:10:58 Done.
+ return false;
+ }
}
if ((recognized_kind == MethodRecognizer::kIntegerToDouble) &&
« 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