OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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-stub-assembler.h" | 5 #include "src/code-stub-assembler.h" |
6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
7 #include "src/frames-inl.h" | 7 #include "src/frames-inl.h" |
8 #include "src/frames.h" | 8 #include "src/frames.h" |
9 #include "src/ic/stub-cache.h" | 9 #include "src/ic/stub-cache.h" |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 Node* CodeStubAssembler::UndefinedConstant() { | 68 Node* CodeStubAssembler::UndefinedConstant() { |
69 return LoadRoot(Heap::kUndefinedValueRootIndex); | 69 return LoadRoot(Heap::kUndefinedValueRootIndex); |
70 } | 70 } |
71 | 71 |
72 Node* CodeStubAssembler::TheHoleConstant() { | 72 Node* CodeStubAssembler::TheHoleConstant() { |
73 return LoadRoot(Heap::kTheHoleValueRootIndex); | 73 return LoadRoot(Heap::kTheHoleValueRootIndex); |
74 } | 74 } |
75 | 75 |
76 Node* CodeStubAssembler::HashSeed() { | 76 Node* CodeStubAssembler::HashSeed() { |
77 return SmiToWord32(LoadRoot(Heap::kHashSeedRootIndex)); | 77 return LoadAndUntagToWord32Root(Heap::kHashSeedRootIndex); |
78 } | 78 } |
79 | 79 |
80 Node* CodeStubAssembler::StaleRegisterConstant() { | 80 Node* CodeStubAssembler::StaleRegisterConstant() { |
81 return LoadRoot(Heap::kStaleRegisterRootIndex); | 81 return LoadRoot(Heap::kStaleRegisterRootIndex); |
82 } | 82 } |
83 | 83 |
84 Node* CodeStubAssembler::Float64Round(Node* x) { | 84 Node* CodeStubAssembler::Float64Round(Node* x) { |
85 Node* one = Float64Constant(1.0); | 85 Node* one = Float64Constant(1.0); |
86 Node* one_half = Float64Constant(0.5); | 86 Node* one_half = Float64Constant(0.5); |
87 | 87 |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 Node* CodeStubAssembler::LoadObjectField(Node* object, int offset, | 907 Node* CodeStubAssembler::LoadObjectField(Node* object, int offset, |
908 MachineType rep) { | 908 MachineType rep) { |
909 return Load(rep, object, IntPtrConstant(offset - kHeapObjectTag)); | 909 return Load(rep, object, IntPtrConstant(offset - kHeapObjectTag)); |
910 } | 910 } |
911 | 911 |
912 Node* CodeStubAssembler::LoadObjectField(Node* object, Node* offset, | 912 Node* CodeStubAssembler::LoadObjectField(Node* object, Node* offset, |
913 MachineType rep) { | 913 MachineType rep) { |
914 return Load(rep, object, IntPtrSub(offset, IntPtrConstant(kHeapObjectTag))); | 914 return Load(rep, object, IntPtrSub(offset, IntPtrConstant(kHeapObjectTag))); |
915 } | 915 } |
916 | 916 |
| 917 Node* CodeStubAssembler::LoadAndUntagObjectField(Node* object, int offset) { |
| 918 if (Is64()) { |
| 919 #if V8_TARGET_LITTLE_ENDIAN |
| 920 offset += kPointerSize / 2; |
| 921 #endif |
| 922 return ChangeInt32ToInt64( |
| 923 LoadObjectField(object, offset, MachineType::Int32())); |
| 924 } else { |
| 925 return SmiToWord(LoadObjectField(object, offset, MachineType::AnyTagged())); |
| 926 } |
| 927 } |
| 928 |
| 929 Node* CodeStubAssembler::LoadAndUntagToWord32ObjectField(Node* object, |
| 930 int offset) { |
| 931 if (Is64()) { |
| 932 #if V8_TARGET_LITTLE_ENDIAN |
| 933 offset += kPointerSize / 2; |
| 934 #endif |
| 935 return LoadObjectField(object, offset, MachineType::Int32()); |
| 936 } else { |
| 937 return SmiToWord32( |
| 938 LoadObjectField(object, offset, MachineType::AnyTagged())); |
| 939 } |
| 940 } |
| 941 |
| 942 Node* CodeStubAssembler::LoadAndUntagSmi(Node* base, int index) { |
| 943 if (Is64()) { |
| 944 #if V8_TARGET_LITTLE_ENDIAN |
| 945 index += kPointerSize / 2; |
| 946 #endif |
| 947 return ChangeInt32ToInt64( |
| 948 Load(MachineType::Int32(), base, IntPtrConstant(index))); |
| 949 } else { |
| 950 return SmiToWord( |
| 951 Load(MachineType::AnyTagged(), base, IntPtrConstant(index))); |
| 952 } |
| 953 } |
| 954 |
| 955 Node* CodeStubAssembler::LoadAndUntagToWord32Root( |
| 956 Heap::RootListIndex root_index) { |
| 957 Node* roots_array_start = |
| 958 ExternalConstant(ExternalReference::roots_array_start(isolate())); |
| 959 int index = root_index * kPointerSize; |
| 960 if (Is64()) { |
| 961 #if V8_TARGET_LITTLE_ENDIAN |
| 962 index += kPointerSize / 2; |
| 963 #endif |
| 964 return Load(MachineType::Int32(), roots_array_start, IntPtrConstant(index)); |
| 965 } else { |
| 966 return SmiToWord32(Load(MachineType::AnyTagged(), roots_array_start, |
| 967 IntPtrConstant(index))); |
| 968 } |
| 969 } |
| 970 |
917 Node* CodeStubAssembler::LoadHeapNumberValue(Node* object) { | 971 Node* CodeStubAssembler::LoadHeapNumberValue(Node* object) { |
918 return LoadObjectField(object, HeapNumber::kValueOffset, | 972 return LoadObjectField(object, HeapNumber::kValueOffset, |
919 MachineType::Float64()); | 973 MachineType::Float64()); |
920 } | 974 } |
921 | 975 |
922 Node* CodeStubAssembler::LoadMap(Node* object) { | 976 Node* CodeStubAssembler::LoadMap(Node* object) { |
923 return LoadObjectField(object, HeapObject::kMapOffset); | 977 return LoadObjectField(object, HeapObject::kMapOffset); |
924 } | 978 } |
925 | 979 |
926 Node* CodeStubAssembler::LoadInstanceType(Node* object) { | 980 Node* CodeStubAssembler::LoadInstanceType(Node* object) { |
927 return LoadMapInstanceType(LoadMap(object)); | 981 return LoadMapInstanceType(LoadMap(object)); |
928 } | 982 } |
929 | 983 |
930 void CodeStubAssembler::AssertInstanceType(Node* object, | 984 void CodeStubAssembler::AssertInstanceType(Node* object, |
931 InstanceType instance_type) { | 985 InstanceType instance_type) { |
932 Assert(Word32Equal(LoadInstanceType(object), Int32Constant(instance_type))); | 986 Assert(Word32Equal(LoadInstanceType(object), Int32Constant(instance_type))); |
933 } | 987 } |
934 | 988 |
935 Node* CodeStubAssembler::LoadProperties(Node* object) { | 989 Node* CodeStubAssembler::LoadProperties(Node* object) { |
936 return LoadObjectField(object, JSObject::kPropertiesOffset); | 990 return LoadObjectField(object, JSObject::kPropertiesOffset); |
937 } | 991 } |
938 | 992 |
939 Node* CodeStubAssembler::LoadElements(Node* object) { | 993 Node* CodeStubAssembler::LoadElements(Node* object) { |
940 return LoadObjectField(object, JSObject::kElementsOffset); | 994 return LoadObjectField(object, JSObject::kElementsOffset); |
941 } | 995 } |
942 | 996 |
943 Node* CodeStubAssembler::LoadFixedArrayBaseLength(Node* array) { | 997 Node* CodeStubAssembler::LoadAndUntagFixedArrayBaseLength(Node* array) { |
944 return LoadObjectField(array, FixedArrayBase::kLengthOffset); | 998 return LoadAndUntagObjectField(array, FixedArrayBase::kLengthOffset); |
945 } | 999 } |
946 | 1000 |
947 Node* CodeStubAssembler::LoadMapBitField(Node* map) { | 1001 Node* CodeStubAssembler::LoadMapBitField(Node* map) { |
948 return LoadObjectField(map, Map::kBitFieldOffset, MachineType::Uint8()); | 1002 return LoadObjectField(map, Map::kBitFieldOffset, MachineType::Uint8()); |
949 } | 1003 } |
950 | 1004 |
951 Node* CodeStubAssembler::LoadMapBitField2(Node* map) { | 1005 Node* CodeStubAssembler::LoadMapBitField2(Node* map) { |
952 return LoadObjectField(map, Map::kBitField2Offset, MachineType::Uint8()); | 1006 return LoadObjectField(map, Map::kBitField2Offset, MachineType::Uint8()); |
953 } | 1007 } |
954 | 1008 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 Node* CodeStubAssembler::LoadFixedArrayElement(Node* object, Node* index_node, | 1103 Node* CodeStubAssembler::LoadFixedArrayElement(Node* object, Node* index_node, |
1050 int additional_offset, | 1104 int additional_offset, |
1051 ParameterMode parameter_mode) { | 1105 ParameterMode parameter_mode) { |
1052 int32_t header_size = | 1106 int32_t header_size = |
1053 FixedArray::kHeaderSize + additional_offset - kHeapObjectTag; | 1107 FixedArray::kHeaderSize + additional_offset - kHeapObjectTag; |
1054 Node* offset = ElementOffsetFromIndex(index_node, FAST_HOLEY_ELEMENTS, | 1108 Node* offset = ElementOffsetFromIndex(index_node, FAST_HOLEY_ELEMENTS, |
1055 parameter_mode, header_size); | 1109 parameter_mode, header_size); |
1056 return Load(MachineType::AnyTagged(), object, offset); | 1110 return Load(MachineType::AnyTagged(), object, offset); |
1057 } | 1111 } |
1058 | 1112 |
| 1113 Node* CodeStubAssembler::LoadAndUntagToWord32FixedArrayElement( |
| 1114 Node* object, Node* index_node, int additional_offset, |
| 1115 ParameterMode parameter_mode) { |
| 1116 int32_t header_size = |
| 1117 FixedArray::kHeaderSize + additional_offset - kHeapObjectTag; |
| 1118 #if V8_TARGET_LITTLE_ENDIAN |
| 1119 if (Is64()) { |
| 1120 header_size += kPointerSize / 2; |
| 1121 } |
| 1122 #endif |
| 1123 Node* offset = ElementOffsetFromIndex(index_node, FAST_HOLEY_ELEMENTS, |
| 1124 parameter_mode, header_size); |
| 1125 if (Is64()) { |
| 1126 return Load(MachineType::Int32(), object, offset); |
| 1127 } else { |
| 1128 return SmiToWord32(Load(MachineType::AnyTagged(), object, offset)); |
| 1129 } |
| 1130 } |
| 1131 |
1059 Node* CodeStubAssembler::LoadFixedDoubleArrayElement( | 1132 Node* CodeStubAssembler::LoadFixedDoubleArrayElement( |
1060 Node* object, Node* index_node, MachineType machine_type, | 1133 Node* object, Node* index_node, MachineType machine_type, |
1061 int additional_offset, ParameterMode parameter_mode) { | 1134 int additional_offset, ParameterMode parameter_mode) { |
1062 int32_t header_size = | 1135 int32_t header_size = |
1063 FixedDoubleArray::kHeaderSize + additional_offset - kHeapObjectTag; | 1136 FixedDoubleArray::kHeaderSize + additional_offset - kHeapObjectTag; |
1064 Node* offset = ElementOffsetFromIndex(index_node, FAST_HOLEY_DOUBLE_ELEMENTS, | 1137 Node* offset = ElementOffsetFromIndex(index_node, FAST_HOLEY_DOUBLE_ELEMENTS, |
1065 parameter_mode, header_size); | 1138 parameter_mode, header_size); |
1066 return Load(machine_type, object, offset); | 1139 return Load(machine_type, object, offset); |
1067 } | 1140 } |
1068 | 1141 |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 CallRuntime(Runtime::kExternalStringGetChar, | 1981 CallRuntime(Runtime::kExternalStringGetChar, |
1909 NoContextConstant(), string, SmiTag(index)))); | 1982 NoContextConstant(), string, SmiTag(index)))); |
1910 Goto(&done_loop); | 1983 Goto(&done_loop); |
1911 } | 1984 } |
1912 } | 1985 } |
1913 | 1986 |
1914 Bind(&if_stringisnotexternal); | 1987 Bind(&if_stringisnotexternal); |
1915 { | 1988 { |
1916 // The {string} is a SlicedString, continue with its parent. | 1989 // The {string} is a SlicedString, continue with its parent. |
1917 Node* string_offset = | 1990 Node* string_offset = |
1918 SmiToWord(LoadObjectField(string, SlicedString::kOffsetOffset)); | 1991 LoadAndUntagObjectField(string, SlicedString::kOffsetOffset); |
1919 Node* string_parent = | 1992 Node* string_parent = |
1920 LoadObjectField(string, SlicedString::kParentOffset); | 1993 LoadObjectField(string, SlicedString::kParentOffset); |
1921 var_index.Bind(IntPtrAdd(index, string_offset)); | 1994 var_index.Bind(IntPtrAdd(index, string_offset)); |
1922 var_string.Bind(string_parent); | 1995 var_string.Bind(string_parent); |
1923 Goto(&loop); | 1996 Goto(&loop); |
1924 } | 1997 } |
1925 } | 1998 } |
1926 } | 1999 } |
1927 } | 2000 } |
1928 | 2001 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2079 | 2152 |
2080 template <typename Dictionary> | 2153 template <typename Dictionary> |
2081 void CodeStubAssembler::NameDictionaryLookup(Node* dictionary, | 2154 void CodeStubAssembler::NameDictionaryLookup(Node* dictionary, |
2082 Node* unique_name, Label* if_found, | 2155 Node* unique_name, Label* if_found, |
2083 Variable* var_name_index, | 2156 Variable* var_name_index, |
2084 Label* if_not_found, | 2157 Label* if_not_found, |
2085 int inlined_probes) { | 2158 int inlined_probes) { |
2086 DCHECK_EQ(MachineRepresentation::kWord32, var_name_index->rep()); | 2159 DCHECK_EQ(MachineRepresentation::kWord32, var_name_index->rep()); |
2087 Comment("NameDictionaryLookup"); | 2160 Comment("NameDictionaryLookup"); |
2088 | 2161 |
2089 Node* capacity = SmiToWord32(LoadFixedArrayElement( | 2162 Node* capacity = LoadAndUntagToWord32FixedArrayElement( |
2090 dictionary, Int32Constant(Dictionary::kCapacityIndex))); | 2163 dictionary, Int32Constant(Dictionary::kCapacityIndex)); |
2091 Node* mask = Int32Sub(capacity, Int32Constant(1)); | 2164 Node* mask = Int32Sub(capacity, Int32Constant(1)); |
2092 Node* hash = LoadNameHash(unique_name); | 2165 Node* hash = LoadNameHash(unique_name); |
2093 | 2166 |
2094 // See Dictionary::FirstProbe(). | 2167 // See Dictionary::FirstProbe(). |
2095 Node* count = Int32Constant(0); | 2168 Node* count = Int32Constant(0); |
2096 Node* entry = Word32And(hash, mask); | 2169 Node* entry = Word32And(hash, mask); |
2097 | 2170 |
2098 for (int i = 0; i < inlined_probes; i++) { | 2171 for (int i = 0; i < inlined_probes; i++) { |
2099 Node* index = EntryToIndex<Dictionary>(entry); | 2172 Node* index = EntryToIndex<Dictionary>(entry); |
2100 var_name_index->Bind(index); | 2173 var_name_index->Bind(index); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2159 } | 2232 } |
2160 | 2233 |
2161 template <typename Dictionary> | 2234 template <typename Dictionary> |
2162 void CodeStubAssembler::NumberDictionaryLookup(Node* dictionary, Node* key, | 2235 void CodeStubAssembler::NumberDictionaryLookup(Node* dictionary, Node* key, |
2163 Label* if_found, | 2236 Label* if_found, |
2164 Variable* var_entry, | 2237 Variable* var_entry, |
2165 Label* if_not_found) { | 2238 Label* if_not_found) { |
2166 DCHECK_EQ(MachineRepresentation::kWord32, var_entry->rep()); | 2239 DCHECK_EQ(MachineRepresentation::kWord32, var_entry->rep()); |
2167 Comment("NumberDictionaryLookup"); | 2240 Comment("NumberDictionaryLookup"); |
2168 | 2241 |
2169 Node* capacity = SmiToWord32(LoadFixedArrayElement( | 2242 Node* capacity = LoadAndUntagToWord32FixedArrayElement( |
2170 dictionary, Int32Constant(Dictionary::kCapacityIndex))); | 2243 dictionary, Int32Constant(Dictionary::kCapacityIndex)); |
2171 Node* mask = Int32Sub(capacity, Int32Constant(1)); | 2244 Node* mask = Int32Sub(capacity, Int32Constant(1)); |
2172 | 2245 |
2173 Node* seed; | 2246 Node* seed; |
2174 if (Dictionary::ShapeT::UsesSeed) { | 2247 if (Dictionary::ShapeT::UsesSeed) { |
2175 seed = HashSeed(); | 2248 seed = HashSeed(); |
2176 } else { | 2249 } else { |
2177 seed = Int32Constant(kZeroHashSeed); | 2250 seed = Int32Constant(kZeroHashSeed); |
2178 } | 2251 } |
2179 Node* hash = ComputeIntegerHash(key, seed); | 2252 Node* hash = ComputeIntegerHash(key, seed); |
2180 Node* key_as_float64 = ChangeUint32ToFloat64(key); | 2253 Node* key_as_float64 = ChangeUint32ToFloat64(key); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2351 DCHECK_EQ(MachineRepresentation::kTagged, var_value->rep()); | 2424 DCHECK_EQ(MachineRepresentation::kTagged, var_value->rep()); |
2352 Comment("[ LoadPropertyFromFastObject"); | 2425 Comment("[ LoadPropertyFromFastObject"); |
2353 | 2426 |
2354 const int name_to_details_offset = | 2427 const int name_to_details_offset = |
2355 (DescriptorArray::kDescriptorDetails - DescriptorArray::kDescriptorKey) * | 2428 (DescriptorArray::kDescriptorDetails - DescriptorArray::kDescriptorKey) * |
2356 kPointerSize; | 2429 kPointerSize; |
2357 const int name_to_value_offset = | 2430 const int name_to_value_offset = |
2358 (DescriptorArray::kDescriptorValue - DescriptorArray::kDescriptorKey) * | 2431 (DescriptorArray::kDescriptorValue - DescriptorArray::kDescriptorKey) * |
2359 kPointerSize; | 2432 kPointerSize; |
2360 | 2433 |
2361 Node* details = SmiToWord32( | 2434 Node* details = LoadAndUntagToWord32FixedArrayElement(descriptors, name_index, |
2362 LoadFixedArrayElement(descriptors, name_index, name_to_details_offset)); | 2435 name_to_details_offset); |
2363 var_details->Bind(details); | 2436 var_details->Bind(details); |
2364 | 2437 |
2365 Node* location = BitFieldDecode<PropertyDetails::LocationField>(details); | 2438 Node* location = BitFieldDecode<PropertyDetails::LocationField>(details); |
2366 | 2439 |
2367 Label if_in_field(this), if_in_descriptor(this), done(this); | 2440 Label if_in_field(this), if_in_descriptor(this), done(this); |
2368 Branch(Word32Equal(location, Int32Constant(kField)), &if_in_field, | 2441 Branch(Word32Equal(location, Int32Constant(kField)), &if_in_field, |
2369 &if_in_descriptor); | 2442 &if_in_descriptor); |
2370 Bind(&if_in_field); | 2443 Bind(&if_in_field); |
2371 { | 2444 { |
2372 Node* field_index = | 2445 Node* field_index = |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2458 Variable* var_value) { | 2531 Variable* var_value) { |
2459 Comment("LoadPropertyFromNameDictionary"); | 2532 Comment("LoadPropertyFromNameDictionary"); |
2460 | 2533 |
2461 const int name_to_details_offset = | 2534 const int name_to_details_offset = |
2462 (NameDictionary::kEntryDetailsIndex - NameDictionary::kEntryKeyIndex) * | 2535 (NameDictionary::kEntryDetailsIndex - NameDictionary::kEntryKeyIndex) * |
2463 kPointerSize; | 2536 kPointerSize; |
2464 const int name_to_value_offset = | 2537 const int name_to_value_offset = |
2465 (NameDictionary::kEntryValueIndex - NameDictionary::kEntryKeyIndex) * | 2538 (NameDictionary::kEntryValueIndex - NameDictionary::kEntryKeyIndex) * |
2466 kPointerSize; | 2539 kPointerSize; |
2467 | 2540 |
2468 Node* details = SmiToWord32( | 2541 Node* details = LoadAndUntagToWord32FixedArrayElement(dictionary, name_index, |
2469 LoadFixedArrayElement(dictionary, name_index, name_to_details_offset)); | 2542 name_to_details_offset); |
2470 | 2543 |
2471 var_details->Bind(details); | 2544 var_details->Bind(details); |
2472 var_value->Bind( | 2545 var_value->Bind( |
2473 LoadFixedArrayElement(dictionary, name_index, name_to_value_offset)); | 2546 LoadFixedArrayElement(dictionary, name_index, name_to_value_offset)); |
2474 | 2547 |
2475 Comment("] LoadPropertyFromNameDictionary"); | 2548 Comment("] LoadPropertyFromNameDictionary"); |
2476 } | 2549 } |
2477 | 2550 |
2478 void CodeStubAssembler::LoadPropertyFromGlobalDictionary(Node* dictionary, | 2551 void CodeStubAssembler::LoadPropertyFromGlobalDictionary(Node* dictionary, |
2479 Node* name_index, | 2552 Node* name_index, |
2480 Variable* var_details, | 2553 Variable* var_details, |
2481 Variable* var_value, | 2554 Variable* var_value, |
2482 Label* if_deleted) { | 2555 Label* if_deleted) { |
2483 Comment("[ LoadPropertyFromGlobalDictionary"); | 2556 Comment("[ LoadPropertyFromGlobalDictionary"); |
2484 | 2557 |
2485 const int name_to_value_offset = | 2558 const int name_to_value_offset = |
2486 (GlobalDictionary::kEntryValueIndex - GlobalDictionary::kEntryKeyIndex) * | 2559 (GlobalDictionary::kEntryValueIndex - GlobalDictionary::kEntryKeyIndex) * |
2487 kPointerSize; | 2560 kPointerSize; |
2488 | 2561 |
2489 Node* property_cell = | 2562 Node* property_cell = |
2490 LoadFixedArrayElement(dictionary, name_index, name_to_value_offset); | 2563 LoadFixedArrayElement(dictionary, name_index, name_to_value_offset); |
2491 | 2564 |
2492 Node* value = LoadObjectField(property_cell, PropertyCell::kValueOffset); | 2565 Node* value = LoadObjectField(property_cell, PropertyCell::kValueOffset); |
2493 GotoIf(WordEqual(value, TheHoleConstant()), if_deleted); | 2566 GotoIf(WordEqual(value, TheHoleConstant()), if_deleted); |
2494 | 2567 |
2495 var_value->Bind(value); | 2568 var_value->Bind(value); |
2496 | 2569 |
2497 Node* details = | 2570 Node* details = LoadAndUntagToWord32ObjectField(property_cell, |
2498 SmiToWord32(LoadObjectField(property_cell, PropertyCell::kDetailsOffset)); | 2571 PropertyCell::kDetailsOffset); |
2499 var_details->Bind(details); | 2572 var_details->Bind(details); |
2500 | 2573 |
2501 Comment("] LoadPropertyFromGlobalDictionary"); | 2574 Comment("] LoadPropertyFromGlobalDictionary"); |
2502 } | 2575 } |
2503 | 2576 |
2504 void CodeStubAssembler::TryGetOwnProperty( | 2577 void CodeStubAssembler::TryGetOwnProperty( |
2505 Node* context, Node* receiver, Node* object, Node* map, Node* instance_type, | 2578 Node* context, Node* receiver, Node* object, Node* map, Node* instance_type, |
2506 Node* unique_name, Label* if_found_value, Variable* var_value, | 2579 Node* unique_name, Label* if_found_value, Variable* var_value, |
2507 Label* if_not_found, Label* if_bailout) { | 2580 Label* if_not_found, Label* if_bailout) { |
2508 DCHECK_EQ(MachineRepresentation::kTagged, var_value->rep()); | 2581 DCHECK_EQ(MachineRepresentation::kTagged, var_value->rep()); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2626 &if_isslowstringwrapper, | 2699 &if_isslowstringwrapper, |
2627 if_not_found, | 2700 if_not_found, |
2628 }; | 2701 }; |
2629 // clang-format on | 2702 // clang-format on |
2630 STATIC_ASSERT(arraysize(values) == arraysize(labels)); | 2703 STATIC_ASSERT(arraysize(values) == arraysize(labels)); |
2631 Switch(elements_kind, if_bailout, values, labels, arraysize(values)); | 2704 Switch(elements_kind, if_bailout, values, labels, arraysize(values)); |
2632 | 2705 |
2633 Bind(&if_isobjectorsmi); | 2706 Bind(&if_isobjectorsmi); |
2634 { | 2707 { |
2635 Node* elements = LoadElements(object); | 2708 Node* elements = LoadElements(object); |
2636 Node* length = LoadFixedArrayBaseLength(elements); | 2709 Node* length = LoadAndUntagFixedArrayBaseLength(elements); |
2637 | 2710 |
2638 GotoUnless(Uint32LessThan(index, SmiToWord32(length)), if_not_found); | 2711 GotoUnless(Uint32LessThan(index, length), if_not_found); |
2639 | 2712 |
2640 Node* element = LoadFixedArrayElement(elements, index); | 2713 Node* element = LoadFixedArrayElement(elements, index); |
2641 Node* the_hole = TheHoleConstant(); | 2714 Node* the_hole = TheHoleConstant(); |
2642 Branch(WordEqual(element, the_hole), if_not_found, if_found); | 2715 Branch(WordEqual(element, the_hole), if_not_found, if_found); |
2643 } | 2716 } |
2644 Bind(&if_isdouble); | 2717 Bind(&if_isdouble); |
2645 { | 2718 { |
2646 Node* elements = LoadElements(object); | 2719 Node* elements = LoadElements(object); |
2647 Node* length = LoadFixedArrayBaseLength(elements); | 2720 Node* length = LoadAndUntagFixedArrayBaseLength(elements); |
2648 | 2721 |
2649 GotoUnless(Uint32LessThan(index, SmiToWord32(length)), if_not_found); | 2722 GotoUnless(Uint32LessThan(index, length), if_not_found); |
2650 | 2723 |
2651 if (kPointerSize == kDoubleSize) { | 2724 if (kPointerSize == kDoubleSize) { |
2652 Node* element = | 2725 Node* element = |
2653 LoadFixedDoubleArrayElement(elements, index, MachineType::Uint64()); | 2726 LoadFixedDoubleArrayElement(elements, index, MachineType::Uint64()); |
2654 Node* the_hole = Int64Constant(kHoleNanInt64); | 2727 Node* the_hole = Int64Constant(kHoleNanInt64); |
2655 Branch(Word64Equal(element, the_hole), if_not_found, if_found); | 2728 Branch(Word64Equal(element, the_hole), if_not_found, if_found); |
2656 } else { | 2729 } else { |
2657 Node* element_upper = | 2730 Node* element_upper = |
2658 LoadFixedDoubleArrayElement(elements, index, MachineType::Uint32(), | 2731 LoadFixedDoubleArrayElement(elements, index, MachineType::Uint32(), |
2659 kIeeeDoubleExponentWordOffset); | 2732 kIeeeDoubleExponentWordOffset); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3046 GotoIf(WordNotEqual(receiver_map, cached_map), &next_entry); | 3119 GotoIf(WordNotEqual(receiver_map, cached_map), &next_entry); |
3047 | 3120 |
3048 // Found, now call handler. | 3121 // Found, now call handler. |
3049 Node* handler = | 3122 Node* handler = |
3050 LoadFixedArrayElement(feedback, Int32Constant(i * kEntrySize + 1)); | 3123 LoadFixedArrayElement(feedback, Int32Constant(i * kEntrySize + 1)); |
3051 var_handler->Bind(handler); | 3124 var_handler->Bind(handler); |
3052 Goto(if_handler); | 3125 Goto(if_handler); |
3053 | 3126 |
3054 Bind(&next_entry); | 3127 Bind(&next_entry); |
3055 } | 3128 } |
3056 Node* length = SmiToWord32(LoadFixedArrayBaseLength(feedback)); | 3129 Node* length = LoadAndUntagFixedArrayBaseLength(feedback); |
3057 | 3130 |
3058 // Loop from {unroll_count}*kEntrySize to {length}. | 3131 // Loop from {unroll_count}*kEntrySize to {length}. |
3059 Variable var_index(this, MachineRepresentation::kWord32); | 3132 Variable var_index(this, MachineRepresentation::kWord32); |
3060 Label loop(this, &var_index); | 3133 Label loop(this, &var_index); |
3061 var_index.Bind(Int32Constant(unroll_count * kEntrySize)); | 3134 var_index.Bind(Int32Constant(unroll_count * kEntrySize)); |
3062 Goto(&loop); | 3135 Goto(&loop); |
3063 Bind(&loop); | 3136 Bind(&loop); |
3064 { | 3137 { |
3065 Node* index = var_index.value(); | 3138 Node* index = var_index.value(); |
3066 GotoIf(Int32GreaterThanOrEqual(index, length), if_miss); | 3139 GotoIf(Int32GreaterThanOrEqual(index, length), if_miss); |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3486 Heap::kTheHoleValueRootIndex); | 3559 Heap::kTheHoleValueRootIndex); |
3487 | 3560 |
3488 // Store the WeakCell in the feedback vector. | 3561 // Store the WeakCell in the feedback vector. |
3489 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, | 3562 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, |
3490 CodeStubAssembler::SMI_PARAMETERS); | 3563 CodeStubAssembler::SMI_PARAMETERS); |
3491 return cell; | 3564 return cell; |
3492 } | 3565 } |
3493 | 3566 |
3494 } // namespace internal | 3567 } // namespace internal |
3495 } // namespace v8 | 3568 } // namespace v8 |
OLD | NEW |