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

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

Issue 683433003: Integrate the Irregexp Regular Expression Engine. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: more comments Created 6 years 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/flow_graph_range_analysis.cc ('k') | runtime/vm/growable_array.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_type_propagator.h" 5 #include "vm/flow_graph_type_propagator.h"
6 6
7 #include "vm/cha.h" 7 #include "vm/cha.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/il_printer.h" 9 #include "vm/il_printer.h"
10 #include "vm/regexp_assembler.h"
10 11
11 namespace dart { 12 namespace dart {
12 13
13 DEFINE_FLAG(bool, trace_type_propagation, false, 14 DEFINE_FLAG(bool, trace_type_propagation, false,
14 "Trace flow graph type propagation"); 15 "Trace flow graph type propagation");
15 16
16 DECLARE_FLAG(bool, enable_type_checks); 17 DECLARE_FLAG(bool, enable_type_checks);
17 DECLARE_FLAG(bool, propagate_types); 18 DECLARE_FLAG(bool, propagate_types);
18 DECLARE_FLAG(bool, use_cha); 19 DECLARE_FLAG(bool, use_cha);
19 20
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 // Parameters at catch blocks and OSR entries have type dynamic. 703 // Parameters at catch blocks and OSR entries have type dynamic.
703 // 704 //
704 // TODO(kmillikin): Use the actual type of the parameter at OSR entry. 705 // TODO(kmillikin): Use the actual type of the parameter at OSR entry.
705 // The code below is not safe for OSR because it doesn't necessarily use 706 // The code below is not safe for OSR because it doesn't necessarily use
706 // the correct scope. 707 // the correct scope.
707 if ((graph_entry == NULL) || graph_entry->IsCompiledForOsr()) { 708 if ((graph_entry == NULL) || graph_entry->IsCompiledForOsr()) {
708 return CompileType::Dynamic(); 709 return CompileType::Dynamic();
709 } 710 }
710 711
711 const Function& function = graph_entry->parsed_function().function(); 712 const Function& function = graph_entry->parsed_function().function();
713 if (function.IsIrregexpFunction()) {
714 // In irregexp functions, types of input parameters are known and immutable.
715 // Set parameter types here in order to prevent unnecessary CheckClassInstr
716 // from being generated.
717 switch (index()) {
718 case RegExpMacroAssembler::kParamStringIndex:
719 return CompileType::FromCid(function.regexp_cid());
720 case RegExpMacroAssembler::kParamStartOffsetIndex:
721 return CompileType::FromCid(kSmiCid);
722 default: UNREACHABLE();
723 }
724 UNREACHABLE();
725 return CompileType::Dynamic();
726 }
727
712 LocalScope* scope = graph_entry->parsed_function().node_sequence()->scope(); 728 LocalScope* scope = graph_entry->parsed_function().node_sequence()->scope();
713 const AbstractType& type = scope->VariableAt(index())->type(); 729 const AbstractType& type = scope->VariableAt(index())->type();
714 730
715 // Parameter is the constructor phase. 731 // Parameter is the constructor phase.
716 if ((index() == 1) && function.IsConstructor()) { 732 if ((index() == 1) && function.IsConstructor()) {
717 return CompileType::FromAbstractType(type, CompileType::kNonNullable); 733 return CompileType::FromAbstractType(type, CompileType::kNonNullable);
718 } 734 }
719 735
720 // Parameter is the receiver. 736 // Parameter is the receiver.
721 if ((index() == 0) && 737 if ((index() == 0) &&
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 field_cid = kDynamicCid; 1004 field_cid = kDynamicCid;
989 } 1005 }
990 return CompileType(is_nullable, field_cid, abstract_type); 1006 return CompileType(is_nullable, field_cid, abstract_type);
991 } 1007 }
992 1008
993 ASSERT(!Field::IsExternalizableCid(result_cid_)); 1009 ASSERT(!Field::IsExternalizableCid(result_cid_));
994 return CompileType::Create(result_cid_, *abstract_type); 1010 return CompileType::Create(result_cid_, *abstract_type);
995 } 1011 }
996 1012
997 1013
1014 CompileType LoadCodeUnitsInstr::ComputeType() const {
1015 switch (class_id()) {
1016 case kOneByteStringCid:
1017 case kExternalOneByteStringCid:
1018 case kTwoByteStringCid:
1019 case kExternalTwoByteStringCid:
1020 return can_pack_into_smi() ? CompileType::FromCid(kSmiCid)
1021 : CompileType::Int();
1022 default:
1023 UNIMPLEMENTED();
1024 return CompileType::Dynamic();
1025 }
1026 }
1027
1028
998 CompileType BinaryInt32OpInstr::ComputeType() const { 1029 CompileType BinaryInt32OpInstr::ComputeType() const {
999 // TODO(vegorov): range analysis information shall be used here. 1030 // TODO(vegorov): range analysis information shall be used here.
1000 return CompileType::Int(); 1031 return CompileType::Int();
1001 } 1032 }
1002 1033
1003 1034
1004 CompileType BinarySmiOpInstr::ComputeType() const { 1035 CompileType BinarySmiOpInstr::ComputeType() const {
1005 return CompileType::FromCid(kSmiCid); 1036 return CompileType::FromCid(kSmiCid);
1006 } 1037 }
1007 1038
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 CompileType MathUnaryInstr::ComputeType() const { 1278 CompileType MathUnaryInstr::ComputeType() const {
1248 return CompileType::FromCid(kDoubleCid); 1279 return CompileType::FromCid(kDoubleCid);
1249 } 1280 }
1250 1281
1251 1282
1252 CompileType MathMinMaxInstr::ComputeType() const { 1283 CompileType MathMinMaxInstr::ComputeType() const {
1253 return CompileType::FromCid(result_cid_); 1284 return CompileType::FromCid(result_cid_);
1254 } 1285 }
1255 1286
1256 1287
1288 CompileType CaseInsensitiveCompareUC16Instr::ComputeType() const {
1289 return CompileType::FromCid(kBoolCid);
1290 }
1291
1292
1257 CompileType UnboxInstr::ComputeType() const { 1293 CompileType UnboxInstr::ComputeType() const {
1258 switch (representation()) { 1294 switch (representation()) {
1259 case kUnboxedDouble: 1295 case kUnboxedDouble:
1260 return CompileType::FromCid(kDoubleCid); 1296 return CompileType::FromCid(kDoubleCid);
1261 1297
1262 case kUnboxedFloat32x4: 1298 case kUnboxedFloat32x4:
1263 return CompileType::FromCid(kFloat32x4Cid); 1299 return CompileType::FromCid(kFloat32x4Cid);
1264 1300
1265 case kUnboxedFloat64x2: 1301 case kUnboxedFloat64x2:
1266 return CompileType::FromCid(kFloat64x2Cid); 1302 return CompileType::FromCid(kFloat64x2Cid);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 CompileType MergedMathInstr::ComputeType() const { 1374 CompileType MergedMathInstr::ComputeType() const {
1339 return CompileType::Dynamic(); 1375 return CompileType::Dynamic();
1340 } 1376 }
1341 1377
1342 1378
1343 CompileType ExtractNthOutputInstr::ComputeType() const { 1379 CompileType ExtractNthOutputInstr::ComputeType() const {
1344 return CompileType::FromCid(definition_cid_); 1380 return CompileType::FromCid(definition_cid_);
1345 } 1381 }
1346 1382
1347 } // namespace dart 1383 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_range_analysis.cc ('k') | runtime/vm/growable_array.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698