| 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 array = builder.AddDefinition( | 412 array = builder.AddDefinition( |
| 413 new LoadUntaggedInstr(new Value(array), | 413 new LoadUntaggedInstr(new Value(array), |
| 414 ExternalTypedData::data_offset())); | 414 ExternalTypedData::data_offset())); |
| 415 } | 415 } |
| 416 | 416 |
| 417 Definition* result = builder.AddDefinition( | 417 Definition* result = builder.AddDefinition( |
| 418 new LoadIndexedInstr(new Value(array), | 418 new LoadIndexedInstr(new Value(array), |
| 419 new Value(index), | 419 new Value(index), |
| 420 Instance::ElementSizeFor(array_cid), // index scale | 420 Instance::ElementSizeFor(array_cid), // index scale |
| 421 array_cid, | 421 array_cid, |
| 422 kAlignedAccess, |
| 422 Thread::kNoDeoptId, | 423 Thread::kNoDeoptId, |
| 423 builder.TokenPos())); | 424 builder.TokenPos())); |
| 424 // Box and/or convert result if necessary. | 425 // Box and/or convert result if necessary. |
| 425 switch (array_cid) { | 426 switch (array_cid) { |
| 426 case kTypedDataInt32ArrayCid: | 427 case kTypedDataInt32ArrayCid: |
| 427 case kExternalTypedDataInt32ArrayCid: | 428 case kExternalTypedDataInt32ArrayCid: |
| 428 result = builder.AddDefinition( | 429 result = builder.AddDefinition( |
| 429 BoxInstr::Create(kUnboxedInt32, new Value(result))); | 430 BoxInstr::Create(kUnboxedInt32, new Value(result))); |
| 430 break; | 431 break; |
| 431 case kTypedDataUint32ArrayCid: | 432 case kTypedDataUint32ArrayCid: |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 // No store barrier. | 575 // No store barrier. |
| 575 ASSERT(RawObject::IsExternalTypedDataClassId(array_cid) || | 576 ASSERT(RawObject::IsExternalTypedDataClassId(array_cid) || |
| 576 RawObject::IsTypedDataClassId(array_cid)); | 577 RawObject::IsTypedDataClassId(array_cid)); |
| 577 builder.AddInstruction( | 578 builder.AddInstruction( |
| 578 new StoreIndexedInstr(new Value(array), | 579 new StoreIndexedInstr(new Value(array), |
| 579 new Value(index), | 580 new Value(index), |
| 580 new Value(value), | 581 new Value(value), |
| 581 kNoStoreBarrier, | 582 kNoStoreBarrier, |
| 582 Instance::ElementSizeFor(array_cid), // index scale | 583 Instance::ElementSizeFor(array_cid), // index scale |
| 583 array_cid, | 584 array_cid, |
| 585 kAlignedAccess, |
| 584 Thread::kNoDeoptId, | 586 Thread::kNoDeoptId, |
| 585 builder.TokenPos())); | 587 builder.TokenPos())); |
| 586 // Return null. | 588 // Return null. |
| 587 Definition* null_def = builder.AddNullDefinition(); | 589 Definition* null_def = builder.AddNullDefinition(); |
| 588 builder.AddIntrinsicReturn(new Value(null_def)); | 590 builder.AddIntrinsicReturn(new Value(null_def)); |
| 589 return true; | 591 return true; |
| 590 } | 592 } |
| 591 | 593 |
| 592 | 594 |
| 593 #define DEFINE_ARRAY_GETTER_INTRINSIC(enum_name) \ | 595 #define DEFINE_ARRAY_GETTER_INTRINSIC(enum_name) \ |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 new LoadUntaggedInstr( | 728 new LoadUntaggedInstr( |
| 727 new Value(str), | 729 new Value(str), |
| 728 RawExternalTwoByteString::ExternalData::data_offset())); | 730 RawExternalTwoByteString::ExternalData::data_offset())); |
| 729 } | 731 } |
| 730 | 732 |
| 731 Definition* result = builder.AddDefinition( | 733 Definition* result = builder.AddDefinition( |
| 732 new LoadIndexedInstr(new Value(str), | 734 new LoadIndexedInstr(new Value(str), |
| 733 new Value(index), | 735 new Value(index), |
| 734 Instance::ElementSizeFor(cid), | 736 Instance::ElementSizeFor(cid), |
| 735 cid, | 737 cid, |
| 738 kAlignedAccess, |
| 736 Thread::kNoDeoptId, | 739 Thread::kNoDeoptId, |
| 737 builder.TokenPos())); | 740 builder.TokenPos())); |
| 738 builder.AddIntrinsicReturn(new Value(result)); | 741 builder.AddIntrinsicReturn(new Value(result)); |
| 739 return true; | 742 return true; |
| 740 } | 743 } |
| 741 | 744 |
| 742 | 745 |
| 743 bool Intrinsifier::Build_OneByteStringCodeUnitAt(FlowGraph* flow_graph) { | 746 bool Intrinsifier::Build_OneByteStringCodeUnitAt(FlowGraph* flow_graph) { |
| 744 return BuildCodeUnitAt(flow_graph, kOneByteStringCid); | 747 return BuildCodeUnitAt(flow_graph, kOneByteStringCid); |
| 745 } | 748 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 Definition* backing_store = builder.AddDefinition( | 958 Definition* backing_store = builder.AddDefinition( |
| 956 new LoadFieldInstr(new Value(growable_array), | 959 new LoadFieldInstr(new Value(growable_array), |
| 957 GrowableObjectArray::data_offset(), | 960 GrowableObjectArray::data_offset(), |
| 958 Type::ZoneHandle(), | 961 Type::ZoneHandle(), |
| 959 builder.TokenPos())); | 962 builder.TokenPos())); |
| 960 Definition* result = builder.AddDefinition( | 963 Definition* result = builder.AddDefinition( |
| 961 new LoadIndexedInstr(new Value(backing_store), | 964 new LoadIndexedInstr(new Value(backing_store), |
| 962 new Value(index), | 965 new Value(index), |
| 963 Instance::ElementSizeFor(kArrayCid), // index scale | 966 Instance::ElementSizeFor(kArrayCid), // index scale |
| 964 kArrayCid, | 967 kArrayCid, |
| 968 kAlignedAccess, |
| 965 Thread::kNoDeoptId, | 969 Thread::kNoDeoptId, |
| 966 builder.TokenPos())); | 970 builder.TokenPos())); |
| 967 builder.AddIntrinsicReturn(new Value(result)); | 971 builder.AddIntrinsicReturn(new Value(result)); |
| 968 return true; | 972 return true; |
| 969 } | 973 } |
| 970 | 974 |
| 971 | 975 |
| 972 bool Intrinsifier::Build_GrowableArraySetIndexed(FlowGraph* flow_graph) { | 976 bool Intrinsifier::Build_GrowableArraySetIndexed(FlowGraph* flow_graph) { |
| 973 if (Isolate::Current()->type_checks()) { | 977 if (Isolate::Current()->type_checks()) { |
| 974 return false; | 978 return false; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 991 Type::ZoneHandle(), | 995 Type::ZoneHandle(), |
| 992 builder.TokenPos())); | 996 builder.TokenPos())); |
| 993 | 997 |
| 994 builder.AddInstruction( | 998 builder.AddInstruction( |
| 995 new StoreIndexedInstr(new Value(backing_store), | 999 new StoreIndexedInstr(new Value(backing_store), |
| 996 new Value(index), | 1000 new Value(index), |
| 997 new Value(value), | 1001 new Value(value), |
| 998 kEmitStoreBarrier, | 1002 kEmitStoreBarrier, |
| 999 Instance::ElementSizeFor(kArrayCid), // index scale | 1003 Instance::ElementSizeFor(kArrayCid), // index scale |
| 1000 kArrayCid, | 1004 kArrayCid, |
| 1005 kAlignedAccess, |
| 1001 Thread::kNoDeoptId, | 1006 Thread::kNoDeoptId, |
| 1002 builder.TokenPos())); | 1007 builder.TokenPos())); |
| 1003 // Return null. | 1008 // Return null. |
| 1004 Definition* null_def = builder.AddNullDefinition(); | 1009 Definition* null_def = builder.AddNullDefinition(); |
| 1005 builder.AddIntrinsicReturn(new Value(null_def)); | 1010 builder.AddIntrinsicReturn(new Value(null_def)); |
| 1006 return true; | 1011 return true; |
| 1007 } | 1012 } |
| 1008 | 1013 |
| 1009 | 1014 |
| 1010 bool Intrinsifier::Build_GrowableArraySetData(FlowGraph* flow_graph) { | 1015 bool Intrinsifier::Build_GrowableArraySetData(FlowGraph* flow_graph) { |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); | 1274 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); |
| 1270 BlockBuilder builder(flow_graph, normal_entry); | 1275 BlockBuilder builder(flow_graph, normal_entry); |
| 1271 | 1276 |
| 1272 return BuildInvokeMathCFunction(&builder, | 1277 return BuildInvokeMathCFunction(&builder, |
| 1273 MethodRecognizer::kDoubleRound); | 1278 MethodRecognizer::kDoubleRound); |
| 1274 } | 1279 } |
| 1275 #endif // !defined(TARGET_ARCH_DBC) | 1280 #endif // !defined(TARGET_ARCH_DBC) |
| 1276 | 1281 |
| 1277 | 1282 |
| 1278 } // namespace dart | 1283 } // namespace dart |
| OLD | NEW |