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

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

Issue 47073009: Improve indexOf for one byte string receiver to work with other string classes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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/dart_api_impl_test.cc ('k') | runtime/vm/symbols.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/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 3106 matching lines...) Expand 10 before | Expand all | Expand 10 after
3117 // InvokeMathCFunctionInstr requires unboxed doubles. UnboxDouble 3117 // InvokeMathCFunctionInstr requires unboxed doubles. UnboxDouble
3118 // instructions contain type checks and conversions to double. 3118 // instructions contain type checks and conversions to double.
3119 ZoneGrowableArray<Value*>* args = 3119 ZoneGrowableArray<Value*>* args =
3120 new ZoneGrowableArray<Value*>(call->ArgumentCount()); 3120 new ZoneGrowableArray<Value*>(call->ArgumentCount());
3121 for (intptr_t i = 0; i < call->ArgumentCount(); i++) { 3121 for (intptr_t i = 0; i < call->ArgumentCount(); i++) {
3122 args->Add(new Value(call->ArgumentAt(i))); 3122 args->Add(new Value(call->ArgumentAt(i)));
3123 } 3123 }
3124 InvokeMathCFunctionInstr* invoke = 3124 InvokeMathCFunctionInstr* invoke =
3125 new InvokeMathCFunctionInstr(args, call->deopt_id(), recognized_kind); 3125 new InvokeMathCFunctionInstr(args, call->deopt_id(), recognized_kind);
3126 ReplaceCall(call, invoke); 3126 ReplaceCall(call, invoke);
3127 } else if (Library::PrivateCoreLibName(Symbols::ClassId()).Equals(
3128 String::Handle(call->function().name()))) {
3129 // Check for core library get:_classId.
3130 intptr_t cid = Class::Handle(call->function().Owner()).id();
3131 // Currently only implemented for a subset of classes.
3132 ASSERT((cid == kOneByteStringCid) || (cid == kTwoByteStringCid) ||
3133 (cid == kExternalOneByteStringCid) ||
3134 (cid == kGrowableObjectArrayCid) ||
3135 (cid == kImmutableArrayCid) || (cid == kArrayCid));
3136 ConstantInstr* cid_instr = new ConstantInstr(Smi::Handle(Smi::New(cid)));
3137 ReplaceCall(call, cid_instr);
3127 } 3138 }
3128 } 3139 }
3129 3140
3130 3141
3131 bool FlowGraphOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr, 3142 bool FlowGraphOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr,
3132 const ICData& unary_ic_data) { 3143 const ICData& unary_ic_data) {
3133 ASSERT((unary_ic_data.NumberOfChecks() > 0) && 3144 ASSERT((unary_ic_data.NumberOfChecks() > 0) &&
3134 (unary_ic_data.num_args_tested() == 1)); 3145 (unary_ic_data.num_args_tested() == 1));
3135 if (FLAG_enable_type_checks) { 3146 if (FLAG_enable_type_checks) {
3136 // Checked mode setters are inlined like normal methods by conventional 3147 // Checked mode setters are inlined like normal methods by conventional
(...skipping 4735 matching lines...) Expand 10 before | Expand all | Expand 10 after
7872 } 7883 }
7873 7884
7874 // Insert materializations at environment uses. 7885 // Insert materializations at environment uses.
7875 for (intptr_t i = 0; i < exits.length(); i++) { 7886 for (intptr_t i = 0; i < exits.length(); i++) {
7876 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); 7887 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields);
7877 } 7888 }
7878 } 7889 }
7879 7890
7880 7891
7881 } // namespace dart 7892 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698