Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Class for intrinsifying functions. | 4 // Class for intrinsifying functions. |
| 5 | 5 |
| 6 #include "vm/assembler.h" | 6 #include "vm/assembler.h" |
| 7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
| 8 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
| 9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/flow_graph.h" | 10 #include "vm/flow_graph.h" |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 525 rep = kUnboxedInt32x4; | 525 rep = kUnboxedInt32x4; |
| 526 break; | 526 break; |
| 527 case kTypedDataFloat64x2ArrayCid: | 527 case kTypedDataFloat64x2ArrayCid: |
| 528 value_check_cid = kFloat64x2Cid; | 528 value_check_cid = kFloat64x2Cid; |
| 529 rep = kUnboxedFloat64x2; | 529 rep = kUnboxedFloat64x2; |
| 530 break; | 530 break; |
| 531 default: | 531 default: |
| 532 // Float32/Float64 case already handled. | 532 // Float32/Float64 case already handled. |
| 533 break; | 533 break; |
| 534 } | 534 } |
| 535 const ICData& value_check = ICData::ZoneHandle( | 535 Zone* zone = flow_graph->zone(); |
| 536 ICData::New(flow_graph->function(), | 536 Cids* value_check = new (zone) Cids(zone); |
| 537 Symbols::Empty(), // Dummy function name. | 537 value_check->Add(new (zone) CidRange(value_check_cid, value_check_cid)); |
|
Vyacheslav Egorov (Google)
2017/05/09 21:07:28
can this be Cids::CreateMonomorphic?
erikcorry
2017/05/10 08:47:43
Done.
| |
| 538 Object::empty_array(), // Dummy args. descr. | |
| 539 Thread::kNoDeoptId, 1, false)); | |
| 540 value_check.AddReceiverCheck(value_check_cid, flow_graph->function()); | |
| 541 builder.AddInstruction( | 538 builder.AddInstruction( |
| 542 new CheckClassInstr(new Value(value), Thread::kNoDeoptId, value_check, | 539 new CheckClassInstr(new Value(value), Thread::kNoDeoptId, |
| 543 builder.TokenPos())); | 540 *value_check, builder.TokenPos())); |
| 544 value = builder.AddUnboxInstr(rep, new Value(value), | 541 value = builder.AddUnboxInstr(rep, new Value(value), |
| 545 /* is_checked = */ true); | 542 /* is_checked = */ true); |
| 546 if (array_cid == kTypedDataFloat32ArrayCid) { | 543 if (array_cid == kTypedDataFloat32ArrayCid) { |
| 547 value = builder.AddDefinition( | 544 value = builder.AddDefinition( |
| 548 new DoubleToFloatInstr(new Value(value), Thread::kNoDeoptId)); | 545 new DoubleToFloatInstr(new Value(value), Thread::kNoDeoptId)); |
| 549 } | 546 } |
| 550 break; | 547 break; |
| 551 } | 548 } |
| 552 default: | 549 default: |
| 553 UNREACHABLE(); | 550 UNREACHABLE(); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 723 | 720 |
| 724 bool Intrinsifier::Build_ExternalTwoByteStringCodeUnitAt( | 721 bool Intrinsifier::Build_ExternalTwoByteStringCodeUnitAt( |
| 725 FlowGraph* flow_graph) { | 722 FlowGraph* flow_graph) { |
| 726 return BuildCodeUnitAt(flow_graph, kExternalTwoByteStringCid); | 723 return BuildCodeUnitAt(flow_graph, kExternalTwoByteStringCid); |
| 727 } | 724 } |
| 728 | 725 |
| 729 | 726 |
| 730 static bool BuildBinaryFloat32x4Op(FlowGraph* flow_graph, Token::Kind kind) { | 727 static bool BuildBinaryFloat32x4Op(FlowGraph* flow_graph, Token::Kind kind) { |
| 731 if (!FlowGraphCompiler::SupportsUnboxedSimd128()) return false; | 728 if (!FlowGraphCompiler::SupportsUnboxedSimd128()) return false; |
| 732 | 729 |
| 730 Zone* zone = flow_graph->zone(); | |
| 733 GraphEntryInstr* graph_entry = flow_graph->graph_entry(); | 731 GraphEntryInstr* graph_entry = flow_graph->graph_entry(); |
| 734 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); | 732 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); |
| 735 BlockBuilder builder(flow_graph, normal_entry); | 733 BlockBuilder builder(flow_graph, normal_entry); |
| 736 | 734 |
| 737 Definition* right = builder.AddParameter(1); | 735 Definition* right = builder.AddParameter(1); |
| 738 Definition* left = builder.AddParameter(2); | 736 Definition* left = builder.AddParameter(2); |
| 739 | 737 |
| 740 const ICData& value_check = ICData::ZoneHandle(ICData::New( | 738 Cids* value_check = new (zone) Cids(zone); |
| 741 flow_graph->function(), String::Handle(flow_graph->function().name()), | 739 value_check->Add(new (zone) CidRange(kFloat32x4Cid, kFloat32x4Cid)); |
|
Vyacheslav Egorov (Google)
2017/05/09 21:07:28
can this be Cids::CreateMonomorphic()?
erikcorry
2017/05/10 08:47:43
Done.
| |
| 742 Object::empty_array(), // Dummy args. descr. | |
| 743 Thread::kNoDeoptId, 1, false)); | |
| 744 value_check.AddReceiverCheck(kFloat32x4Cid, flow_graph->function()); | |
| 745 // Check argument. Receiver (left) is known to be a Float32x4. | 740 // Check argument. Receiver (left) is known to be a Float32x4. |
| 746 builder.AddInstruction(new CheckClassInstr( | 741 builder.AddInstruction(new CheckClassInstr( |
| 747 new Value(right), Thread::kNoDeoptId, value_check, builder.TokenPos())); | 742 new Value(right), Thread::kNoDeoptId, *value_check, builder.TokenPos())); |
| 748 Definition* left_simd = | 743 Definition* left_simd = |
| 749 builder.AddUnboxInstr(kUnboxedFloat32x4, new Value(left), | 744 builder.AddUnboxInstr(kUnboxedFloat32x4, new Value(left), |
| 750 /* is_checked = */ true); | 745 /* is_checked = */ true); |
| 751 | 746 |
| 752 Definition* right_simd = | 747 Definition* right_simd = |
| 753 builder.AddUnboxInstr(kUnboxedFloat32x4, new Value(right), | 748 builder.AddUnboxInstr(kUnboxedFloat32x4, new Value(right), |
| 754 /* is_checked = */ true); | 749 /* is_checked = */ true); |
| 755 | 750 |
| 756 Definition* unboxed_result = builder.AddDefinition(new BinaryFloat32x4OpInstr( | 751 Definition* unboxed_result = builder.AddDefinition(new BinaryFloat32x4OpInstr( |
| 757 kind, new Value(left_simd), new Value(right_simd), Thread::kNoDeoptId)); | 752 kind, new Value(left_simd), new Value(right_simd), Thread::kNoDeoptId)); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 939 } | 934 } |
| 940 | 935 |
| 941 | 936 |
| 942 bool Intrinsifier::Build_GrowableArraySetData(FlowGraph* flow_graph) { | 937 bool Intrinsifier::Build_GrowableArraySetData(FlowGraph* flow_graph) { |
| 943 GraphEntryInstr* graph_entry = flow_graph->graph_entry(); | 938 GraphEntryInstr* graph_entry = flow_graph->graph_entry(); |
| 944 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); | 939 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); |
| 945 BlockBuilder builder(flow_graph, normal_entry); | 940 BlockBuilder builder(flow_graph, normal_entry); |
| 946 | 941 |
| 947 Definition* data = builder.AddParameter(1); | 942 Definition* data = builder.AddParameter(1); |
| 948 Definition* growable_array = builder.AddParameter(2); | 943 Definition* growable_array = builder.AddParameter(2); |
| 944 Zone* zone = flow_graph->zone(); | |
| 949 | 945 |
| 950 const ICData& value_check = ICData::ZoneHandle(ICData::New( | 946 Cids* value_check = Cids::CreateMonomorphic(zone, kArrayCid); |
| 951 flow_graph->function(), String::Handle(flow_graph->function().name()), | |
| 952 Object::empty_array(), // Dummy args. descr. | |
| 953 Thread::kNoDeoptId, 1, false)); | |
| 954 value_check.AddReceiverCheck(kArrayCid, flow_graph->function()); | |
| 955 builder.AddInstruction(new CheckClassInstr( | 947 builder.AddInstruction(new CheckClassInstr( |
| 956 new Value(data), Thread::kNoDeoptId, value_check, builder.TokenPos())); | 948 new Value(data), Thread::kNoDeoptId, *value_check, builder.TokenPos())); |
| 957 | 949 |
| 958 builder.AddInstruction(new StoreInstanceFieldInstr( | 950 builder.AddInstruction(new StoreInstanceFieldInstr( |
| 959 GrowableObjectArray::data_offset(), new Value(growable_array), | 951 GrowableObjectArray::data_offset(), new Value(growable_array), |
| 960 new Value(data), kEmitStoreBarrier, builder.TokenPos())); | 952 new Value(data), kEmitStoreBarrier, builder.TokenPos())); |
| 961 // Return null. | 953 // Return null. |
| 962 Definition* null_def = builder.AddNullDefinition(); | 954 Definition* null_def = builder.AddNullDefinition(); |
| 963 builder.AddIntrinsicReturn(new Value(null_def)); | 955 builder.AddIntrinsicReturn(new Value(null_def)); |
| 964 return true; | 956 return true; |
| 965 } | 957 } |
| 966 | 958 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1181 } | 1173 } |
| 1182 | 1174 |
| 1183 | 1175 |
| 1184 void Intrinsifier::RegExp_ExecuteMatchSticky(Assembler* assembler) { | 1176 void Intrinsifier::RegExp_ExecuteMatchSticky(Assembler* assembler) { |
| 1185 IntrinsifyRegExpExecuteMatch(assembler, /*sticky=*/true); | 1177 IntrinsifyRegExpExecuteMatch(assembler, /*sticky=*/true); |
| 1186 } | 1178 } |
| 1187 #endif // !defined(TARGET_ARCH_DBC) | 1179 #endif // !defined(TARGET_ARCH_DBC) |
| 1188 | 1180 |
| 1189 | 1181 |
| 1190 } // namespace dart | 1182 } // namespace dart |
| OLD | NEW |