| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/compilation-dependencies.h" | 6 #include "src/compilation-dependencies.h" |
| 7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
| 8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
| 9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
| 10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 Node* left_exception = | 377 Node* left_exception = |
| 378 graph()->NewNode(common()->IfException(hint), left_conv, left_conv); | 378 graph()->NewNode(common()->IfException(hint), left_conv, left_conv); |
| 379 Node* right_exception = | 379 Node* right_exception = |
| 380 graph()->NewNode(common()->IfException(hint), right_conv, right_conv); | 380 graph()->NewNode(common()->IfException(hint), right_conv, right_conv); |
| 381 NodeProperties::ReplaceControlInput(if_success, right_conv); | 381 NodeProperties::ReplaceControlInput(if_success, right_conv); |
| 382 update_effect(right_conv); | 382 update_effect(right_conv); |
| 383 | 383 |
| 384 // Wire conversions to existing {IfException} continuation. | 384 // Wire conversions to existing {IfException} continuation. |
| 385 Node* exception_merge = if_exception; | 385 Node* exception_merge = if_exception; |
| 386 Node* exception_value = | 386 Node* exception_value = |
| 387 graph()->NewNode(common()->Phi(kMachAnyTagged, 2), left_exception, | 387 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 388 right_exception, exception_merge); | 388 left_exception, right_exception, exception_merge); |
| 389 Node* exception_effect = | 389 Node* exception_effect = |
| 390 graph()->NewNode(common()->EffectPhi(2), left_exception, | 390 graph()->NewNode(common()->EffectPhi(2), left_exception, |
| 391 right_exception, exception_merge); | 391 right_exception, exception_merge); |
| 392 for (Edge edge : exception_merge->use_edges()) { | 392 for (Edge edge : exception_merge->use_edges()) { |
| 393 if (NodeProperties::IsEffectEdge(edge)) edge.UpdateTo(exception_effect); | 393 if (NodeProperties::IsEffectEdge(edge)) edge.UpdateTo(exception_effect); |
| 394 if (NodeProperties::IsValueEdge(edge)) edge.UpdateTo(exception_value); | 394 if (NodeProperties::IsValueEdge(edge)) edge.UpdateTo(exception_value); |
| 395 } | 395 } |
| 396 NodeProperties::RemoveType(exception_merge); | 396 NodeProperties::RemoveType(exception_merge); |
| 397 exception_merge->ReplaceInput(0, left_exception); | 397 exception_merge->ReplaceInput(0, left_exception); |
| 398 exception_merge->ReplaceInput(1, right_exception); | 398 exception_merge->ReplaceInput(1, right_exception); |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 // Recursively try to reduce the input first. | 822 // Recursively try to reduce the input first. |
| 823 Reduction result = ReduceJSToString(input); | 823 Reduction result = ReduceJSToString(input); |
| 824 if (result.Changed()) return result; | 824 if (result.Changed()) return result; |
| 825 return Changed(input); // JSToString(JSToString(x)) => JSToString(x) | 825 return Changed(input); // JSToString(JSToString(x)) => JSToString(x) |
| 826 } | 826 } |
| 827 Type* input_type = NodeProperties::GetType(input); | 827 Type* input_type = NodeProperties::GetType(input); |
| 828 if (input_type->Is(Type::String())) { | 828 if (input_type->Is(Type::String())) { |
| 829 return Changed(input); // JSToString(x:string) => x | 829 return Changed(input); // JSToString(x:string) => x |
| 830 } | 830 } |
| 831 if (input_type->Is(Type::Boolean())) { | 831 if (input_type->Is(Type::Boolean())) { |
| 832 return Replace( | 832 return Replace(graph()->NewNode( |
| 833 graph()->NewNode(common()->Select(kMachAnyTagged), input, | 833 common()->Select(MachineRepresentation::kTagged), input, |
| 834 jsgraph()->HeapConstant(factory()->true_string()), | 834 jsgraph()->HeapConstant(factory()->true_string()), |
| 835 jsgraph()->HeapConstant(factory()->false_string()))); | 835 jsgraph()->HeapConstant(factory()->false_string()))); |
| 836 } | 836 } |
| 837 if (input_type->Is(Type::Undefined())) { | 837 if (input_type->Is(Type::Undefined())) { |
| 838 return Replace(jsgraph()->HeapConstant(factory()->undefined_string())); | 838 return Replace(jsgraph()->HeapConstant(factory()->undefined_string())); |
| 839 } | 839 } |
| 840 if (input_type->Is(Type::Null())) { | 840 if (input_type->Is(Type::Null())) { |
| 841 return Replace(jsgraph()->HeapConstant(factory()->null_string())); | 841 return Replace(jsgraph()->HeapConstant(factory()->null_string())); |
| 842 } | 842 } |
| 843 // TODO(turbofan): js-typed-lowering of ToString(x:number) | 843 // TODO(turbofan): js-typed-lowering of ToString(x:number) |
| 844 return NoChange(); | 844 return NoChange(); |
| 845 } | 845 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 receiver, context, frame_state, econvert, if_convert); | 921 receiver, context, frame_state, econvert, if_convert); |
| 922 } | 922 } |
| 923 | 923 |
| 924 // The {receiver} is already a spec object. | 924 // The {receiver} is already a spec object. |
| 925 Node* if_done = if_true1; | 925 Node* if_done = if_true1; |
| 926 Node* edone = etrue1; | 926 Node* edone = etrue1; |
| 927 Node* rdone = receiver; | 927 Node* rdone = receiver; |
| 928 | 928 |
| 929 control = graph()->NewNode(common()->Merge(2), if_convert, if_done); | 929 control = graph()->NewNode(common()->Merge(2), if_convert, if_done); |
| 930 effect = graph()->NewNode(common()->EffectPhi(2), econvert, edone, control); | 930 effect = graph()->NewNode(common()->EffectPhi(2), econvert, edone, control); |
| 931 receiver = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), rconvert, | 931 receiver = |
| 932 rdone, control); | 932 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 933 rconvert, rdone, control); |
| 933 } | 934 } |
| 934 ReplaceWithValue(node, receiver, effect, control); | 935 ReplaceWithValue(node, receiver, effect, control); |
| 935 return Changed(receiver); | 936 return Changed(receiver); |
| 936 } | 937 } |
| 937 | 938 |
| 938 | 939 |
| 939 Reduction JSTypedLowering::ReduceJSLoadNamed(Node* node) { | 940 Reduction JSTypedLowering::ReduceJSLoadNamed(Node* node) { |
| 940 DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode()); | 941 DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode()); |
| 941 Node* receiver = NodeProperties::GetValueInput(node, 0); | 942 Node* receiver = NodeProperties::GetValueInput(node, 0); |
| 942 Type* receiver_type = NodeProperties::GetType(receiver); | 943 Type* receiver_type = NodeProperties::GetType(receiver); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 Node* key = NodeProperties::GetValueInput(node, 1); | 982 Node* key = NodeProperties::GetValueInput(node, 1); |
| 982 Node* base = NodeProperties::GetValueInput(node, 0); | 983 Node* base = NodeProperties::GetValueInput(node, 0); |
| 983 Type* key_type = NodeProperties::GetType(key); | 984 Type* key_type = NodeProperties::GetType(key); |
| 984 HeapObjectMatcher mbase(base); | 985 HeapObjectMatcher mbase(base); |
| 985 if (mbase.HasValue() && mbase.Value()->IsJSTypedArray()) { | 986 if (mbase.HasValue() && mbase.Value()->IsJSTypedArray()) { |
| 986 Handle<JSTypedArray> const array = | 987 Handle<JSTypedArray> const array = |
| 987 Handle<JSTypedArray>::cast(mbase.Value()); | 988 Handle<JSTypedArray>::cast(mbase.Value()); |
| 988 if (!array->GetBuffer()->was_neutered()) { | 989 if (!array->GetBuffer()->was_neutered()) { |
| 989 array->GetBuffer()->set_is_neuterable(false); | 990 array->GetBuffer()->set_is_neuterable(false); |
| 990 BufferAccess const access(array->type()); | 991 BufferAccess const access(array->type()); |
| 991 size_t const k = ElementSizeLog2Of(access.machine_type()); | 992 size_t const k = |
| 993 ElementSizeLog2Of(access.machine_type().representation()); |
| 992 double const byte_length = array->byte_length()->Number(); | 994 double const byte_length = array->byte_length()->Number(); |
| 993 CHECK_LT(k, arraysize(shifted_int32_ranges_)); | 995 CHECK_LT(k, arraysize(shifted_int32_ranges_)); |
| 994 if (key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) { | 996 if (key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) { |
| 995 // JSLoadProperty(typed-array, int32) | 997 // JSLoadProperty(typed-array, int32) |
| 996 Handle<FixedTypedArrayBase> elements = | 998 Handle<FixedTypedArrayBase> elements = |
| 997 Handle<FixedTypedArrayBase>::cast(handle(array->elements())); | 999 Handle<FixedTypedArrayBase>::cast(handle(array->elements())); |
| 998 Node* buffer = jsgraph()->PointerConstant(elements->external_pointer()); | 1000 Node* buffer = jsgraph()->PointerConstant(elements->external_pointer()); |
| 999 Node* length = jsgraph()->Constant(byte_length); | 1001 Node* length = jsgraph()->Constant(byte_length); |
| 1000 Node* effect = NodeProperties::GetEffectInput(node); | 1002 Node* effect = NodeProperties::GetEffectInput(node); |
| 1001 Node* control = NodeProperties::GetControlInput(node); | 1003 Node* control = NodeProperties::GetControlInput(node); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1027 Node* value = NodeProperties::GetValueInput(node, 2); | 1029 Node* value = NodeProperties::GetValueInput(node, 2); |
| 1028 Type* key_type = NodeProperties::GetType(key); | 1030 Type* key_type = NodeProperties::GetType(key); |
| 1029 Type* value_type = NodeProperties::GetType(value); | 1031 Type* value_type = NodeProperties::GetType(value); |
| 1030 HeapObjectMatcher mbase(base); | 1032 HeapObjectMatcher mbase(base); |
| 1031 if (mbase.HasValue() && mbase.Value()->IsJSTypedArray()) { | 1033 if (mbase.HasValue() && mbase.Value()->IsJSTypedArray()) { |
| 1032 Handle<JSTypedArray> const array = | 1034 Handle<JSTypedArray> const array = |
| 1033 Handle<JSTypedArray>::cast(mbase.Value()); | 1035 Handle<JSTypedArray>::cast(mbase.Value()); |
| 1034 if (!array->GetBuffer()->was_neutered()) { | 1036 if (!array->GetBuffer()->was_neutered()) { |
| 1035 array->GetBuffer()->set_is_neuterable(false); | 1037 array->GetBuffer()->set_is_neuterable(false); |
| 1036 BufferAccess const access(array->type()); | 1038 BufferAccess const access(array->type()); |
| 1037 size_t const k = ElementSizeLog2Of(access.machine_type()); | 1039 size_t const k = |
| 1040 ElementSizeLog2Of(access.machine_type().representation()); |
| 1038 double const byte_length = array->byte_length()->Number(); | 1041 double const byte_length = array->byte_length()->Number(); |
| 1039 CHECK_LT(k, arraysize(shifted_int32_ranges_)); | 1042 CHECK_LT(k, arraysize(shifted_int32_ranges_)); |
| 1040 if (access.external_array_type() != kExternalUint8ClampedArray && | 1043 if (access.external_array_type() != kExternalUint8ClampedArray && |
| 1041 key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) { | 1044 key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) { |
| 1042 // JSLoadProperty(typed-array, int32) | 1045 // JSLoadProperty(typed-array, int32) |
| 1043 Handle<FixedTypedArrayBase> elements = | 1046 Handle<FixedTypedArrayBase> elements = |
| 1044 Handle<FixedTypedArrayBase>::cast(handle(array->elements())); | 1047 Handle<FixedTypedArrayBase>::cast(handle(array->elements())); |
| 1045 Node* buffer = jsgraph()->PointerConstant(elements->external_pointer()); | 1048 Node* buffer = jsgraph()->PointerConstant(elements->external_pointer()); |
| 1046 Node* length = jsgraph()->Constant(byte_length); | 1049 Node* length = jsgraph()->Constant(byte_length); |
| 1047 Node* context = NodeProperties::GetContextInput(node); | 1050 Node* context = NodeProperties::GetContextInput(node); |
| 1048 Node* effect = NodeProperties::GetEffectInput(node); | 1051 Node* effect = NodeProperties::GetEffectInput(node); |
| 1049 Node* control = NodeProperties::GetControlInput(node); | 1052 Node* control = NodeProperties::GetControlInput(node); |
| 1050 // Convert to a number first. | 1053 // Convert to a number first. |
| 1051 if (!value_type->Is(Type::Number())) { | 1054 if (!value_type->Is(Type::Number())) { |
| 1052 Reduction number_reduction = ReduceJSToNumberInput(value); | 1055 Reduction number_reduction = ReduceJSToNumberInput(value); |
| 1053 if (number_reduction.Changed()) { | 1056 if (number_reduction.Changed()) { |
| 1054 value = number_reduction.replacement(); | 1057 value = number_reduction.replacement(); |
| 1055 } else { | 1058 } else { |
| 1056 Node* frame_state_for_to_number = | 1059 Node* frame_state_for_to_number = |
| 1057 NodeProperties::GetFrameStateInput(node, 1); | 1060 NodeProperties::GetFrameStateInput(node, 1); |
| 1058 value = effect = | 1061 value = effect = |
| 1059 graph()->NewNode(javascript()->ToNumber(), value, context, | 1062 graph()->NewNode(javascript()->ToNumber(), value, context, |
| 1060 frame_state_for_to_number, effect, control); | 1063 frame_state_for_to_number, effect, control); |
| 1061 } | 1064 } |
| 1062 } | 1065 } |
| 1063 // For integer-typed arrays, convert to the integer type. | 1066 // For integer-typed arrays, convert to the integer type. |
| 1064 if (TypeOf(access.machine_type()) == kTypeInt32 && | 1067 if (access.machine_type().semantic() == MachineSemantic::kInt32 && |
| 1065 !value_type->Is(Type::Signed32())) { | 1068 !value_type->Is(Type::Signed32())) { |
| 1066 value = graph()->NewNode(simplified()->NumberToInt32(), value); | 1069 value = graph()->NewNode(simplified()->NumberToInt32(), value); |
| 1067 } else if (TypeOf(access.machine_type()) == kTypeUint32 && | 1070 } else if (access.machine_type().semantic() == |
| 1071 MachineSemantic::kUint32 && |
| 1068 !value_type->Is(Type::Unsigned32())) { | 1072 !value_type->Is(Type::Unsigned32())) { |
| 1069 value = graph()->NewNode(simplified()->NumberToUint32(), value); | 1073 value = graph()->NewNode(simplified()->NumberToUint32(), value); |
| 1070 } | 1074 } |
| 1071 // Check if we can avoid the bounds check. | 1075 // Check if we can avoid the bounds check. |
| 1072 if (key_type->Min() >= 0 && key_type->Max() < array->length_value()) { | 1076 if (key_type->Min() >= 0 && key_type->Max() < array->length_value()) { |
| 1073 RelaxControls(node); | 1077 RelaxControls(node); |
| 1074 node->ReplaceInput(0, buffer); | 1078 node->ReplaceInput(0, buffer); |
| 1075 DCHECK_EQ(key, node->InputAt(1)); | 1079 DCHECK_EQ(key, node->InputAt(1)); |
| 1076 node->ReplaceInput(2, value); | 1080 node->ReplaceInput(2, value); |
| 1077 node->ReplaceInput(3, effect); | 1081 node->ReplaceInput(3, effect); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), | 1147 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), |
| 1144 r.left(), effect, control); | 1148 r.left(), effect, control); |
| 1145 | 1149 |
| 1146 // Loop through the {object}s prototype chain looking for the {prototype}. | 1150 // Loop through the {object}s prototype chain looking for the {prototype}. |
| 1147 Node* loop = control = | 1151 Node* loop = control = |
| 1148 graph()->NewNode(common()->Loop(2), control, control); | 1152 graph()->NewNode(common()->Loop(2), control, control); |
| 1149 | 1153 |
| 1150 Node* loop_effect = effect = | 1154 Node* loop_effect = effect = |
| 1151 graph()->NewNode(common()->EffectPhi(2), effect, effect, loop); | 1155 graph()->NewNode(common()->EffectPhi(2), effect, effect, loop); |
| 1152 | 1156 |
| 1153 Node* loop_object_map = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), | 1157 Node* loop_object_map = |
| 1154 object_map, r.left(), loop); | 1158 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 1159 object_map, r.left(), loop); |
| 1155 | 1160 |
| 1156 | 1161 |
| 1157 Node* object_prototype = effect = graph()->NewNode( | 1162 Node* object_prototype = effect = graph()->NewNode( |
| 1158 simplified()->LoadField(AccessBuilder::ForMapPrototype()), | 1163 simplified()->LoadField(AccessBuilder::ForMapPrototype()), |
| 1159 loop_object_map, loop_effect, control); | 1164 loop_object_map, loop_effect, control); |
| 1160 | 1165 |
| 1161 // Check if object prototype is equal to function prototype. | 1166 // Check if object prototype is equal to function prototype. |
| 1162 Node* eq_proto = | 1167 Node* eq_proto = |
| 1163 graph()->NewNode(simplified()->ReferenceEqual(r.right_type()), | 1168 graph()->NewNode(simplified()->ReferenceEqual(r.right_type()), |
| 1164 object_prototype, prototype); | 1169 object_prototype, prototype); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1187 loop_effect->ReplaceInput(1, effect); | 1192 loop_effect->ReplaceInput(1, effect); |
| 1188 loop_object_map->ReplaceInput(1, load_object_map); | 1193 loop_object_map->ReplaceInput(1, load_object_map); |
| 1189 loop->ReplaceInput(1, control); | 1194 loop->ReplaceInput(1, control); |
| 1190 | 1195 |
| 1191 control = | 1196 control = |
| 1192 graph()->NewNode(common()->Merge(2), if_eq_proto, if_null_proto); | 1197 graph()->NewNode(common()->Merge(2), if_eq_proto, if_null_proto); |
| 1193 effect = graph()->NewNode(common()->EffectPhi(2), e_eq_proto, | 1198 effect = graph()->NewNode(common()->EffectPhi(2), e_eq_proto, |
| 1194 e_null_proto, control); | 1199 e_null_proto, control); |
| 1195 | 1200 |
| 1196 | 1201 |
| 1197 Node* result = graph()->NewNode(common()->Phi(kTypeBool, 2), | 1202 Node* result = graph()->NewNode( |
| 1198 jsgraph()->TrueConstant(), | 1203 common()->Phi(MachineRepresentation::kTagged, 2), |
| 1199 jsgraph()->FalseConstant(), control); | 1204 jsgraph()->TrueConstant(), jsgraph()->FalseConstant(), control); |
| 1200 | 1205 |
| 1201 if (if_is_smi != nullptr) { | 1206 if (if_is_smi != nullptr) { |
| 1202 DCHECK(e_is_smi != nullptr); | 1207 DCHECK(e_is_smi != nullptr); |
| 1203 control = graph()->NewNode(common()->Merge(2), if_is_smi, control); | 1208 control = graph()->NewNode(common()->Merge(2), if_is_smi, control); |
| 1204 effect = | 1209 effect = |
| 1205 graph()->NewNode(common()->EffectPhi(2), e_is_smi, effect, control); | 1210 graph()->NewNode(common()->EffectPhi(2), e_is_smi, effect, control); |
| 1206 result = graph()->NewNode(common()->Phi(kTypeBool, 2), | 1211 result = |
| 1207 jsgraph()->FalseConstant(), result, control); | 1212 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 1213 jsgraph()->FalseConstant(), result, control); |
| 1208 } | 1214 } |
| 1209 ReplaceWithValue(node, result, effect, control); | 1215 ReplaceWithValue(node, result, effect, control); |
| 1210 return Changed(result); | 1216 return Changed(result); |
| 1211 } | 1217 } |
| 1212 } | 1218 } |
| 1213 | 1219 |
| 1214 return NoChange(); | 1220 return NoChange(); |
| 1215 } | 1221 } |
| 1216 | 1222 |
| 1217 | 1223 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 context, context, eglobal); | 1342 context, context, eglobal); |
| 1337 rglobal = eglobal = graph()->NewNode( | 1343 rglobal = eglobal = graph()->NewNode( |
| 1338 javascript()->LoadContext(0, Context::GLOBAL_PROXY_INDEX, true), | 1344 javascript()->LoadContext(0, Context::GLOBAL_PROXY_INDEX, true), |
| 1339 native_context, native_context, eglobal); | 1345 native_context, native_context, eglobal); |
| 1340 } | 1346 } |
| 1341 } | 1347 } |
| 1342 | 1348 |
| 1343 control = graph()->NewNode(common()->Merge(2), if_convert, if_global); | 1349 control = graph()->NewNode(common()->Merge(2), if_convert, if_global); |
| 1344 effect = | 1350 effect = |
| 1345 graph()->NewNode(common()->EffectPhi(2), econvert, eglobal, control); | 1351 graph()->NewNode(common()->EffectPhi(2), econvert, eglobal, control); |
| 1346 receiver = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), rconvert, | 1352 receiver = |
| 1347 rglobal, control); | 1353 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 1354 rconvert, rglobal, control); |
| 1348 } | 1355 } |
| 1349 } | 1356 } |
| 1350 ReplaceWithValue(node, receiver, effect, control); | 1357 ReplaceWithValue(node, receiver, effect, control); |
| 1351 return Changed(receiver); | 1358 return Changed(receiver); |
| 1352 } | 1359 } |
| 1353 | 1360 |
| 1354 | 1361 |
| 1355 namespace { | 1362 namespace { |
| 1356 | 1363 |
| 1357 // Maximum instance size for which allocations will be inlined. | 1364 // Maximum instance size for which allocations will be inlined. |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2205 cache_array_false1 = efalse1 = graph()->NewNode( | 2212 cache_array_false1 = efalse1 = graph()->NewNode( |
| 2206 simplified()->LoadField( | 2213 simplified()->LoadField( |
| 2207 AccessBuilder::ForDescriptorArrayEnumCacheBridgeCache()), | 2214 AccessBuilder::ForDescriptorArrayEnumCacheBridgeCache()), |
| 2208 object_map_enum_cache, efalse1, if_false1); | 2215 object_map_enum_cache, efalse1, if_false1); |
| 2209 } | 2216 } |
| 2210 | 2217 |
| 2211 if_true0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1); | 2218 if_true0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1); |
| 2212 etrue0 = | 2219 etrue0 = |
| 2213 graph()->NewNode(common()->EffectPhi(2), etrue1, efalse1, if_true0); | 2220 graph()->NewNode(common()->EffectPhi(2), etrue1, efalse1, if_true0); |
| 2214 cache_array_true0 = | 2221 cache_array_true0 = |
| 2215 graph()->NewNode(common()->Phi(kMachAnyTagged, 2), cache_array_true1, | 2222 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 2216 cache_array_false1, if_true0); | 2223 cache_array_true1, cache_array_false1, if_true0); |
| 2217 | 2224 |
| 2218 cache_type_true0 = cache_type; | 2225 cache_type_true0 = cache_type; |
| 2219 } | 2226 } |
| 2220 | 2227 |
| 2221 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); | 2228 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); |
| 2222 Node* cache_array_false0; | 2229 Node* cache_array_false0; |
| 2223 Node* cache_length_false0; | 2230 Node* cache_length_false0; |
| 2224 Node* cache_type_false0; | 2231 Node* cache_type_false0; |
| 2225 Node* efalse0; | 2232 Node* efalse0; |
| 2226 { | 2233 { |
| 2227 // FixedArray case. | 2234 // FixedArray case. |
| 2228 Node* receiver_instance_type = efalse0 = graph()->NewNode( | 2235 Node* receiver_instance_type = efalse0 = graph()->NewNode( |
| 2229 simplified()->LoadField(AccessBuilder::ForMapInstanceType()), | 2236 simplified()->LoadField(AccessBuilder::ForMapInstanceType()), |
| 2230 receiver_map, effect, if_false0); | 2237 receiver_map, effect, if_false0); |
| 2231 | 2238 |
| 2232 cache_type_false0 = graph()->NewNode( | 2239 cache_type_false0 = graph()->NewNode( |
| 2233 common()->Select(kMachAnyTagged, BranchHint::kFalse), | 2240 common()->Select(MachineRepresentation::kTagged, BranchHint::kFalse), |
| 2234 graph()->NewNode(machine()->Word32Equal(), receiver_instance_type, | 2241 graph()->NewNode(machine()->Word32Equal(), receiver_instance_type, |
| 2235 jsgraph()->Uint32Constant(JS_PROXY_TYPE)), | 2242 jsgraph()->Uint32Constant(JS_PROXY_TYPE)), |
| 2236 jsgraph()->ZeroConstant(), // Zero indicagtes proxy. | 2243 jsgraph()->ZeroConstant(), // Zero indicagtes proxy. |
| 2237 jsgraph()->OneConstant()); // One means slow check. | 2244 jsgraph()->OneConstant()); // One means slow check. |
| 2238 | 2245 |
| 2239 cache_array_false0 = cache_type; | 2246 cache_array_false0 = cache_type; |
| 2240 cache_length_false0 = efalse0 = graph()->NewNode( | 2247 cache_length_false0 = efalse0 = graph()->NewNode( |
| 2241 simplified()->LoadField(AccessBuilder::ForFixedArrayLength()), | 2248 simplified()->LoadField(AccessBuilder::ForFixedArrayLength()), |
| 2242 cache_array_false0, efalse0, if_false0); | 2249 cache_array_false0, efalse0, if_false0); |
| 2243 } | 2250 } |
| 2244 | 2251 |
| 2245 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); | 2252 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); |
| 2246 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); | 2253 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); |
| 2247 Node* cache_array = | 2254 Node* cache_array = |
| 2248 graph()->NewNode(common()->Phi(kMachAnyTagged, 2), cache_array_true0, | 2255 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 2249 cache_array_false0, control); | 2256 cache_array_true0, cache_array_false0, control); |
| 2250 Node* cache_length = | 2257 Node* cache_length = |
| 2251 graph()->NewNode(common()->Phi(kMachAnyTagged, 2), cache_length_true0, | 2258 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 2252 cache_length_false0, control); | 2259 cache_length_true0, cache_length_false0, control); |
| 2253 cache_type = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), | 2260 cache_type = |
| 2254 cache_type_true0, cache_type_false0, control); | 2261 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 2262 cache_type_true0, cache_type_false0, control); |
| 2255 | 2263 |
| 2256 for (auto edge : node->use_edges()) { | 2264 for (auto edge : node->use_edges()) { |
| 2257 Node* const use = edge.from(); | 2265 Node* const use = edge.from(); |
| 2258 if (NodeProperties::IsEffectEdge(edge)) { | 2266 if (NodeProperties::IsEffectEdge(edge)) { |
| 2259 edge.UpdateTo(effect); | 2267 edge.UpdateTo(effect); |
| 2260 Revisit(use); | 2268 Revisit(use); |
| 2261 } else { | 2269 } else { |
| 2262 if (NodeProperties::IsControlEdge(edge)) { | 2270 if (NodeProperties::IsControlEdge(edge)) { |
| 2263 if (use->opcode() == IrOpcode::kIfSuccess) { | 2271 if (use->opcode() == IrOpcode::kIfSuccess) { |
| 2264 Replace(use, control); | 2272 Replace(use, control); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2357 // {receiver} (does the ToName conversion implicitly). | 2365 // {receiver} (does the ToName conversion implicitly). |
| 2358 vfalse1 = efalse1 = graph()->NewNode( | 2366 vfalse1 = efalse1 = graph()->NewNode( |
| 2359 javascript()->CallRuntime(Runtime::kForInFilter, 2), receiver, key, | 2367 javascript()->CallRuntime(Runtime::kForInFilter, 2), receiver, key, |
| 2360 context, frame_state, effect, if_false1); | 2368 context, frame_state, effect, if_false1); |
| 2361 if_false1 = graph()->NewNode(common()->IfSuccess(), vfalse1); | 2369 if_false1 = graph()->NewNode(common()->IfSuccess(), vfalse1); |
| 2362 } | 2370 } |
| 2363 | 2371 |
| 2364 if_false0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1); | 2372 if_false0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1); |
| 2365 efalse0 = | 2373 efalse0 = |
| 2366 graph()->NewNode(common()->EffectPhi(2), etrue1, efalse1, if_false0); | 2374 graph()->NewNode(common()->EffectPhi(2), etrue1, efalse1, if_false0); |
| 2367 vfalse0 = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), vtrue1, | 2375 vfalse0 = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 2368 vfalse1, if_false0); | 2376 vtrue1, vfalse1, if_false0); |
| 2369 } | 2377 } |
| 2370 | 2378 |
| 2371 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); | 2379 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); |
| 2372 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); | 2380 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); |
| 2373 ReplaceWithValue(node, node, effect, control); | 2381 ReplaceWithValue(node, node, effect, control); |
| 2374 node->ReplaceInput(0, vtrue0); | 2382 node->ReplaceInput(0, vtrue0); |
| 2375 node->ReplaceInput(1, vfalse0); | 2383 node->ReplaceInput(1, vfalse0); |
| 2376 node->ReplaceInput(2, control); | 2384 node->ReplaceInput(2, control); |
| 2377 node->TrimInputCount(3); | 2385 node->TrimInputCount(3); |
| 2378 NodeProperties::ChangeOp(node, common()->Phi(kMachAnyTagged, 2)); | 2386 NodeProperties::ChangeOp(node, |
| 2387 common()->Phi(MachineRepresentation::kTagged, 2)); |
| 2379 return Changed(node); | 2388 return Changed(node); |
| 2380 } | 2389 } |
| 2381 | 2390 |
| 2382 | 2391 |
| 2383 Reduction JSTypedLowering::ReduceJSForInStep(Node* node) { | 2392 Reduction JSTypedLowering::ReduceJSForInStep(Node* node) { |
| 2384 DCHECK_EQ(IrOpcode::kJSForInStep, node->opcode()); | 2393 DCHECK_EQ(IrOpcode::kJSForInStep, node->opcode()); |
| 2385 node->ReplaceInput(1, jsgraph()->Int32Constant(1)); | 2394 node->ReplaceInput(1, jsgraph()->Int32Constant(1)); |
| 2386 NodeProperties::ChangeOp(node, machine()->Int32Add()); | 2395 NodeProperties::ChangeOp(node, machine()->Int32Add()); |
| 2387 return Changed(node); | 2396 return Changed(node); |
| 2388 } | 2397 } |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2689 } | 2698 } |
| 2690 | 2699 |
| 2691 | 2700 |
| 2692 CompilationDependencies* JSTypedLowering::dependencies() const { | 2701 CompilationDependencies* JSTypedLowering::dependencies() const { |
| 2693 return dependencies_; | 2702 return dependencies_; |
| 2694 } | 2703 } |
| 2695 | 2704 |
| 2696 } // namespace compiler | 2705 } // namespace compiler |
| 2697 } // namespace internal | 2706 } // namespace internal |
| 2698 } // namespace v8 | 2707 } // namespace v8 |
| OLD | NEW |