2868 {
2870
2874 if (StaticCallInstr*
call = orig_instance->AsStaticCall()) {
2875
2876
2877
2878 if (
call->is_known_list_constructor() &&
2880 return call->ArgumentAt(1);
2881 }
else if (
call->function().recognized_kind() ==
2882 MethodRecognizer::kByteDataFactory) {
2883
2884
2885 return call->ArgumentAt(1);
2887
2888
2889
2890
2891
2892
2893
2894
2895 return call->ArgumentAt(3);
2896 }
2897 }
else if (
LoadFieldInstr* load_array = orig_instance->AsLoadField()) {
2898
2899
2900 const Slot&
slot = load_array->slot();
2903 return flow_graph->GetConstant(
2905 }
2906 }
2907 }
2908 }
2909
2910 switch (
slot().kind()) {
2911 case Slot::Kind::kArray_length:
2912 if (CreateArrayInstr* create_array = orig_instance->AsCreateArray()) {
2913 return create_array->num_elements()->definition();
2914 }
2915 break;
2916 case Slot::Kind::kTypedDataBase_length:
2917 if (AllocateTypedDataInstr* alloc_typed_data =
2918 orig_instance->AsAllocateTypedData()) {
2919 return alloc_typed_data->num_elements()->definition();
2920 }
2921 break;
2922 case Slot::Kind::kTypedDataView_typed_data:
2923
2924
2926 if (StaticCallInstr*
call = orig_instance->AsStaticCall()) {
2929 return call->ArgumentAt(1);
2930 }
2931 }
2932 break;
2933 case Slot::Kind::kTypedDataView_offset_in_bytes:
2934
2935
2937 if (StaticCallInstr*
call = orig_instance->AsStaticCall()) {
2939 return call->ArgumentAt(2);
2940 }
else if (
call->function().recognized_kind() ==
2941 MethodRecognizer::kByteDataFactory) {
2942
2943
2944 return flow_graph->GetConstant(Object::smi_zero());
2945 }
2946 }
2947 break;
2948 case Slot::Kind::kRecord_shape:
2950 if (auto* alloc_rec = orig_instance->AsAllocateRecord()) {
2951 return flow_graph->GetConstant(
Smi::Handle(alloc_rec->shape().AsSmi()));
2952 } else if (auto* alloc_rec = orig_instance->AsAllocateSmallRecord()) {
2953 return flow_graph->GetConstant(
Smi::Handle(alloc_rec->shape().AsSmi()));
2954 } else {
2956 if (
type->IsRecordType()) {
2957 return flow_graph->GetConstant(
2958 Smi::Handle(RecordType::Cast(*type).shape().AsSmi()));
2959 }
2960 }
2961 break;
2964 if (StaticCallInstr*
call = orig_instance->AsStaticCall()) {
2965 if (
call->is_known_list_constructor()) {
2966 return call->ArgumentAt(0);
2969 return flow_graph->constant_null();
2970 }
2971 switch (
call->function().recognized_kind()) {
2972 case MethodRecognizer::kByteDataFactory:
2973 case MethodRecognizer::kLinkedHashBase_getData:
2974 case MethodRecognizer::kImmutableLinkedHashBase_getData:
2975 return flow_graph->constant_null();
2976 default:
2977 break;
2978 }
2979 } else if (CreateArrayInstr* create_array =
2980 orig_instance->AsCreateArray()) {
2981 return create_array->type_arguments()->definition();
2982 }
else if (
LoadFieldInstr* load_array = orig_instance->AsLoadField()) {
2983 const Slot&
slot = load_array->slot();
2986
2987
2989 if (field.static_type_exactness_state().IsTriviallyExact()) {
2992 .GetInstanceTypeArguments(flow_graph->thread())));
2993 }
2994 break;
2995 }
2996
2997 case Slot::Kind::kLinkedHashBase_data:
2998 return flow_graph->constant_null();
2999
3000 default:
3001 break;
3002 }
3003 }
3004 break;
3005 case Slot::Kind::kPointerBase_data:
3009
3012 }
3013 }
3014 break;
3015 default:
3016 break;
3017 }
3018
3019
3020 if (
instance()->BindsToConstant()) {
3024 return flow_graph->GetConstant(
result);
3025 }
3026 }
3027 }
3028
3030 StoreFieldInstr* initializing_store = nullptr;
3031 for (
auto use :
instance()->definition()->input_uses()) {
3032 if (
auto store = use->instruction()->AsStoreField()) {
3033 if ((use->use_index() == StoreFieldInstr::kInstancePos) &&
3035 if (initializing_store == nullptr) {
3036 initializing_store =
store;
3037 } else {
3038 initializing_store = nullptr;
3039 break;
3040 }
3041 }
3042 }
3043 }
3044
3045
3046
3047 if (initializing_store != nullptr &&
3048 initializing_store->is_initialization()) {
3050 return initializing_store->value()->definition();
3051 }
3052 }
3053
3054 return this;
3055}
const AbstractType * ToAbstractType()
Definition * OriginalDefinition()
intptr_t guarded_list_length() const
bool IsDominatedBy(Instruction *dom)
bool IsImmutableLengthLoad() const
void set_loads_inner_pointer(InnerPointerAccess value)
bool IsImmutableLoad() const
static bool IsUnmodifiableTypedDataViewFactory(const Function &function)
bool Evaluate(const Object &instance_value, Object *result)
static bool IsFixedLengthArrayCid(intptr_t cid)
static bool IsTypedDataViewFactory(const Function &function)
static SmiPtr New(intptr_t value)
Definition * definition() const
bool IsExternalTypedDataClassId(intptr_t index)