| 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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
| 5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
| 7 #include "src/frames.h" | 7 #include "src/frames.h" |
| 8 #include "src/ic/handler-configuration.h" | 8 #include "src/ic/handler-configuration.h" |
| 9 #include "src/ic/stub-cache.h" | 9 #include "src/ic/stub-cache.h" |
| 10 | 10 |
| 11 namespace v8 { | 11 namespace v8 { |
| 12 namespace internal { | 12 namespace internal { |
| 13 | 13 |
| 14 using compiler::Node; | 14 using compiler::Node; |
| 15 | 15 |
| 16 CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone, | 16 CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone, |
| 17 const CallInterfaceDescriptor& descriptor, | 17 const CallInterfaceDescriptor& descriptor, |
| 18 Code::Flags flags, const char* name, | 18 Code::Flags flags, const char* name, |
| 19 size_t result_size) | 19 size_t result_size) |
| 20 : compiler::CodeAssembler(isolate, zone, descriptor, flags, name, | 20 : compiler::CodeAssembler(isolate, zone, descriptor, flags, name, |
| 21 result_size) {} | 21 result_size) {} |
| 22 | 22 |
| 23 CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone, | 23 CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone, |
| 24 int parameter_count, Code::Flags flags, | 24 int parameter_count, Code::Flags flags, |
| 25 const char* name) | 25 const char* name) |
| 26 : compiler::CodeAssembler(isolate, zone, parameter_count, flags, name) {} | 26 : compiler::CodeAssembler(isolate, zone, parameter_count, flags, name) {} |
| 27 | 27 |
| 28 |
| 29 void CodeStubAssembler::SlowAssert(Node* condition, const char* message, |
| 30 const char* file, int line) { |
| 31 if (FLAG_enable_slow_asserts) { |
| 32 Assert(condition, message, file, line); |
| 33 } |
| 34 } |
| 35 |
| 28 void CodeStubAssembler::Assert(Node* condition, const char* message, | 36 void CodeStubAssembler::Assert(Node* condition, const char* message, |
| 29 const char* file, int line) { | 37 const char* file, int line) { |
| 30 #if defined(DEBUG) | 38 #if defined(DEBUG) |
| 31 Label ok(this); | 39 Label ok(this); |
| 32 Label not_ok(this, Label::kDeferred); | 40 Label not_ok(this, Label::kDeferred); |
| 33 if (message != nullptr && FLAG_code_comments) { | 41 if (message != nullptr && FLAG_code_comments) { |
| 34 Comment("[ Assert: %s", message); | 42 Comment("[ Assert: %s", message); |
| 35 } else { | 43 } else { |
| 36 Comment("[ Assert "); | 44 Comment("[ Assert "); |
| 37 } | 45 } |
| (...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 } | 1014 } |
| 1007 | 1015 |
| 1008 Node* CodeStubAssembler::LoadProperties(Node* object) { | 1016 Node* CodeStubAssembler::LoadProperties(Node* object) { |
| 1009 return LoadObjectField(object, JSObject::kPropertiesOffset); | 1017 return LoadObjectField(object, JSObject::kPropertiesOffset); |
| 1010 } | 1018 } |
| 1011 | 1019 |
| 1012 Node* CodeStubAssembler::LoadElements(Node* object) { | 1020 Node* CodeStubAssembler::LoadElements(Node* object) { |
| 1013 return LoadObjectField(object, JSObject::kElementsOffset); | 1021 return LoadObjectField(object, JSObject::kElementsOffset); |
| 1014 } | 1022 } |
| 1015 | 1023 |
| 1016 Node* CodeStubAssembler::LoadJSArrayLength(compiler::Node* array) { | 1024 Node* CodeStubAssembler::LoadJSArrayLength(Node* array) { |
| 1025 CSA_ASSERT(IsJSArray(array)); |
| 1017 return LoadObjectField(array, JSArray::kLengthOffset); | 1026 return LoadObjectField(array, JSArray::kLengthOffset); |
| 1018 } | 1027 } |
| 1019 | 1028 |
| 1020 Node* CodeStubAssembler::LoadFixedArrayBaseLength(compiler::Node* array) { | 1029 Node* CodeStubAssembler::LoadFixedArrayBaseLength(Node* array) { |
| 1021 return LoadObjectField(array, FixedArrayBase::kLengthOffset); | 1030 return LoadObjectField(array, FixedArrayBase::kLengthOffset); |
| 1022 } | 1031 } |
| 1023 | 1032 |
| 1024 Node* CodeStubAssembler::LoadAndUntagFixedArrayBaseLength(Node* array) { | 1033 Node* CodeStubAssembler::LoadAndUntagFixedArrayBaseLength(Node* array) { |
| 1025 return LoadAndUntagObjectField(array, FixedArrayBase::kLengthOffset); | 1034 return LoadAndUntagObjectField(array, FixedArrayBase::kLengthOffset); |
| 1026 } | 1035 } |
| 1027 | 1036 |
| 1028 Node* CodeStubAssembler::LoadMapBitField(Node* map) { | 1037 Node* CodeStubAssembler::LoadMapBitField(Node* map) { |
| 1038 CSA_SLOW_ASSERT(IsMap(map)); |
| 1029 return LoadObjectField(map, Map::kBitFieldOffset, MachineType::Uint8()); | 1039 return LoadObjectField(map, Map::kBitFieldOffset, MachineType::Uint8()); |
| 1030 } | 1040 } |
| 1031 | 1041 |
| 1032 Node* CodeStubAssembler::LoadMapBitField2(Node* map) { | 1042 Node* CodeStubAssembler::LoadMapBitField2(Node* map) { |
| 1043 CSA_SLOW_ASSERT(IsMap(map)); |
| 1033 return LoadObjectField(map, Map::kBitField2Offset, MachineType::Uint8()); | 1044 return LoadObjectField(map, Map::kBitField2Offset, MachineType::Uint8()); |
| 1034 } | 1045 } |
| 1035 | 1046 |
| 1036 Node* CodeStubAssembler::LoadMapBitField3(Node* map) { | 1047 Node* CodeStubAssembler::LoadMapBitField3(Node* map) { |
| 1048 CSA_SLOW_ASSERT(IsMap(map)); |
| 1037 return LoadObjectField(map, Map::kBitField3Offset, MachineType::Uint32()); | 1049 return LoadObjectField(map, Map::kBitField3Offset, MachineType::Uint32()); |
| 1038 } | 1050 } |
| 1039 | 1051 |
| 1040 Node* CodeStubAssembler::LoadMapInstanceType(Node* map) { | 1052 Node* CodeStubAssembler::LoadMapInstanceType(Node* map) { |
| 1041 return LoadObjectField(map, Map::kInstanceTypeOffset, MachineType::Uint8()); | 1053 return LoadObjectField(map, Map::kInstanceTypeOffset, MachineType::Uint8()); |
| 1042 } | 1054 } |
| 1043 | 1055 |
| 1044 Node* CodeStubAssembler::LoadMapElementsKind(Node* map) { | 1056 Node* CodeStubAssembler::LoadMapElementsKind(Node* map) { |
| 1057 CSA_SLOW_ASSERT(IsMap(map)); |
| 1045 Node* bit_field2 = LoadMapBitField2(map); | 1058 Node* bit_field2 = LoadMapBitField2(map); |
| 1046 return DecodeWord32<Map::ElementsKindBits>(bit_field2); | 1059 return DecodeWord32<Map::ElementsKindBits>(bit_field2); |
| 1047 } | 1060 } |
| 1048 | 1061 |
| 1049 Node* CodeStubAssembler::LoadMapDescriptors(Node* map) { | 1062 Node* CodeStubAssembler::LoadMapDescriptors(Node* map) { |
| 1063 CSA_SLOW_ASSERT(IsMap(map)); |
| 1050 return LoadObjectField(map, Map::kDescriptorsOffset); | 1064 return LoadObjectField(map, Map::kDescriptorsOffset); |
| 1051 } | 1065 } |
| 1052 | 1066 |
| 1053 Node* CodeStubAssembler::LoadMapPrototype(Node* map) { | 1067 Node* CodeStubAssembler::LoadMapPrototype(Node* map) { |
| 1068 CSA_SLOW_ASSERT(IsMap(map)); |
| 1054 return LoadObjectField(map, Map::kPrototypeOffset); | 1069 return LoadObjectField(map, Map::kPrototypeOffset); |
| 1055 } | 1070 } |
| 1056 | 1071 |
| 1057 Node* CodeStubAssembler::LoadMapPrototypeInfo(Node* map, | 1072 Node* CodeStubAssembler::LoadMapPrototypeInfo(Node* map, |
| 1058 Label* if_no_proto_info) { | 1073 Label* if_no_proto_info) { |
| 1074 CSA_ASSERT(IsMap(map)); |
| 1059 Node* prototype_info = | 1075 Node* prototype_info = |
| 1060 LoadObjectField(map, Map::kTransitionsOrPrototypeInfoOffset); | 1076 LoadObjectField(map, Map::kTransitionsOrPrototypeInfoOffset); |
| 1061 GotoIf(TaggedIsSmi(prototype_info), if_no_proto_info); | 1077 GotoIf(TaggedIsSmi(prototype_info), if_no_proto_info); |
| 1062 GotoUnless(WordEqual(LoadMap(prototype_info), | 1078 GotoUnless(WordEqual(LoadMap(prototype_info), |
| 1063 LoadRoot(Heap::kPrototypeInfoMapRootIndex)), | 1079 LoadRoot(Heap::kPrototypeInfoMapRootIndex)), |
| 1064 if_no_proto_info); | 1080 if_no_proto_info); |
| 1065 return prototype_info; | 1081 return prototype_info; |
| 1066 } | 1082 } |
| 1067 | 1083 |
| 1068 Node* CodeStubAssembler::LoadMapInstanceSize(Node* map) { | 1084 Node* CodeStubAssembler::LoadMapInstanceSize(Node* map) { |
| 1085 CSA_SLOW_ASSERT(IsMap(map)); |
| 1069 return ChangeUint32ToWord( | 1086 return ChangeUint32ToWord( |
| 1070 LoadObjectField(map, Map::kInstanceSizeOffset, MachineType::Uint8())); | 1087 LoadObjectField(map, Map::kInstanceSizeOffset, MachineType::Uint8())); |
| 1071 } | 1088 } |
| 1072 | 1089 |
| 1073 Node* CodeStubAssembler::LoadMapInobjectProperties(Node* map) { | 1090 Node* CodeStubAssembler::LoadMapInobjectProperties(Node* map) { |
| 1091 CSA_SLOW_ASSERT(IsMap(map)); |
| 1074 // See Map::GetInObjectProperties() for details. | 1092 // See Map::GetInObjectProperties() for details. |
| 1075 STATIC_ASSERT(LAST_JS_OBJECT_TYPE == LAST_TYPE); | 1093 STATIC_ASSERT(LAST_JS_OBJECT_TYPE == LAST_TYPE); |
| 1076 CSA_ASSERT(Int32GreaterThanOrEqual(LoadMapInstanceType(map), | 1094 CSA_ASSERT(Int32GreaterThanOrEqual(LoadMapInstanceType(map), |
| 1077 Int32Constant(FIRST_JS_OBJECT_TYPE))); | 1095 Int32Constant(FIRST_JS_OBJECT_TYPE))); |
| 1078 return ChangeUint32ToWord(LoadObjectField( | 1096 return ChangeUint32ToWord(LoadObjectField( |
| 1079 map, Map::kInObjectPropertiesOrConstructorFunctionIndexOffset, | 1097 map, Map::kInObjectPropertiesOrConstructorFunctionIndexOffset, |
| 1080 MachineType::Uint8())); | 1098 MachineType::Uint8())); |
| 1081 } | 1099 } |
| 1082 | 1100 |
| 1083 Node* CodeStubAssembler::LoadMapConstructorFunctionIndex(Node* map) { | 1101 Node* CodeStubAssembler::LoadMapConstructorFunctionIndex(Node* map) { |
| 1102 CSA_SLOW_ASSERT(IsMap(map)); |
| 1084 // See Map::GetConstructorFunctionIndex() for details. | 1103 // See Map::GetConstructorFunctionIndex() for details. |
| 1085 STATIC_ASSERT(FIRST_PRIMITIVE_TYPE == FIRST_TYPE); | 1104 STATIC_ASSERT(FIRST_PRIMITIVE_TYPE == FIRST_TYPE); |
| 1086 CSA_ASSERT(Int32LessThanOrEqual(LoadMapInstanceType(map), | 1105 CSA_ASSERT(Int32LessThanOrEqual(LoadMapInstanceType(map), |
| 1087 Int32Constant(LAST_PRIMITIVE_TYPE))); | 1106 Int32Constant(LAST_PRIMITIVE_TYPE))); |
| 1088 return ChangeUint32ToWord(LoadObjectField( | 1107 return ChangeUint32ToWord(LoadObjectField( |
| 1089 map, Map::kInObjectPropertiesOrConstructorFunctionIndexOffset, | 1108 map, Map::kInObjectPropertiesOrConstructorFunctionIndexOffset, |
| 1090 MachineType::Uint8())); | 1109 MachineType::Uint8())); |
| 1091 } | 1110 } |
| 1092 | 1111 |
| 1093 Node* CodeStubAssembler::LoadMapConstructor(Node* map) { | 1112 Node* CodeStubAssembler::LoadMapConstructor(Node* map) { |
| 1113 CSA_SLOW_ASSERT(IsMap(map)); |
| 1094 Variable result(this, MachineRepresentation::kTagged); | 1114 Variable result(this, MachineRepresentation::kTagged); |
| 1095 result.Bind(LoadObjectField(map, Map::kConstructorOrBackPointerOffset)); | 1115 result.Bind(LoadObjectField(map, Map::kConstructorOrBackPointerOffset)); |
| 1096 | 1116 |
| 1097 Label done(this), loop(this, &result); | 1117 Label done(this), loop(this, &result); |
| 1098 Goto(&loop); | 1118 Goto(&loop); |
| 1099 Bind(&loop); | 1119 Bind(&loop); |
| 1100 { | 1120 { |
| 1101 GotoIf(TaggedIsSmi(result.value()), &done); | 1121 GotoIf(TaggedIsSmi(result.value()), &done); |
| 1102 Node* is_map_type = | 1122 Node* is_map_type = |
| 1103 Word32Equal(LoadInstanceType(result.value()), Int32Constant(MAP_TYPE)); | 1123 Word32Equal(LoadInstanceType(result.value()), Int32Constant(MAP_TYPE)); |
| 1104 GotoUnless(is_map_type, &done); | 1124 GotoUnless(is_map_type, &done); |
| 1105 result.Bind( | 1125 result.Bind( |
| 1106 LoadObjectField(result.value(), Map::kConstructorOrBackPointerOffset)); | 1126 LoadObjectField(result.value(), Map::kConstructorOrBackPointerOffset)); |
| 1107 Goto(&loop); | 1127 Goto(&loop); |
| 1108 } | 1128 } |
| 1109 Bind(&done); | 1129 Bind(&done); |
| 1110 return result.value(); | 1130 return result.value(); |
| 1111 } | 1131 } |
| 1112 | 1132 |
| 1113 Node* CodeStubAssembler::IsSpecialReceiverMap(Node* map) { | |
| 1114 Node* bit_field = LoadMapBitField(map); | |
| 1115 Node* mask = Int32Constant(1 << Map::kHasNamedInterceptor | | |
| 1116 1 << Map::kIsAccessCheckNeeded); | |
| 1117 Assert(Word32Equal(Word32And(bit_field, mask), Int32Constant(0))); | |
| 1118 return IsSpecialReceiverInstanceType(LoadMapInstanceType(map)); | |
| 1119 } | |
| 1120 | |
| 1121 Node* CodeStubAssembler::IsSpecialReceiverInstanceType(Node* instance_type) { | |
| 1122 STATIC_ASSERT(JS_GLOBAL_OBJECT_TYPE <= LAST_SPECIAL_RECEIVER_TYPE); | |
| 1123 return Int32LessThanOrEqual(instance_type, | |
| 1124 Int32Constant(LAST_SPECIAL_RECEIVER_TYPE)); | |
| 1125 } | |
| 1126 | |
| 1127 Node* CodeStubAssembler::IsDictionaryMap(Node* map) { | 1133 Node* CodeStubAssembler::IsDictionaryMap(Node* map) { |
| 1134 CSA_SLOW_ASSERT(IsMap(map)); |
| 1128 Node* bit_field3 = LoadMapBitField3(map); | 1135 Node* bit_field3 = LoadMapBitField3(map); |
| 1129 return Word32NotEqual(IsSetWord32<Map::DictionaryMap>(bit_field3), | 1136 return Word32NotEqual(IsSetWord32<Map::DictionaryMap>(bit_field3), |
| 1130 Int32Constant(0)); | 1137 Int32Constant(0)); |
| 1131 } | 1138 } |
| 1132 | 1139 |
| 1133 Node* CodeStubAssembler::LoadNameHashField(Node* name) { | 1140 Node* CodeStubAssembler::LoadNameHashField(Node* name) { |
| 1141 CSA_ASSERT(IsName(name)); |
| 1134 return LoadObjectField(name, Name::kHashFieldOffset, MachineType::Uint32()); | 1142 return LoadObjectField(name, Name::kHashFieldOffset, MachineType::Uint32()); |
| 1135 } | 1143 } |
| 1136 | 1144 |
| 1137 Node* CodeStubAssembler::LoadNameHash(Node* name, Label* if_hash_not_computed) { | 1145 Node* CodeStubAssembler::LoadNameHash(Node* name, Label* if_hash_not_computed) { |
| 1138 Node* hash_field = LoadNameHashField(name); | 1146 Node* hash_field = LoadNameHashField(name); |
| 1139 if (if_hash_not_computed != nullptr) { | 1147 if (if_hash_not_computed != nullptr) { |
| 1140 GotoIf(Word32Equal( | 1148 GotoIf(Word32Equal( |
| 1141 Word32And(hash_field, Int32Constant(Name::kHashNotComputedMask)), | 1149 Word32And(hash_field, Int32Constant(Name::kHashNotComputedMask)), |
| 1142 Int32Constant(0)), | 1150 Int32Constant(0)), |
| 1143 if_hash_not_computed); | 1151 if_hash_not_computed); |
| 1144 } | 1152 } |
| 1145 return Word32Shr(hash_field, Int32Constant(Name::kHashShift)); | 1153 return Word32Shr(hash_field, Int32Constant(Name::kHashShift)); |
| 1146 } | 1154 } |
| 1147 | 1155 |
| 1148 Node* CodeStubAssembler::LoadStringLength(Node* object) { | 1156 Node* CodeStubAssembler::LoadStringLength(Node* object) { |
| 1157 CSA_ASSERT(IsString(object)); |
| 1149 return LoadObjectField(object, String::kLengthOffset); | 1158 return LoadObjectField(object, String::kLengthOffset); |
| 1150 } | 1159 } |
| 1151 | 1160 |
| 1152 Node* CodeStubAssembler::LoadJSValueValue(Node* object) { | 1161 Node* CodeStubAssembler::LoadJSValueValue(Node* object) { |
| 1162 CSA_ASSERT(IsJSValue(object)); |
| 1153 return LoadObjectField(object, JSValue::kValueOffset); | 1163 return LoadObjectField(object, JSValue::kValueOffset); |
| 1154 } | 1164 } |
| 1155 | 1165 |
| 1166 Node* CodeStubAssembler::LoadWeakCellValueUnchecked(Node* weak_cell) { |
| 1167 // TODO(ishell): fix callers. |
| 1168 return LoadObjectField(weak_cell, WeakCell::kValueOffset); |
| 1169 } |
| 1170 |
| 1156 Node* CodeStubAssembler::LoadWeakCellValue(Node* weak_cell, Label* if_cleared) { | 1171 Node* CodeStubAssembler::LoadWeakCellValue(Node* weak_cell, Label* if_cleared) { |
| 1157 Node* value = LoadObjectField(weak_cell, WeakCell::kValueOffset); | 1172 CSA_ASSERT(IsWeakCell(weak_cell)); |
| 1173 Node* value = LoadWeakCellValueUnchecked(weak_cell); |
| 1158 if (if_cleared != nullptr) { | 1174 if (if_cleared != nullptr) { |
| 1159 GotoIf(WordEqual(value, IntPtrConstant(0)), if_cleared); | 1175 GotoIf(WordEqual(value, IntPtrConstant(0)), if_cleared); |
| 1160 } | 1176 } |
| 1161 return value; | 1177 return value; |
| 1162 } | 1178 } |
| 1163 | 1179 |
| 1164 Node* CodeStubAssembler::LoadFixedArrayElement(Node* object, Node* index_node, | 1180 Node* CodeStubAssembler::LoadFixedArrayElement(Node* object, Node* index_node, |
| 1165 int additional_offset, | 1181 int additional_offset, |
| 1166 ParameterMode parameter_mode) { | 1182 ParameterMode parameter_mode) { |
| 1167 int32_t header_size = | 1183 int32_t header_size = |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 if (Is64()) { | 1240 if (Is64()) { |
| 1225 return Load(MachineType::Int32(), object, offset); | 1241 return Load(MachineType::Int32(), object, offset); |
| 1226 } else { | 1242 } else { |
| 1227 return SmiToWord32(Load(MachineType::AnyTagged(), object, offset)); | 1243 return SmiToWord32(Load(MachineType::AnyTagged(), object, offset)); |
| 1228 } | 1244 } |
| 1229 } | 1245 } |
| 1230 | 1246 |
| 1231 Node* CodeStubAssembler::LoadFixedDoubleArrayElement( | 1247 Node* CodeStubAssembler::LoadFixedDoubleArrayElement( |
| 1232 Node* object, Node* index_node, MachineType machine_type, | 1248 Node* object, Node* index_node, MachineType machine_type, |
| 1233 int additional_offset, ParameterMode parameter_mode, Label* if_hole) { | 1249 int additional_offset, ParameterMode parameter_mode, Label* if_hole) { |
| 1250 CSA_ASSERT(IsFixedDoubleArray(object)); |
| 1234 int32_t header_size = | 1251 int32_t header_size = |
| 1235 FixedDoubleArray::kHeaderSize + additional_offset - kHeapObjectTag; | 1252 FixedDoubleArray::kHeaderSize + additional_offset - kHeapObjectTag; |
| 1236 Node* offset = ElementOffsetFromIndex(index_node, FAST_HOLEY_DOUBLE_ELEMENTS, | 1253 Node* offset = ElementOffsetFromIndex(index_node, FAST_HOLEY_DOUBLE_ELEMENTS, |
| 1237 parameter_mode, header_size); | 1254 parameter_mode, header_size); |
| 1238 return LoadDoubleWithHoleCheck(object, offset, if_hole, machine_type); | 1255 return LoadDoubleWithHoleCheck(object, offset, if_hole, machine_type); |
| 1239 } | 1256 } |
| 1240 | 1257 |
| 1241 Node* CodeStubAssembler::LoadDoubleWithHoleCheck(Node* base, Node* offset, | 1258 Node* CodeStubAssembler::LoadDoubleWithHoleCheck(Node* base, Node* offset, |
| 1242 Label* if_hole, | 1259 Label* if_hole, |
| 1243 MachineType machine_type) { | 1260 MachineType machine_type) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1274 return Store(MachineRepresentation::kTagged, context, IntPtrConstant(offset), | 1291 return Store(MachineRepresentation::kTagged, context, IntPtrConstant(offset), |
| 1275 value); | 1292 value); |
| 1276 } | 1293 } |
| 1277 | 1294 |
| 1278 Node* CodeStubAssembler::LoadNativeContext(Node* context) { | 1295 Node* CodeStubAssembler::LoadNativeContext(Node* context) { |
| 1279 return LoadContextElement(context, Context::NATIVE_CONTEXT_INDEX); | 1296 return LoadContextElement(context, Context::NATIVE_CONTEXT_INDEX); |
| 1280 } | 1297 } |
| 1281 | 1298 |
| 1282 Node* CodeStubAssembler::LoadJSArrayElementsMap(ElementsKind kind, | 1299 Node* CodeStubAssembler::LoadJSArrayElementsMap(ElementsKind kind, |
| 1283 Node* native_context) { | 1300 Node* native_context) { |
| 1301 CSA_ASSERT(IsNativeContext(native_context)); |
| 1284 return LoadFixedArrayElement(native_context, | 1302 return LoadFixedArrayElement(native_context, |
| 1285 IntPtrConstant(Context::ArrayMapIndex(kind))); | 1303 IntPtrConstant(Context::ArrayMapIndex(kind))); |
| 1286 } | 1304 } |
| 1287 | 1305 |
| 1288 Node* CodeStubAssembler::StoreHeapNumberValue(Node* object, Node* value) { | 1306 Node* CodeStubAssembler::StoreHeapNumberValue(Node* object, Node* value) { |
| 1289 return StoreObjectFieldNoWriteBarrier(object, HeapNumber::kValueOffset, value, | 1307 return StoreObjectFieldNoWriteBarrier(object, HeapNumber::kValueOffset, value, |
| 1290 MachineRepresentation::kFloat64); | 1308 MachineRepresentation::kFloat64); |
| 1291 } | 1309 } |
| 1292 | 1310 |
| 1293 Node* CodeStubAssembler::StoreObjectField( | 1311 Node* CodeStubAssembler::StoreObjectField( |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 MachineRepresentation rep = MachineRepresentation::kTagged; | 1367 MachineRepresentation rep = MachineRepresentation::kTagged; |
| 1350 if (barrier_mode == SKIP_WRITE_BARRIER) { | 1368 if (barrier_mode == SKIP_WRITE_BARRIER) { |
| 1351 return StoreNoWriteBarrier(rep, object, offset, value); | 1369 return StoreNoWriteBarrier(rep, object, offset, value); |
| 1352 } else { | 1370 } else { |
| 1353 return Store(rep, object, offset, value); | 1371 return Store(rep, object, offset, value); |
| 1354 } | 1372 } |
| 1355 } | 1373 } |
| 1356 | 1374 |
| 1357 Node* CodeStubAssembler::StoreFixedDoubleArrayElement( | 1375 Node* CodeStubAssembler::StoreFixedDoubleArrayElement( |
| 1358 Node* object, Node* index_node, Node* value, ParameterMode parameter_mode) { | 1376 Node* object, Node* index_node, Node* value, ParameterMode parameter_mode) { |
| 1377 CSA_ASSERT(IsFixedDoubleArray(object)); |
| 1359 Node* offset = | 1378 Node* offset = |
| 1360 ElementOffsetFromIndex(index_node, FAST_DOUBLE_ELEMENTS, parameter_mode, | 1379 ElementOffsetFromIndex(index_node, FAST_DOUBLE_ELEMENTS, parameter_mode, |
| 1361 FixedArray::kHeaderSize - kHeapObjectTag); | 1380 FixedArray::kHeaderSize - kHeapObjectTag); |
| 1362 MachineRepresentation rep = MachineRepresentation::kFloat64; | 1381 MachineRepresentation rep = MachineRepresentation::kFloat64; |
| 1363 return StoreNoWriteBarrier(rep, object, offset, value); | 1382 return StoreNoWriteBarrier(rep, object, offset, value); |
| 1364 } | 1383 } |
| 1365 | 1384 |
| 1366 Node* CodeStubAssembler::AllocateHeapNumber(MutableMode mode) { | 1385 Node* CodeStubAssembler::AllocateHeapNumber(MutableMode mode) { |
| 1367 Node* result = Allocate(HeapNumber::kSize, kNone); | 1386 Node* result = Allocate(HeapNumber::kSize, kNone); |
| 1368 Heap::RootListIndex heap_map_index = | 1387 Heap::RootListIndex heap_map_index = |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 CallRuntime(Runtime::kAllocateSeqTwoByteString, context, | 1512 CallRuntime(Runtime::kAllocateSeqTwoByteString, context, |
| 1494 mode == SMI_PARAMETERS ? length : SmiFromWord(length)); | 1513 mode == SMI_PARAMETERS ? length : SmiFromWord(length)); |
| 1495 var_result.Bind(result); | 1514 var_result.Bind(result); |
| 1496 Goto(&if_join); | 1515 Goto(&if_join); |
| 1497 } | 1516 } |
| 1498 | 1517 |
| 1499 Bind(&if_join); | 1518 Bind(&if_join); |
| 1500 return var_result.value(); | 1519 return var_result.value(); |
| 1501 } | 1520 } |
| 1502 | 1521 |
| 1503 Node* CodeStubAssembler::AllocateSlicedOneByteString(Node* length, Node* parent, | 1522 Node* CodeStubAssembler::AllocateSlicedString( |
| 1504 Node* offset) { | 1523 Heap::RootListIndex map_root_index, Node* length, Node* parent, |
| 1524 Node* offset) { |
| 1525 CSA_ASSERT(TaggedIsSmi(length)); |
| 1505 Node* result = Allocate(SlicedString::kSize); | 1526 Node* result = Allocate(SlicedString::kSize); |
| 1506 Node* map = LoadRoot(Heap::kSlicedOneByteStringMapRootIndex); | 1527 Node* map = LoadRoot(map_root_index); |
| 1528 DCHECK(Heap::RootIsImmortalImmovable(map_root_index)); |
| 1507 StoreMapNoWriteBarrier(result, map); | 1529 StoreMapNoWriteBarrier(result, map); |
| 1508 StoreObjectFieldNoWriteBarrier(result, SlicedString::kLengthOffset, length, | 1530 StoreObjectFieldNoWriteBarrier(result, SlicedString::kLengthOffset, length, |
| 1509 MachineRepresentation::kTagged); | 1531 MachineRepresentation::kTagged); |
| 1510 StoreObjectFieldNoWriteBarrier(result, SlicedString::kHashFieldOffset, | 1532 StoreObjectFieldNoWriteBarrier(result, SlicedString::kHashFieldOffset, |
| 1511 Int32Constant(String::kEmptyHashField), | 1533 Int32Constant(String::kEmptyHashField), |
| 1512 MachineRepresentation::kWord32); | 1534 MachineRepresentation::kWord32); |
| 1513 StoreObjectFieldNoWriteBarrier(result, SlicedString::kParentOffset, parent, | 1535 StoreObjectFieldNoWriteBarrier(result, SlicedString::kParentOffset, parent, |
| 1514 MachineRepresentation::kTagged); | 1536 MachineRepresentation::kTagged); |
| 1515 StoreObjectFieldNoWriteBarrier(result, SlicedString::kOffsetOffset, offset, | 1537 StoreObjectFieldNoWriteBarrier(result, SlicedString::kOffsetOffset, offset, |
| 1516 MachineRepresentation::kTagged); | 1538 MachineRepresentation::kTagged); |
| 1517 return result; | 1539 return result; |
| 1518 } | 1540 } |
| 1519 | 1541 |
| 1542 Node* CodeStubAssembler::AllocateSlicedOneByteString(Node* length, Node* parent, |
| 1543 Node* offset) { |
| 1544 return AllocateSlicedString(Heap::kSlicedOneByteStringMapRootIndex, length, |
| 1545 parent, offset); |
| 1546 } |
| 1547 |
| 1520 Node* CodeStubAssembler::AllocateSlicedTwoByteString(Node* length, Node* parent, | 1548 Node* CodeStubAssembler::AllocateSlicedTwoByteString(Node* length, Node* parent, |
| 1521 Node* offset) { | 1549 Node* offset) { |
| 1522 CSA_ASSERT(TaggedIsSmi(length)); | 1550 return AllocateSlicedString(Heap::kSlicedStringMapRootIndex, length, parent, |
| 1523 Node* result = Allocate(SlicedString::kSize); | 1551 offset); |
| 1524 Node* map = LoadRoot(Heap::kSlicedStringMapRootIndex); | |
| 1525 StoreMapNoWriteBarrier(result, map); | |
| 1526 StoreObjectFieldNoWriteBarrier(result, SlicedString::kLengthOffset, length, | |
| 1527 MachineRepresentation::kTagged); | |
| 1528 StoreObjectFieldNoWriteBarrier(result, SlicedString::kHashFieldOffset, | |
| 1529 Int32Constant(String::kEmptyHashField), | |
| 1530 MachineRepresentation::kWord32); | |
| 1531 StoreObjectFieldNoWriteBarrier(result, SlicedString::kParentOffset, parent, | |
| 1532 MachineRepresentation::kTagged); | |
| 1533 StoreObjectFieldNoWriteBarrier(result, SlicedString::kOffsetOffset, offset, | |
| 1534 MachineRepresentation::kTagged); | |
| 1535 return result; | |
| 1536 } | 1552 } |
| 1537 | 1553 |
| 1538 Node* CodeStubAssembler::AllocateOneByteConsString(Node* length, Node* first, | 1554 Node* CodeStubAssembler::AllocateConsString(Heap::RootListIndex map_root_index, |
| 1539 Node* second, | 1555 Node* length, Node* first, |
| 1540 AllocationFlags flags) { | 1556 Node* second, |
| 1557 AllocationFlags flags) { |
| 1541 CSA_ASSERT(TaggedIsSmi(length)); | 1558 CSA_ASSERT(TaggedIsSmi(length)); |
| 1542 Node* result = Allocate(ConsString::kSize, flags); | 1559 Node* result = Allocate(ConsString::kSize, flags); |
| 1543 Node* map = LoadRoot(Heap::kConsOneByteStringMapRootIndex); | 1560 Node* map = LoadRoot(map_root_index); |
| 1544 DCHECK(Heap::RootIsImmortalImmovable(Heap::kConsOneByteStringMapRootIndex)); | 1561 DCHECK(Heap::RootIsImmortalImmovable(map_root_index)); |
| 1545 StoreMapNoWriteBarrier(result, map); | 1562 StoreMapNoWriteBarrier(result, map); |
| 1546 StoreObjectFieldNoWriteBarrier(result, ConsString::kLengthOffset, length, | 1563 StoreObjectFieldNoWriteBarrier(result, ConsString::kLengthOffset, length, |
| 1547 MachineRepresentation::kTagged); | 1564 MachineRepresentation::kTagged); |
| 1548 StoreObjectFieldNoWriteBarrier(result, ConsString::kHashFieldOffset, | 1565 StoreObjectFieldNoWriteBarrier(result, ConsString::kHashFieldOffset, |
| 1549 Int32Constant(String::kEmptyHashField), | 1566 Int32Constant(String::kEmptyHashField), |
| 1550 MachineRepresentation::kWord32); | 1567 MachineRepresentation::kWord32); |
| 1551 bool const new_space = !(flags & kPretenured); | 1568 bool const new_space = !(flags & kPretenured); |
| 1552 if (new_space) { | 1569 if (new_space) { |
| 1553 StoreObjectFieldNoWriteBarrier(result, ConsString::kFirstOffset, first, | 1570 StoreObjectFieldNoWriteBarrier(result, ConsString::kFirstOffset, first, |
| 1554 MachineRepresentation::kTagged); | 1571 MachineRepresentation::kTagged); |
| 1555 StoreObjectFieldNoWriteBarrier(result, ConsString::kSecondOffset, second, | 1572 StoreObjectFieldNoWriteBarrier(result, ConsString::kSecondOffset, second, |
| 1556 MachineRepresentation::kTagged); | 1573 MachineRepresentation::kTagged); |
| 1557 } else { | 1574 } else { |
| 1558 StoreObjectField(result, ConsString::kFirstOffset, first); | 1575 StoreObjectField(result, ConsString::kFirstOffset, first); |
| 1559 StoreObjectField(result, ConsString::kSecondOffset, second); | 1576 StoreObjectField(result, ConsString::kSecondOffset, second); |
| 1560 } | 1577 } |
| 1561 return result; | 1578 return result; |
| 1562 } | 1579 } |
| 1563 | 1580 |
| 1581 Node* CodeStubAssembler::AllocateOneByteConsString(Node* length, Node* first, |
| 1582 Node* second, |
| 1583 AllocationFlags flags) { |
| 1584 return AllocateConsString(Heap::kConsOneByteStringMapRootIndex, length, first, |
| 1585 second, flags); |
| 1586 } |
| 1587 |
| 1564 Node* CodeStubAssembler::AllocateTwoByteConsString(Node* length, Node* first, | 1588 Node* CodeStubAssembler::AllocateTwoByteConsString(Node* length, Node* first, |
| 1565 Node* second, | 1589 Node* second, |
| 1566 AllocationFlags flags) { | 1590 AllocationFlags flags) { |
| 1567 CSA_ASSERT(TaggedIsSmi(length)); | 1591 return AllocateConsString(Heap::kConsStringMapRootIndex, length, first, |
| 1568 Node* result = Allocate(ConsString::kSize, flags); | 1592 second, flags); |
| 1569 Node* map = LoadRoot(Heap::kConsStringMapRootIndex); | |
| 1570 DCHECK(Heap::RootIsImmortalImmovable(Heap::kConsStringMapRootIndex)); | |
| 1571 StoreMapNoWriteBarrier(result, map); | |
| 1572 StoreObjectFieldNoWriteBarrier(result, ConsString::kLengthOffset, length, | |
| 1573 MachineRepresentation::kTagged); | |
| 1574 StoreObjectFieldNoWriteBarrier(result, ConsString::kHashFieldOffset, | |
| 1575 Int32Constant(String::kEmptyHashField), | |
| 1576 MachineRepresentation::kWord32); | |
| 1577 bool const new_space = !(flags & kPretenured); | |
| 1578 if (new_space) { | |
| 1579 StoreObjectFieldNoWriteBarrier(result, ConsString::kFirstOffset, first, | |
| 1580 MachineRepresentation::kTagged); | |
| 1581 StoreObjectFieldNoWriteBarrier(result, ConsString::kSecondOffset, second, | |
| 1582 MachineRepresentation::kTagged); | |
| 1583 } else { | |
| 1584 StoreObjectField(result, ConsString::kFirstOffset, first); | |
| 1585 StoreObjectField(result, ConsString::kSecondOffset, second); | |
| 1586 } | |
| 1587 return result; | |
| 1588 } | 1593 } |
| 1589 | 1594 |
| 1590 Node* CodeStubAssembler::NewConsString(Node* context, Node* length, Node* left, | 1595 Node* CodeStubAssembler::NewConsString(Node* context, Node* length, Node* left, |
| 1591 Node* right, AllocationFlags flags) { | 1596 Node* right, AllocationFlags flags) { |
| 1592 CSA_ASSERT(TaggedIsSmi(length)); | 1597 CSA_ASSERT(TaggedIsSmi(length)); |
| 1593 // Added string can be a cons string. | 1598 // Added string can be a cons string. |
| 1594 Comment("Allocating ConsString"); | 1599 Comment("Allocating ConsString"); |
| 1595 Node* left_instance_type = LoadInstanceType(left); | 1600 Node* left_instance_type = LoadInstanceType(left); |
| 1596 Node* right_instance_type = LoadInstanceType(right); | 1601 Node* right_instance_type = LoadInstanceType(right); |
| 1597 | 1602 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1730 kHeapObjectTag)); | 1735 kHeapObjectTag)); |
| 1731 Node* end_address = IntPtrAdd( | 1736 Node* end_address = IntPtrAdd( |
| 1732 result, | 1737 result, |
| 1733 IntPtrSubFoldConstants(store_size, IntPtrConstant(kHeapObjectTag))); | 1738 IntPtrSubFoldConstants(store_size, IntPtrConstant(kHeapObjectTag))); |
| 1734 StoreFieldsNoWriteBarrier(start_address, end_address, filler); | 1739 StoreFieldsNoWriteBarrier(start_address, end_address, filler); |
| 1735 return result; | 1740 return result; |
| 1736 } | 1741 } |
| 1737 | 1742 |
| 1738 Node* CodeStubAssembler::AllocateJSObjectFromMap(Node* map, Node* properties, | 1743 Node* CodeStubAssembler::AllocateJSObjectFromMap(Node* map, Node* properties, |
| 1739 Node* elements) { | 1744 Node* elements) { |
| 1745 CSA_ASSERT(IsMap(map)); |
| 1740 Node* size = | 1746 Node* size = |
| 1741 IntPtrMul(LoadMapInstanceSize(map), IntPtrConstant(kPointerSize)); | 1747 IntPtrMul(LoadMapInstanceSize(map), IntPtrConstant(kPointerSize)); |
| 1742 CSA_ASSERT(IsRegularHeapObjectSize(size)); | 1748 CSA_ASSERT(IsRegularHeapObjectSize(size)); |
| 1743 Node* object = Allocate(size); | 1749 Node* object = Allocate(size); |
| 1744 StoreMapNoWriteBarrier(object, map); | 1750 StoreMapNoWriteBarrier(object, map); |
| 1745 InitializeJSObjectFromMap(object, map, size, properties, elements); | 1751 InitializeJSObjectFromMap(object, map, size, properties, elements); |
| 1746 return object; | 1752 return object; |
| 1747 } | 1753 } |
| 1748 | 1754 |
| 1749 void CodeStubAssembler::InitializeJSObjectFromMap(Node* object, Node* map, | 1755 void CodeStubAssembler::InitializeJSObjectFromMap(Node* object, Node* map, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1882 : IntPtrConstant(0), | 1888 : IntPtrConstant(0), |
| 1883 capacity, Heap::kTheHoleValueRootIndex, capacity_mode); | 1889 capacity, Heap::kTheHoleValueRootIndex, capacity_mode); |
| 1884 | 1890 |
| 1885 return array; | 1891 return array; |
| 1886 } | 1892 } |
| 1887 | 1893 |
| 1888 Node* CodeStubAssembler::AllocateFixedArray(ElementsKind kind, | 1894 Node* CodeStubAssembler::AllocateFixedArray(ElementsKind kind, |
| 1889 Node* capacity_node, | 1895 Node* capacity_node, |
| 1890 ParameterMode mode, | 1896 ParameterMode mode, |
| 1891 AllocationFlags flags) { | 1897 AllocationFlags flags) { |
| 1898 CSA_ASSERT(IntPtrGreaterThan(capacity_node, IntPtrOrSmiConstant(0, mode))); |
| 1892 Node* total_size = GetFixedArrayAllocationSize(capacity_node, kind, mode); | 1899 Node* total_size = GetFixedArrayAllocationSize(capacity_node, kind, mode); |
| 1893 | 1900 |
| 1894 // Allocate both array and elements object, and initialize the JSArray. | 1901 // Allocate both array and elements object, and initialize the JSArray. |
| 1895 Node* array = Allocate(total_size, flags); | 1902 Node* array = Allocate(total_size, flags); |
| 1896 Heap* heap = isolate()->heap(); | 1903 Heap* heap = isolate()->heap(); |
| 1897 Handle<Map> map(IsFastDoubleElementsKind(kind) | 1904 Handle<Map> map(IsFastDoubleElementsKind(kind) |
| 1898 ? heap->fixed_double_array_map() | 1905 ? heap->fixed_double_array_map() |
| 1899 : heap->fixed_array_map()); | 1906 : heap->fixed_array_map()); |
| 1900 if (flags & kPretenured) { | 1907 if (flags & kPretenured) { |
| 1901 StoreObjectField(array, JSObject::kMapOffset, HeapConstant(map)); | 1908 StoreObjectField(array, JSObject::kMapOffset, HeapConstant(map)); |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2628 Runtime::kThrowIncompatibleMethodReceiver, context, | 2635 Runtime::kThrowIncompatibleMethodReceiver, context, |
| 2629 HeapConstant(factory()->NewStringFromAsciiChecked(method_name, TENURED)), | 2636 HeapConstant(factory()->NewStringFromAsciiChecked(method_name, TENURED)), |
| 2630 value); | 2637 value); |
| 2631 var_value_map.Bind(UndefinedConstant()); | 2638 var_value_map.Bind(UndefinedConstant()); |
| 2632 Goto(&out); // Never reached. | 2639 Goto(&out); // Never reached. |
| 2633 | 2640 |
| 2634 Bind(&out); | 2641 Bind(&out); |
| 2635 return var_value_map.value(); | 2642 return var_value_map.value(); |
| 2636 } | 2643 } |
| 2637 | 2644 |
| 2645 Node* CodeStubAssembler::IsSpecialReceiverMap(Node* map) { |
| 2646 CSA_ASSERT(IsMap(map)); |
| 2647 Node* bit_field = LoadMapBitField(map); |
| 2648 Node* mask = Int32Constant(1 << Map::kHasNamedInterceptor | |
| 2649 1 << Map::kIsAccessCheckNeeded); |
| 2650 Assert(Word32Equal(Word32And(bit_field, mask), Int32Constant(0))); |
| 2651 return IsSpecialReceiverInstanceType(LoadMapInstanceType(map)); |
| 2652 } |
| 2653 |
| 2654 Node* CodeStubAssembler::IsCallableMap(Node* map) { |
| 2655 CSA_ASSERT(IsMap(map)); |
| 2656 return Word32NotEqual( |
| 2657 Word32And(LoadMapBitField(map), Int32Constant(1 << Map::kIsCallable)), |
| 2658 Int32Constant(0)); |
| 2659 } |
| 2660 |
| 2661 Node* CodeStubAssembler::IsSpecialReceiverInstanceType(Node* instance_type) { |
| 2662 STATIC_ASSERT(JS_GLOBAL_OBJECT_TYPE <= LAST_SPECIAL_RECEIVER_TYPE); |
| 2663 return Int32LessThanOrEqual(instance_type, |
| 2664 Int32Constant(LAST_SPECIAL_RECEIVER_TYPE)); |
| 2665 } |
| 2666 |
| 2638 Node* CodeStubAssembler::IsStringInstanceType(Node* instance_type) { | 2667 Node* CodeStubAssembler::IsStringInstanceType(Node* instance_type) { |
| 2639 STATIC_ASSERT(INTERNALIZED_STRING_TYPE == FIRST_TYPE); | 2668 STATIC_ASSERT(INTERNALIZED_STRING_TYPE == FIRST_TYPE); |
| 2640 return Int32LessThan(instance_type, Int32Constant(FIRST_NONSTRING_TYPE)); | 2669 return Int32LessThan(instance_type, Int32Constant(FIRST_NONSTRING_TYPE)); |
| 2641 } | 2670 } |
| 2642 | 2671 |
| 2643 Node* CodeStubAssembler::IsJSReceiverInstanceType(Node* instance_type) { | 2672 Node* CodeStubAssembler::IsJSReceiverInstanceType(Node* instance_type) { |
| 2644 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); | 2673 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
| 2645 return Int32GreaterThanOrEqual(instance_type, | 2674 return Int32GreaterThanOrEqual(instance_type, |
| 2646 Int32Constant(FIRST_JS_RECEIVER_TYPE)); | 2675 Int32Constant(FIRST_JS_RECEIVER_TYPE)); |
| 2647 } | 2676 } |
| 2648 | 2677 |
| 2649 Node* CodeStubAssembler::IsCallableMap(Node* map) { | 2678 Node* CodeStubAssembler::IsJSReceiver(Node* object) { |
| 2650 return Word32NotEqual( | 2679 STATIC_ASSERT(LAST_JS_OBJECT_TYPE == LAST_TYPE); |
| 2651 Word32And(LoadMapBitField(map), Int32Constant(1 << Map::kIsCallable)), | 2680 return IsJSReceiverInstanceType(LoadInstanceType(object)); |
| 2652 Int32Constant(0)); | 2681 } |
| 2682 |
| 2683 Node* CodeStubAssembler::IsJSObject(Node* object) { |
| 2684 STATIC_ASSERT(LAST_JS_OBJECT_TYPE == LAST_TYPE); |
| 2685 return Int32GreaterThanOrEqual(LoadInstanceType(object), |
| 2686 Int32Constant(FIRST_JS_RECEIVER_TYPE)); |
| 2687 } |
| 2688 |
| 2689 Node* CodeStubAssembler::IsMap(Node* map) { |
| 2690 return HasInstanceType(map, MAP_TYPE); |
| 2691 } |
| 2692 |
| 2693 Node* CodeStubAssembler::IsJSValue(Node* map) { |
| 2694 return HasInstanceType(map, JS_VALUE_TYPE); |
| 2695 } |
| 2696 |
| 2697 Node* CodeStubAssembler::IsJSArray(Node* object) { |
| 2698 return HasInstanceType(object, JS_ARRAY_TYPE); |
| 2699 } |
| 2700 |
| 2701 Node* CodeStubAssembler::IsWeakCell(Node* object) { |
| 2702 return HasInstanceType(object, WEAK_CELL_TYPE); |
| 2703 } |
| 2704 |
| 2705 Node* CodeStubAssembler::IsName(Node* object) { |
| 2706 return Int32LessThanOrEqual(LoadInstanceType(object), |
| 2707 Int32Constant(LAST_NAME_TYPE)); |
| 2708 } |
| 2709 |
| 2710 Node* CodeStubAssembler::IsString(Node* object) { |
| 2711 return Int32LessThanOrEqual(LoadInstanceType(object), |
| 2712 Int32Constant(FIRST_NONSTRING_TYPE)); |
| 2713 } |
| 2714 |
| 2715 Node* CodeStubAssembler::IsNativeContext(Node* object) { |
| 2716 return WordEqual(LoadMap(object), LoadRoot(Heap::kNativeContextMapRootIndex)); |
| 2717 } |
| 2718 |
| 2719 Node* CodeStubAssembler::IsFixedDoubleArray(Node* object) { |
| 2720 return WordEqual(LoadMap(object), FixedDoubleArrayMapConstant()); |
| 2721 } |
| 2722 |
| 2723 Node* CodeStubAssembler::IsHashTable(Node* object) { |
| 2724 return WordEqual(LoadMap(object), LoadRoot(Heap::kHashTableMapRootIndex)); |
| 2725 } |
| 2726 |
| 2727 Node* CodeStubAssembler::IsDictionary(Node* object) { |
| 2728 return WordOr(IsHashTable(object), IsUnseededNumberDictionary(object)); |
| 2729 } |
| 2730 |
| 2731 Node* CodeStubAssembler::IsUnseededNumberDictionary(Node* object) { |
| 2732 return WordEqual(LoadMap(object), |
| 2733 LoadRoot(Heap::kUnseededNumberDictionaryMapRootIndex)); |
| 2653 } | 2734 } |
| 2654 | 2735 |
| 2655 Node* CodeStubAssembler::StringCharCodeAt(Node* string, Node* index) { | 2736 Node* CodeStubAssembler::StringCharCodeAt(Node* string, Node* index) { |
| 2737 CSA_ASSERT(IsString(string)); |
| 2656 // Translate the {index} into a Word. | 2738 // Translate the {index} into a Word. |
| 2657 index = SmiToWord(index); | 2739 index = SmiToWord(index); |
| 2658 | 2740 |
| 2659 // We may need to loop in case of cons or sliced strings. | 2741 // We may need to loop in case of cons or sliced strings. |
| 2660 Variable var_index(this, MachineType::PointerRepresentation()); | 2742 Variable var_index(this, MachineType::PointerRepresentation()); |
| 2661 Variable var_result(this, MachineRepresentation::kWord32); | 2743 Variable var_result(this, MachineRepresentation::kWord32); |
| 2662 Variable var_string(this, MachineRepresentation::kTagged); | 2744 Variable var_string(this, MachineRepresentation::kTagged); |
| 2663 Variable* loop_vars[] = {&var_index, &var_string}; | 2745 Variable* loop_vars[] = {&var_index, &var_string}; |
| 2664 Label done_loop(this, &var_result), loop(this, 2, loop_vars); | 2746 Label done_loop(this, &var_result), loop(this, 2, loop_vars); |
| 2665 var_string.Bind(string); | 2747 var_string.Bind(string); |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3257 IncrementCounter(counters->string_add_native(), 1); | 3339 IncrementCounter(counters->string_add_native(), 1); |
| 3258 Goto(&done); | 3340 Goto(&done); |
| 3259 } | 3341 } |
| 3260 | 3342 |
| 3261 Bind(&done); | 3343 Bind(&done); |
| 3262 return result.value(); | 3344 return result.value(); |
| 3263 } | 3345 } |
| 3264 | 3346 |
| 3265 Node* CodeStubAssembler::StringIndexOfChar(Node* context, Node* string, | 3347 Node* CodeStubAssembler::StringIndexOfChar(Node* context, Node* string, |
| 3266 Node* needle_char, Node* from) { | 3348 Node* needle_char, Node* from) { |
| 3349 CSA_ASSERT(IsString(string)); |
| 3267 Variable var_result(this, MachineRepresentation::kTagged); | 3350 Variable var_result(this, MachineRepresentation::kTagged); |
| 3268 | 3351 |
| 3269 Label out(this), runtime(this, Label::kDeferred); | 3352 Label out(this), runtime(this, Label::kDeferred); |
| 3270 | 3353 |
| 3271 // Let runtime handle non-one-byte {needle_char}. | 3354 // Let runtime handle non-one-byte {needle_char}. |
| 3272 | 3355 |
| 3273 Node* const one_byte_char_mask = IntPtrConstant(0xFF); | 3356 Node* const one_byte_char_mask = IntPtrConstant(0xFF); |
| 3274 GotoUnless(WordEqual(WordAnd(needle_char, one_byte_char_mask), needle_char), | 3357 GotoUnless(WordEqual(WordAnd(needle_char, one_byte_char_mask), needle_char), |
| 3275 &runtime); | 3358 &runtime); |
| 3276 | 3359 |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3686 { | 3769 { |
| 3687 result.Bind(CallRuntime(Runtime::kToString, context, input)); | 3770 result.Bind(CallRuntime(Runtime::kToString, context, input)); |
| 3688 Goto(&done); | 3771 Goto(&done); |
| 3689 } | 3772 } |
| 3690 | 3773 |
| 3691 Bind(&done); | 3774 Bind(&done); |
| 3692 return result.value(); | 3775 return result.value(); |
| 3693 } | 3776 } |
| 3694 | 3777 |
| 3695 Node* CodeStubAssembler::FlattenString(Node* string) { | 3778 Node* CodeStubAssembler::FlattenString(Node* string) { |
| 3779 CSA_ASSERT(IsString(string)); |
| 3696 Variable var_result(this, MachineRepresentation::kTagged); | 3780 Variable var_result(this, MachineRepresentation::kTagged); |
| 3697 var_result.Bind(string); | 3781 var_result.Bind(string); |
| 3698 | 3782 |
| 3699 Node* instance_type = LoadInstanceType(string); | 3783 Node* instance_type = LoadInstanceType(string); |
| 3700 | 3784 |
| 3701 // Check if the {string} is not a ConsString (i.e. already flat). | 3785 // Check if the {string} is not a ConsString (i.e. already flat). |
| 3702 Label is_cons(this, Label::kDeferred), is_flat_in_cons(this), end(this); | 3786 Label is_cons(this, Label::kDeferred), is_flat_in_cons(this), end(this); |
| 3703 { | 3787 { |
| 3704 GotoUnless(Word32Equal(Word32And(instance_type, | 3788 GotoUnless(Word32Equal(Word32And(instance_type, |
| 3705 Int32Constant(kStringRepresentationMask)), | 3789 Int32Constant(kStringRepresentationMask)), |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3724 { | 3808 { |
| 3725 var_result.Bind(LoadObjectField(string, ConsString::kFirstOffset)); | 3809 var_result.Bind(LoadObjectField(string, ConsString::kFirstOffset)); |
| 3726 Goto(&end); | 3810 Goto(&end); |
| 3727 } | 3811 } |
| 3728 | 3812 |
| 3729 Bind(&end); | 3813 Bind(&end); |
| 3730 return var_result.value(); | 3814 return var_result.value(); |
| 3731 } | 3815 } |
| 3732 | 3816 |
| 3733 Node* CodeStubAssembler::JSReceiverToPrimitive(Node* context, Node* input) { | 3817 Node* CodeStubAssembler::JSReceiverToPrimitive(Node* context, Node* input) { |
| 3734 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); | |
| 3735 Label if_isreceiver(this, Label::kDeferred), if_isnotreceiver(this); | 3818 Label if_isreceiver(this, Label::kDeferred), if_isnotreceiver(this); |
| 3736 Variable result(this, MachineRepresentation::kTagged); | 3819 Variable result(this, MachineRepresentation::kTagged); |
| 3737 Label done(this, &result); | 3820 Label done(this, &result); |
| 3738 | 3821 |
| 3739 GotoIf(TaggedIsSmi(input), &if_isnotreceiver); | 3822 BranchIfJSReceiver(input, &if_isreceiver, &if_isnotreceiver); |
| 3740 | |
| 3741 Node* map = LoadMap(input); | |
| 3742 Node* instance_type = LoadMapInstanceType(map); | |
| 3743 Branch(IsJSReceiverInstanceType(instance_type), &if_isreceiver, | |
| 3744 &if_isnotreceiver); | |
| 3745 | 3823 |
| 3746 Bind(&if_isreceiver); | 3824 Bind(&if_isreceiver); |
| 3747 { | 3825 { |
| 3748 // Convert {input} to a primitive first passing Number hint. | 3826 // Convert {input} to a primitive first passing Number hint. |
| 3749 Callable callable = CodeFactory::NonPrimitiveToPrimitive(isolate()); | 3827 Callable callable = CodeFactory::NonPrimitiveToPrimitive(isolate()); |
| 3750 result.Bind(CallStub(callable, context, input)); | 3828 result.Bind(CallStub(callable, context, input)); |
| 3751 Goto(&done); | 3829 Goto(&done); |
| 3752 } | 3830 } |
| 3753 | 3831 |
| 3754 Bind(&if_isnotreceiver); | 3832 Bind(&if_isnotreceiver); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3924 Node* CodeStubAssembler::IntPtrMax(Node* left, Node* right) { | 4002 Node* CodeStubAssembler::IntPtrMax(Node* left, Node* right) { |
| 3925 return Select(IntPtrGreaterThanOrEqual(left, right), left, right); | 4003 return Select(IntPtrGreaterThanOrEqual(left, right), left, right); |
| 3926 } | 4004 } |
| 3927 | 4005 |
| 3928 template <typename Dictionary> | 4006 template <typename Dictionary> |
| 3929 void CodeStubAssembler::NameDictionaryLookup(Node* dictionary, | 4007 void CodeStubAssembler::NameDictionaryLookup(Node* dictionary, |
| 3930 Node* unique_name, Label* if_found, | 4008 Node* unique_name, Label* if_found, |
| 3931 Variable* var_name_index, | 4009 Variable* var_name_index, |
| 3932 Label* if_not_found, | 4010 Label* if_not_found, |
| 3933 int inlined_probes) { | 4011 int inlined_probes) { |
| 4012 CSA_ASSERT(IsDictionary(dictionary)); |
| 3934 DCHECK_EQ(MachineType::PointerRepresentation(), var_name_index->rep()); | 4013 DCHECK_EQ(MachineType::PointerRepresentation(), var_name_index->rep()); |
| 3935 Comment("NameDictionaryLookup"); | 4014 Comment("NameDictionaryLookup"); |
| 3936 | 4015 |
| 3937 Node* capacity = SmiUntag(LoadFixedArrayElement( | 4016 Node* capacity = SmiUntag(LoadFixedArrayElement( |
| 3938 dictionary, IntPtrConstant(Dictionary::kCapacityIndex), 0, | 4017 dictionary, IntPtrConstant(Dictionary::kCapacityIndex), 0, |
| 3939 INTPTR_PARAMETERS)); | 4018 INTPTR_PARAMETERS)); |
| 3940 Node* mask = IntPtrSub(capacity, IntPtrConstant(1)); | 4019 Node* mask = IntPtrSub(capacity, IntPtrConstant(1)); |
| 3941 Node* hash = ChangeUint32ToWord(LoadNameHash(unique_name)); | 4020 Node* hash = ChangeUint32ToWord(LoadNameHash(unique_name)); |
| 3942 | 4021 |
| 3943 // See Dictionary::FirstProbe(). | 4022 // See Dictionary::FirstProbe(). |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4008 hash = Word32Xor(hash, Word32Shr(hash, Int32Constant(16))); | 4087 hash = Word32Xor(hash, Word32Shr(hash, Int32Constant(16))); |
| 4009 return Word32And(hash, Int32Constant(0x3fffffff)); | 4088 return Word32And(hash, Int32Constant(0x3fffffff)); |
| 4010 } | 4089 } |
| 4011 | 4090 |
| 4012 template <typename Dictionary> | 4091 template <typename Dictionary> |
| 4013 void CodeStubAssembler::NumberDictionaryLookup(Node* dictionary, | 4092 void CodeStubAssembler::NumberDictionaryLookup(Node* dictionary, |
| 4014 Node* intptr_index, | 4093 Node* intptr_index, |
| 4015 Label* if_found, | 4094 Label* if_found, |
| 4016 Variable* var_entry, | 4095 Variable* var_entry, |
| 4017 Label* if_not_found) { | 4096 Label* if_not_found) { |
| 4097 CSA_ASSERT(IsDictionary(dictionary)); |
| 4018 DCHECK_EQ(MachineType::PointerRepresentation(), var_entry->rep()); | 4098 DCHECK_EQ(MachineType::PointerRepresentation(), var_entry->rep()); |
| 4019 Comment("NumberDictionaryLookup"); | 4099 Comment("NumberDictionaryLookup"); |
| 4020 | 4100 |
| 4021 Node* capacity = SmiUntag(LoadFixedArrayElement( | 4101 Node* capacity = SmiUntag(LoadFixedArrayElement( |
| 4022 dictionary, IntPtrConstant(Dictionary::kCapacityIndex), 0, | 4102 dictionary, IntPtrConstant(Dictionary::kCapacityIndex), 0, |
| 4023 INTPTR_PARAMETERS)); | 4103 INTPTR_PARAMETERS)); |
| 4024 Node* mask = IntPtrSub(capacity, IntPtrConstant(1)); | 4104 Node* mask = IntPtrSub(capacity, IntPtrConstant(1)); |
| 4025 | 4105 |
| 4026 Node* int32_seed; | 4106 Node* int32_seed; |
| 4027 if (Dictionary::ShapeT::UsesSeed) { | 4107 if (Dictionary::ShapeT::UsesSeed) { |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4310 Bind(&done); | 4390 Bind(&done); |
| 4311 | 4391 |
| 4312 Comment("] LoadPropertyFromFastObject"); | 4392 Comment("] LoadPropertyFromFastObject"); |
| 4313 } | 4393 } |
| 4314 | 4394 |
| 4315 void CodeStubAssembler::LoadPropertyFromNameDictionary(Node* dictionary, | 4395 void CodeStubAssembler::LoadPropertyFromNameDictionary(Node* dictionary, |
| 4316 Node* name_index, | 4396 Node* name_index, |
| 4317 Variable* var_details, | 4397 Variable* var_details, |
| 4318 Variable* var_value) { | 4398 Variable* var_value) { |
| 4319 Comment("LoadPropertyFromNameDictionary"); | 4399 Comment("LoadPropertyFromNameDictionary"); |
| 4320 | 4400 CSA_ASSERT(IsDictionary(dictionary)); |
| 4321 const int name_to_details_offset = | 4401 const int name_to_details_offset = |
| 4322 (NameDictionary::kEntryDetailsIndex - NameDictionary::kEntryKeyIndex) * | 4402 (NameDictionary::kEntryDetailsIndex - NameDictionary::kEntryKeyIndex) * |
| 4323 kPointerSize; | 4403 kPointerSize; |
| 4324 const int name_to_value_offset = | 4404 const int name_to_value_offset = |
| 4325 (NameDictionary::kEntryValueIndex - NameDictionary::kEntryKeyIndex) * | 4405 (NameDictionary::kEntryValueIndex - NameDictionary::kEntryKeyIndex) * |
| 4326 kPointerSize; | 4406 kPointerSize; |
| 4327 | 4407 |
| 4328 Node* details = LoadAndUntagToWord32FixedArrayElement(dictionary, name_index, | 4408 Node* details = LoadAndUntagToWord32FixedArrayElement(dictionary, name_index, |
| 4329 name_to_details_offset); | 4409 name_to_details_offset); |
| 4330 | 4410 |
| 4331 var_details->Bind(details); | 4411 var_details->Bind(details); |
| 4332 var_value->Bind( | 4412 var_value->Bind( |
| 4333 LoadFixedArrayElement(dictionary, name_index, name_to_value_offset)); | 4413 LoadFixedArrayElement(dictionary, name_index, name_to_value_offset)); |
| 4334 | 4414 |
| 4335 Comment("] LoadPropertyFromNameDictionary"); | 4415 Comment("] LoadPropertyFromNameDictionary"); |
| 4336 } | 4416 } |
| 4337 | 4417 |
| 4338 void CodeStubAssembler::LoadPropertyFromGlobalDictionary(Node* dictionary, | 4418 void CodeStubAssembler::LoadPropertyFromGlobalDictionary(Node* dictionary, |
| 4339 Node* name_index, | 4419 Node* name_index, |
| 4340 Variable* var_details, | 4420 Variable* var_details, |
| 4341 Variable* var_value, | 4421 Variable* var_value, |
| 4342 Label* if_deleted) { | 4422 Label* if_deleted) { |
| 4343 Comment("[ LoadPropertyFromGlobalDictionary"); | 4423 Comment("[ LoadPropertyFromGlobalDictionary"); |
| 4424 CSA_ASSERT(IsDictionary(dictionary)); |
| 4344 | 4425 |
| 4345 const int name_to_value_offset = | 4426 const int name_to_value_offset = |
| 4346 (GlobalDictionary::kEntryValueIndex - GlobalDictionary::kEntryKeyIndex) * | 4427 (GlobalDictionary::kEntryValueIndex - GlobalDictionary::kEntryKeyIndex) * |
| 4347 kPointerSize; | 4428 kPointerSize; |
| 4348 | 4429 |
| 4349 Node* property_cell = | 4430 Node* property_cell = |
| 4350 LoadFixedArrayElement(dictionary, name_index, name_to_value_offset); | 4431 LoadFixedArrayElement(dictionary, name_index, name_to_value_offset); |
| 4351 | 4432 |
| 4352 Node* value = LoadObjectField(property_cell, PropertyCell::kValueOffset); | 4433 Node* value = LoadObjectField(property_cell, PropertyCell::kValueOffset); |
| 4353 GotoIf(WordEqual(value, TheHoleConstant()), if_deleted); | 4434 GotoIf(WordEqual(value, TheHoleConstant()), if_deleted); |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4888 var_receiver_map.Bind(LoadMap(receiver)); | 4969 var_receiver_map.Bind(LoadMap(receiver)); |
| 4889 Goto(&if_result); | 4970 Goto(&if_result); |
| 4890 } | 4971 } |
| 4891 Bind(&if_result); | 4972 Bind(&if_result); |
| 4892 return var_receiver_map.value(); | 4973 return var_receiver_map.value(); |
| 4893 } | 4974 } |
| 4894 | 4975 |
| 4895 compiler::Node* CodeStubAssembler::TryMonomorphicCase( | 4976 compiler::Node* CodeStubAssembler::TryMonomorphicCase( |
| 4896 compiler::Node* slot, compiler::Node* vector, compiler::Node* receiver_map, | 4977 compiler::Node* slot, compiler::Node* vector, compiler::Node* receiver_map, |
| 4897 Label* if_handler, Variable* var_handler, Label* if_miss) { | 4978 Label* if_handler, Variable* var_handler, Label* if_miss) { |
| 4979 Comment("TryMonomorphicCase"); |
| 4898 DCHECK_EQ(MachineRepresentation::kTagged, var_handler->rep()); | 4980 DCHECK_EQ(MachineRepresentation::kTagged, var_handler->rep()); |
| 4899 | 4981 |
| 4900 // TODO(ishell): add helper class that hides offset computations for a series | 4982 // TODO(ishell): add helper class that hides offset computations for a series |
| 4901 // of loads. | 4983 // of loads. |
| 4902 int32_t header_size = FixedArray::kHeaderSize - kHeapObjectTag; | 4984 int32_t header_size = FixedArray::kHeaderSize - kHeapObjectTag; |
| 4903 // Adding |header_size| with a separate IntPtrAdd rather than passing it | 4985 // Adding |header_size| with a separate IntPtrAdd rather than passing it |
| 4904 // into ElementOffsetFromIndex() allows it to be folded into a single | 4986 // into ElementOffsetFromIndex() allows it to be folded into a single |
| 4905 // [base, index, offset] indirect memory access on x64. | 4987 // [base, index, offset] indirect memory access on x64. |
| 4906 Node* offset = | 4988 Node* offset = |
| 4907 ElementOffsetFromIndex(slot, FAST_HOLEY_ELEMENTS, SMI_PARAMETERS); | 4989 ElementOffsetFromIndex(slot, FAST_HOLEY_ELEMENTS, SMI_PARAMETERS); |
| 4908 Node* feedback = Load(MachineType::AnyTagged(), vector, | 4990 Node* feedback = Load(MachineType::AnyTagged(), vector, |
| 4909 IntPtrAdd(offset, IntPtrConstant(header_size))); | 4991 IntPtrAdd(offset, IntPtrConstant(header_size))); |
| 4910 | 4992 |
| 4911 // Try to quickly handle the monomorphic case without knowing for sure | 4993 // Try to quickly handle the monomorphic case without knowing for sure |
| 4912 // if we have a weak cell in feedback. We do know it's safe to look | 4994 // if we have a weak cell in feedback. We do know it's safe to look |
| 4913 // at WeakCell::kValueOffset. | 4995 // at WeakCell::kValueOffset. |
| 4914 GotoIf(WordNotEqual(receiver_map, LoadWeakCellValue(feedback)), if_miss); | 4996 GotoIf(WordNotEqual(receiver_map, LoadWeakCellValueUnchecked(feedback)), |
| 4997 if_miss); |
| 4915 | 4998 |
| 4916 Node* handler = | 4999 Node* handler = |
| 4917 Load(MachineType::AnyTagged(), vector, | 5000 Load(MachineType::AnyTagged(), vector, |
| 4918 IntPtrAdd(offset, IntPtrConstant(header_size + kPointerSize))); | 5001 IntPtrAdd(offset, IntPtrConstant(header_size + kPointerSize))); |
| 4919 | 5002 |
| 4920 var_handler->Bind(handler); | 5003 var_handler->Bind(handler); |
| 4921 Goto(if_handler); | 5004 Goto(if_handler); |
| 4922 return feedback; | 5005 return feedback; |
| 4923 } | 5006 } |
| 4924 | 5007 |
| 4925 void CodeStubAssembler::HandlePolymorphicCase( | 5008 void CodeStubAssembler::HandlePolymorphicCase( |
| 4926 compiler::Node* receiver_map, compiler::Node* feedback, Label* if_handler, | 5009 compiler::Node* receiver_map, compiler::Node* feedback, Label* if_handler, |
| 4927 Variable* var_handler, Label* if_miss, int unroll_count) { | 5010 Variable* var_handler, Label* if_miss, int unroll_count) { |
| 5011 Comment("HandlePolymorphicCase"); |
| 4928 DCHECK_EQ(MachineRepresentation::kTagged, var_handler->rep()); | 5012 DCHECK_EQ(MachineRepresentation::kTagged, var_handler->rep()); |
| 4929 | 5013 |
| 4930 // Iterate {feedback} array. | 5014 // Iterate {feedback} array. |
| 4931 const int kEntrySize = 2; | 5015 const int kEntrySize = 2; |
| 4932 | 5016 |
| 4933 for (int i = 0; i < unroll_count; i++) { | 5017 for (int i = 0; i < unroll_count; i++) { |
| 4934 Label next_entry(this); | 5018 Label next_entry(this); |
| 4935 Node* cached_map = LoadWeakCellValue(LoadFixedArrayElement( | 5019 Node* cached_map = LoadWeakCellValue(LoadFixedArrayElement( |
| 4936 feedback, IntPtrConstant(i * kEntrySize), 0, INTPTR_PARAMETERS)); | 5020 feedback, IntPtrConstant(i * kEntrySize), 0, INTPTR_PARAMETERS)); |
| 4937 GotoIf(WordNotEqual(receiver_map, cached_map), &next_entry); | 5021 GotoIf(WordNotEqual(receiver_map, cached_map), &next_entry); |
| (...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6647 } | 6731 } |
| 6648 Bind(&no_memento_found); | 6732 Bind(&no_memento_found); |
| 6649 Comment("] TrapAllocationMemento"); | 6733 Comment("] TrapAllocationMemento"); |
| 6650 } | 6734 } |
| 6651 | 6735 |
| 6652 Node* CodeStubAssembler::PageFromAddress(Node* address) { | 6736 Node* CodeStubAssembler::PageFromAddress(Node* address) { |
| 6653 return WordAnd(address, IntPtrConstant(~Page::kPageAlignmentMask)); | 6737 return WordAnd(address, IntPtrConstant(~Page::kPageAlignmentMask)); |
| 6654 } | 6738 } |
| 6655 | 6739 |
| 6656 Node* CodeStubAssembler::EnumLength(Node* map) { | 6740 Node* CodeStubAssembler::EnumLength(Node* map) { |
| 6741 CSA_ASSERT(IsMap(map)); |
| 6657 Node* bitfield_3 = LoadMapBitField3(map); | 6742 Node* bitfield_3 = LoadMapBitField3(map); |
| 6658 Node* enum_length = DecodeWordFromWord32<Map::EnumLengthBits>(bitfield_3); | 6743 Node* enum_length = DecodeWordFromWord32<Map::EnumLengthBits>(bitfield_3); |
| 6659 return SmiTag(enum_length); | 6744 return SmiTag(enum_length); |
| 6660 } | 6745 } |
| 6661 | 6746 |
| 6662 void CodeStubAssembler::CheckEnumCache(Node* receiver, Label* use_cache, | 6747 void CodeStubAssembler::CheckEnumCache(Node* receiver, Label* use_cache, |
| 6663 Label* use_runtime) { | 6748 Label* use_runtime) { |
| 6664 Variable current_js_object(this, MachineRepresentation::kTagged); | 6749 Variable current_js_object(this, MachineRepresentation::kTagged); |
| 6665 current_js_object.Bind(receiver); | 6750 current_js_object.Bind(receiver); |
| 6666 | 6751 |
| (...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8545 Node* buffer_bit_field = LoadObjectField( | 8630 Node* buffer_bit_field = LoadObjectField( |
| 8546 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); | 8631 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); |
| 8547 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); | 8632 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); |
| 8548 | 8633 |
| 8549 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), | 8634 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), |
| 8550 Int32Constant(0)); | 8635 Int32Constant(0)); |
| 8551 } | 8636 } |
| 8552 | 8637 |
| 8553 } // namespace internal | 8638 } // namespace internal |
| 8554 } // namespace v8 | 8639 } // namespace v8 |
| OLD | NEW |