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

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

Issue 754383002: Revert "Integrate the Irregexp Regular Expression Engine." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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"
11 10
12 namespace dart { 11 namespace dart {
13 12
14 DEFINE_FLAG(bool, trace_type_propagation, false, 13 DEFINE_FLAG(bool, trace_type_propagation, false,
15 "Trace flow graph type propagation"); 14 "Trace flow graph type propagation");
16 15
17 DECLARE_FLAG(bool, enable_type_checks); 16 DECLARE_FLAG(bool, enable_type_checks);
18 DECLARE_FLAG(bool, propagate_types); 17 DECLARE_FLAG(bool, propagate_types);
19 DECLARE_FLAG(bool, use_cha); 18 DECLARE_FLAG(bool, use_cha);
20 19
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 // Parameters at catch blocks and OSR entries have type dynamic. 702 // Parameters at catch blocks and OSR entries have type dynamic.
704 // 703 //
705 // TODO(kmillikin): Use the actual type of the parameter at OSR entry. 704 // TODO(kmillikin): Use the actual type of the parameter at OSR entry.
706 // The code below is not safe for OSR because it doesn't necessarily use 705 // The code below is not safe for OSR because it doesn't necessarily use
707 // the correct scope. 706 // the correct scope.
708 if ((graph_entry == NULL) || graph_entry->IsCompiledForOsr()) { 707 if ((graph_entry == NULL) || graph_entry->IsCompiledForOsr()) {
709 return CompileType::Dynamic(); 708 return CompileType::Dynamic();
710 } 709 }
711 710
712 const Function& function = graph_entry->parsed_function().function(); 711 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
728 LocalScope* scope = graph_entry->parsed_function().node_sequence()->scope(); 712 LocalScope* scope = graph_entry->parsed_function().node_sequence()->scope();
729 const AbstractType& type = scope->VariableAt(index())->type(); 713 const AbstractType& type = scope->VariableAt(index())->type();
730 714
731 // Parameter is the constructor phase. 715 // Parameter is the constructor phase.
732 if ((index() == 1) && function.IsConstructor()) { 716 if ((index() == 1) && function.IsConstructor()) {
733 return CompileType::FromAbstractType(type, CompileType::kNonNullable); 717 return CompileType::FromAbstractType(type, CompileType::kNonNullable);
734 } 718 }
735 719
736 // Parameter is the receiver. 720 // Parameter is the receiver.
737 if ((index() == 0) && 721 if ((index() == 0) &&
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 field_cid = kDynamicCid; 988 field_cid = kDynamicCid;
1005 } 989 }
1006 return CompileType(is_nullable, field_cid, abstract_type); 990 return CompileType(is_nullable, field_cid, abstract_type);
1007 } 991 }
1008 992
1009 ASSERT(!Field::IsExternalizableCid(result_cid_)); 993 ASSERT(!Field::IsExternalizableCid(result_cid_));
1010 return CompileType::Create(result_cid_, *abstract_type); 994 return CompileType::Create(result_cid_, *abstract_type);
1011 } 995 }
1012 996
1013 997
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
1029 CompileType BinaryInt32OpInstr::ComputeType() const { 998 CompileType BinaryInt32OpInstr::ComputeType() const {
1030 // TODO(vegorov): range analysis information shall be used here. 999 // TODO(vegorov): range analysis information shall be used here.
1031 return CompileType::Int(); 1000 return CompileType::Int();
1032 } 1001 }
1033 1002
1034 1003
1035 CompileType BinarySmiOpInstr::ComputeType() const { 1004 CompileType BinarySmiOpInstr::ComputeType() const {
1036 return CompileType::FromCid(kSmiCid); 1005 return CompileType::FromCid(kSmiCid);
1037 } 1006 }
1038 1007
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 CompileType MathUnaryInstr::ComputeType() const { 1247 CompileType MathUnaryInstr::ComputeType() const {
1279 return CompileType::FromCid(kDoubleCid); 1248 return CompileType::FromCid(kDoubleCid);
1280 } 1249 }
1281 1250
1282 1251
1283 CompileType MathMinMaxInstr::ComputeType() const { 1252 CompileType MathMinMaxInstr::ComputeType() const {
1284 return CompileType::FromCid(result_cid_); 1253 return CompileType::FromCid(result_cid_);
1285 } 1254 }
1286 1255
1287 1256
1288 CompileType CaseInsensitiveCompareUC16Instr::ComputeType() const {
1289 return CompileType::FromCid(kBoolCid);
1290 }
1291
1292
1293 CompileType UnboxInstr::ComputeType() const { 1257 CompileType UnboxInstr::ComputeType() const {
1294 switch (representation()) { 1258 switch (representation()) {
1295 case kUnboxedDouble: 1259 case kUnboxedDouble:
1296 return CompileType::FromCid(kDoubleCid); 1260 return CompileType::FromCid(kDoubleCid);
1297 1261
1298 case kUnboxedFloat32x4: 1262 case kUnboxedFloat32x4:
1299 return CompileType::FromCid(kFloat32x4Cid); 1263 return CompileType::FromCid(kFloat32x4Cid);
1300 1264
1301 case kUnboxedFloat64x2: 1265 case kUnboxedFloat64x2:
1302 return CompileType::FromCid(kFloat64x2Cid); 1266 return CompileType::FromCid(kFloat64x2Cid);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 CompileType MergedMathInstr::ComputeType() const { 1338 CompileType MergedMathInstr::ComputeType() const {
1375 return CompileType::Dynamic(); 1339 return CompileType::Dynamic();
1376 } 1340 }
1377 1341
1378 1342
1379 CompileType ExtractNthOutputInstr::ComputeType() const { 1343 CompileType ExtractNthOutputInstr::ComputeType() const {
1380 return CompileType::FromCid(definition_cid_); 1344 return CompileType::FromCid(definition_cid_);
1381 } 1345 }
1382 1346
1383 } // namespace dart 1347 } // 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