| 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 void CodeStubAssembler::Assert(Node* condition, const char* message, | 28 void CodeStubAssembler::Assert(ConditionBody codition_body, const char* message, |
| 29 const char* file, int line) { | 29 const char* file, int line) { |
| 30 #if defined(DEBUG) | 30 #if defined(DEBUG) |
| 31 Label ok(this); | 31 Label ok(this); |
| 32 Label not_ok(this, Label::kDeferred); | 32 Label not_ok(this, Label::kDeferred); |
| 33 if (message != nullptr && FLAG_code_comments) { | 33 if (message != nullptr && FLAG_code_comments) { |
| 34 Comment("[ Assert: %s", message); | 34 Comment("[ Assert: %s", message); |
| 35 } else { | 35 } else { |
| 36 Comment("[ Assert "); | 36 Comment("[ Assert"); |
| 37 } | 37 } |
| 38 | 38 Node* condition = codition_body(); |
| 39 DCHECK_NOT_NULL(condition); |
| 39 Branch(condition, &ok, ¬_ok); | 40 Branch(condition, &ok, ¬_ok); |
| 40 Bind(¬_ok); | 41 Bind(¬_ok); |
| 41 if (message != nullptr) { | 42 if (message != nullptr) { |
| 42 char chars[1024]; | 43 char chars[1024]; |
| 43 Vector<char> buffer(chars); | 44 Vector<char> buffer(chars); |
| 44 if (file != nullptr) { | 45 if (file != nullptr) { |
| 45 SNPrintF(buffer, "CSA_ASSERT failed: %s [%s:%d]\n", message, file, line); | 46 SNPrintF(buffer, "CSA_ASSERT failed: %s [%s:%d]\n", message, file, line); |
| 46 } else { | 47 } else { |
| 47 SNPrintF(buffer, "CSA_ASSERT failed: %s\n", message); | 48 SNPrintF(buffer, "CSA_ASSERT failed: %s\n", message); |
| 48 } | 49 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } else if (is_right_constant) { | 123 } else if (is_right_constant) { |
| 123 if (right_constant == 0) { | 124 if (right_constant == 0) { |
| 124 return left; | 125 return left; |
| 125 } | 126 } |
| 126 } | 127 } |
| 127 return IntPtrSub(left, right); | 128 return IntPtrSub(left, right); |
| 128 } | 129 } |
| 129 | 130 |
| 130 Node* CodeStubAssembler::IntPtrRoundUpToPowerOfTwo32(Node* value) { | 131 Node* CodeStubAssembler::IntPtrRoundUpToPowerOfTwo32(Node* value) { |
| 131 Comment("IntPtrRoundUpToPowerOfTwo32"); | 132 Comment("IntPtrRoundUpToPowerOfTwo32"); |
| 132 CSA_ASSERT(UintPtrLessThanOrEqual(value, IntPtrConstant(0x80000000u))); | 133 CSA_ASSERT(this, UintPtrLessThanOrEqual(value, IntPtrConstant(0x80000000u))); |
| 133 value = IntPtrSub(value, IntPtrConstant(1)); | 134 value = IntPtrSub(value, IntPtrConstant(1)); |
| 134 for (int i = 1; i <= 16; i *= 2) { | 135 for (int i = 1; i <= 16; i *= 2) { |
| 135 value = WordOr(value, WordShr(value, IntPtrConstant(i))); | 136 value = WordOr(value, WordShr(value, IntPtrConstant(i))); |
| 136 } | 137 } |
| 137 return IntPtrAdd(value, IntPtrConstant(1)); | 138 return IntPtrAdd(value, IntPtrConstant(1)); |
| 138 } | 139 } |
| 139 | 140 |
| 140 Node* CodeStubAssembler::WordIsPowerOfTwo(Node* value) { | 141 Node* CodeStubAssembler::WordIsPowerOfTwo(Node* value) { |
| 141 // value && !(value & (value - 1)) | 142 // value && !(value & (value - 1)) |
| 142 return WordEqual( | 143 return WordEqual( |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 | 1003 |
| 1003 Node* CodeStubAssembler::LoadProperties(Node* object) { | 1004 Node* CodeStubAssembler::LoadProperties(Node* object) { |
| 1004 return LoadObjectField(object, JSObject::kPropertiesOffset); | 1005 return LoadObjectField(object, JSObject::kPropertiesOffset); |
| 1005 } | 1006 } |
| 1006 | 1007 |
| 1007 Node* CodeStubAssembler::LoadElements(Node* object) { | 1008 Node* CodeStubAssembler::LoadElements(Node* object) { |
| 1008 return LoadObjectField(object, JSObject::kElementsOffset); | 1009 return LoadObjectField(object, JSObject::kElementsOffset); |
| 1009 } | 1010 } |
| 1010 | 1011 |
| 1011 Node* CodeStubAssembler::LoadJSArrayLength(Node* array) { | 1012 Node* CodeStubAssembler::LoadJSArrayLength(Node* array) { |
| 1012 CSA_ASSERT(IsJSArray(array)); | 1013 CSA_ASSERT(this, IsJSArray(array)); |
| 1013 return LoadObjectField(array, JSArray::kLengthOffset); | 1014 return LoadObjectField(array, JSArray::kLengthOffset); |
| 1014 } | 1015 } |
| 1015 | 1016 |
| 1016 Node* CodeStubAssembler::LoadFixedArrayBaseLength(Node* array) { | 1017 Node* CodeStubAssembler::LoadFixedArrayBaseLength(Node* array) { |
| 1017 return LoadObjectField(array, FixedArrayBase::kLengthOffset); | 1018 return LoadObjectField(array, FixedArrayBase::kLengthOffset); |
| 1018 } | 1019 } |
| 1019 | 1020 |
| 1020 Node* CodeStubAssembler::LoadAndUntagFixedArrayBaseLength(Node* array) { | 1021 Node* CodeStubAssembler::LoadAndUntagFixedArrayBaseLength(Node* array) { |
| 1021 return LoadAndUntagObjectField(array, FixedArrayBase::kLengthOffset); | 1022 return LoadAndUntagObjectField(array, FixedArrayBase::kLengthOffset); |
| 1022 } | 1023 } |
| 1023 | 1024 |
| 1024 Node* CodeStubAssembler::LoadMapBitField(Node* map) { | 1025 Node* CodeStubAssembler::LoadMapBitField(Node* map) { |
| 1025 CSA_SLOW_ASSERT(IsMap(map)); | 1026 CSA_SLOW_ASSERT(this, IsMap(map)); |
| 1026 return LoadObjectField(map, Map::kBitFieldOffset, MachineType::Uint8()); | 1027 return LoadObjectField(map, Map::kBitFieldOffset, MachineType::Uint8()); |
| 1027 } | 1028 } |
| 1028 | 1029 |
| 1029 Node* CodeStubAssembler::LoadMapBitField2(Node* map) { | 1030 Node* CodeStubAssembler::LoadMapBitField2(Node* map) { |
| 1030 CSA_SLOW_ASSERT(IsMap(map)); | 1031 CSA_SLOW_ASSERT(this, IsMap(map)); |
| 1031 return LoadObjectField(map, Map::kBitField2Offset, MachineType::Uint8()); | 1032 return LoadObjectField(map, Map::kBitField2Offset, MachineType::Uint8()); |
| 1032 } | 1033 } |
| 1033 | 1034 |
| 1034 Node* CodeStubAssembler::LoadMapBitField3(Node* map) { | 1035 Node* CodeStubAssembler::LoadMapBitField3(Node* map) { |
| 1035 CSA_SLOW_ASSERT(IsMap(map)); | 1036 CSA_SLOW_ASSERT(this, IsMap(map)); |
| 1036 return LoadObjectField(map, Map::kBitField3Offset, MachineType::Uint32()); | 1037 return LoadObjectField(map, Map::kBitField3Offset, MachineType::Uint32()); |
| 1037 } | 1038 } |
| 1038 | 1039 |
| 1039 Node* CodeStubAssembler::LoadMapInstanceType(Node* map) { | 1040 Node* CodeStubAssembler::LoadMapInstanceType(Node* map) { |
| 1040 return LoadObjectField(map, Map::kInstanceTypeOffset, MachineType::Uint8()); | 1041 return LoadObjectField(map, Map::kInstanceTypeOffset, MachineType::Uint8()); |
| 1041 } | 1042 } |
| 1042 | 1043 |
| 1043 Node* CodeStubAssembler::LoadMapElementsKind(Node* map) { | 1044 Node* CodeStubAssembler::LoadMapElementsKind(Node* map) { |
| 1044 CSA_SLOW_ASSERT(IsMap(map)); | 1045 CSA_SLOW_ASSERT(this, IsMap(map)); |
| 1045 Node* bit_field2 = LoadMapBitField2(map); | 1046 Node* bit_field2 = LoadMapBitField2(map); |
| 1046 return DecodeWord32<Map::ElementsKindBits>(bit_field2); | 1047 return DecodeWord32<Map::ElementsKindBits>(bit_field2); |
| 1047 } | 1048 } |
| 1048 | 1049 |
| 1049 Node* CodeStubAssembler::LoadMapDescriptors(Node* map) { | 1050 Node* CodeStubAssembler::LoadMapDescriptors(Node* map) { |
| 1050 CSA_SLOW_ASSERT(IsMap(map)); | 1051 CSA_SLOW_ASSERT(this, IsMap(map)); |
| 1051 return LoadObjectField(map, Map::kDescriptorsOffset); | 1052 return LoadObjectField(map, Map::kDescriptorsOffset); |
| 1052 } | 1053 } |
| 1053 | 1054 |
| 1054 Node* CodeStubAssembler::LoadMapPrototype(Node* map) { | 1055 Node* CodeStubAssembler::LoadMapPrototype(Node* map) { |
| 1055 CSA_SLOW_ASSERT(IsMap(map)); | 1056 CSA_SLOW_ASSERT(this, IsMap(map)); |
| 1056 return LoadObjectField(map, Map::kPrototypeOffset); | 1057 return LoadObjectField(map, Map::kPrototypeOffset); |
| 1057 } | 1058 } |
| 1058 | 1059 |
| 1059 Node* CodeStubAssembler::LoadMapPrototypeInfo(Node* map, | 1060 Node* CodeStubAssembler::LoadMapPrototypeInfo(Node* map, |
| 1060 Label* if_no_proto_info) { | 1061 Label* if_no_proto_info) { |
| 1061 CSA_ASSERT(IsMap(map)); | 1062 CSA_ASSERT(this, IsMap(map)); |
| 1062 Node* prototype_info = | 1063 Node* prototype_info = |
| 1063 LoadObjectField(map, Map::kTransitionsOrPrototypeInfoOffset); | 1064 LoadObjectField(map, Map::kTransitionsOrPrototypeInfoOffset); |
| 1064 GotoIf(TaggedIsSmi(prototype_info), if_no_proto_info); | 1065 GotoIf(TaggedIsSmi(prototype_info), if_no_proto_info); |
| 1065 GotoUnless(WordEqual(LoadMap(prototype_info), | 1066 GotoUnless(WordEqual(LoadMap(prototype_info), |
| 1066 LoadRoot(Heap::kPrototypeInfoMapRootIndex)), | 1067 LoadRoot(Heap::kPrototypeInfoMapRootIndex)), |
| 1067 if_no_proto_info); | 1068 if_no_proto_info); |
| 1068 return prototype_info; | 1069 return prototype_info; |
| 1069 } | 1070 } |
| 1070 | 1071 |
| 1071 Node* CodeStubAssembler::LoadMapInstanceSize(Node* map) { | 1072 Node* CodeStubAssembler::LoadMapInstanceSize(Node* map) { |
| 1072 CSA_SLOW_ASSERT(IsMap(map)); | 1073 CSA_SLOW_ASSERT(this, IsMap(map)); |
| 1073 return ChangeUint32ToWord( | 1074 return ChangeUint32ToWord( |
| 1074 LoadObjectField(map, Map::kInstanceSizeOffset, MachineType::Uint8())); | 1075 LoadObjectField(map, Map::kInstanceSizeOffset, MachineType::Uint8())); |
| 1075 } | 1076 } |
| 1076 | 1077 |
| 1077 Node* CodeStubAssembler::LoadMapInobjectProperties(Node* map) { | 1078 Node* CodeStubAssembler::LoadMapInobjectProperties(Node* map) { |
| 1078 CSA_SLOW_ASSERT(IsMap(map)); | 1079 CSA_SLOW_ASSERT(this, IsMap(map)); |
| 1079 // See Map::GetInObjectProperties() for details. | 1080 // See Map::GetInObjectProperties() for details. |
| 1080 STATIC_ASSERT(LAST_JS_OBJECT_TYPE == LAST_TYPE); | 1081 STATIC_ASSERT(LAST_JS_OBJECT_TYPE == LAST_TYPE); |
| 1081 CSA_ASSERT(Int32GreaterThanOrEqual(LoadMapInstanceType(map), | 1082 CSA_ASSERT(this, |
| 1083 Int32GreaterThanOrEqual(LoadMapInstanceType(map), |
| 1082 Int32Constant(FIRST_JS_OBJECT_TYPE))); | 1084 Int32Constant(FIRST_JS_OBJECT_TYPE))); |
| 1083 return ChangeUint32ToWord(LoadObjectField( | 1085 return ChangeUint32ToWord(LoadObjectField( |
| 1084 map, Map::kInObjectPropertiesOrConstructorFunctionIndexOffset, | 1086 map, Map::kInObjectPropertiesOrConstructorFunctionIndexOffset, |
| 1085 MachineType::Uint8())); | 1087 MachineType::Uint8())); |
| 1086 } | 1088 } |
| 1087 | 1089 |
| 1088 Node* CodeStubAssembler::LoadMapConstructorFunctionIndex(Node* map) { | 1090 Node* CodeStubAssembler::LoadMapConstructorFunctionIndex(Node* map) { |
| 1089 CSA_SLOW_ASSERT(IsMap(map)); | 1091 CSA_SLOW_ASSERT(this, IsMap(map)); |
| 1090 // See Map::GetConstructorFunctionIndex() for details. | 1092 // See Map::GetConstructorFunctionIndex() for details. |
| 1091 STATIC_ASSERT(FIRST_PRIMITIVE_TYPE == FIRST_TYPE); | 1093 STATIC_ASSERT(FIRST_PRIMITIVE_TYPE == FIRST_TYPE); |
| 1092 CSA_ASSERT(Int32LessThanOrEqual(LoadMapInstanceType(map), | 1094 CSA_ASSERT(this, Int32LessThanOrEqual(LoadMapInstanceType(map), |
| 1093 Int32Constant(LAST_PRIMITIVE_TYPE))); | 1095 Int32Constant(LAST_PRIMITIVE_TYPE))); |
| 1094 return ChangeUint32ToWord(LoadObjectField( | 1096 return ChangeUint32ToWord(LoadObjectField( |
| 1095 map, Map::kInObjectPropertiesOrConstructorFunctionIndexOffset, | 1097 map, Map::kInObjectPropertiesOrConstructorFunctionIndexOffset, |
| 1096 MachineType::Uint8())); | 1098 MachineType::Uint8())); |
| 1097 } | 1099 } |
| 1098 | 1100 |
| 1099 Node* CodeStubAssembler::LoadMapConstructor(Node* map) { | 1101 Node* CodeStubAssembler::LoadMapConstructor(Node* map) { |
| 1100 CSA_SLOW_ASSERT(IsMap(map)); | 1102 CSA_SLOW_ASSERT(this, IsMap(map)); |
| 1101 Variable result(this, MachineRepresentation::kTagged); | 1103 Variable result(this, MachineRepresentation::kTagged); |
| 1102 result.Bind(LoadObjectField(map, Map::kConstructorOrBackPointerOffset)); | 1104 result.Bind(LoadObjectField(map, Map::kConstructorOrBackPointerOffset)); |
| 1103 | 1105 |
| 1104 Label done(this), loop(this, &result); | 1106 Label done(this), loop(this, &result); |
| 1105 Goto(&loop); | 1107 Goto(&loop); |
| 1106 Bind(&loop); | 1108 Bind(&loop); |
| 1107 { | 1109 { |
| 1108 GotoIf(TaggedIsSmi(result.value()), &done); | 1110 GotoIf(TaggedIsSmi(result.value()), &done); |
| 1109 Node* is_map_type = | 1111 Node* is_map_type = |
| 1110 Word32Equal(LoadInstanceType(result.value()), Int32Constant(MAP_TYPE)); | 1112 Word32Equal(LoadInstanceType(result.value()), Int32Constant(MAP_TYPE)); |
| 1111 GotoUnless(is_map_type, &done); | 1113 GotoUnless(is_map_type, &done); |
| 1112 result.Bind( | 1114 result.Bind( |
| 1113 LoadObjectField(result.value(), Map::kConstructorOrBackPointerOffset)); | 1115 LoadObjectField(result.value(), Map::kConstructorOrBackPointerOffset)); |
| 1114 Goto(&loop); | 1116 Goto(&loop); |
| 1115 } | 1117 } |
| 1116 Bind(&done); | 1118 Bind(&done); |
| 1117 return result.value(); | 1119 return result.value(); |
| 1118 } | 1120 } |
| 1119 | 1121 |
| 1120 Node* CodeStubAssembler::LoadNameHashField(Node* name) { | 1122 Node* CodeStubAssembler::LoadNameHashField(Node* name) { |
| 1121 CSA_ASSERT(IsName(name)); | 1123 CSA_ASSERT(this, IsName(name)); |
| 1122 return LoadObjectField(name, Name::kHashFieldOffset, MachineType::Uint32()); | 1124 return LoadObjectField(name, Name::kHashFieldOffset, MachineType::Uint32()); |
| 1123 } | 1125 } |
| 1124 | 1126 |
| 1125 Node* CodeStubAssembler::LoadNameHash(Node* name, Label* if_hash_not_computed) { | 1127 Node* CodeStubAssembler::LoadNameHash(Node* name, Label* if_hash_not_computed) { |
| 1126 Node* hash_field = LoadNameHashField(name); | 1128 Node* hash_field = LoadNameHashField(name); |
| 1127 if (if_hash_not_computed != nullptr) { | 1129 if (if_hash_not_computed != nullptr) { |
| 1128 GotoIf(Word32Equal( | 1130 GotoIf(Word32Equal( |
| 1129 Word32And(hash_field, Int32Constant(Name::kHashNotComputedMask)), | 1131 Word32And(hash_field, Int32Constant(Name::kHashNotComputedMask)), |
| 1130 Int32Constant(0)), | 1132 Int32Constant(0)), |
| 1131 if_hash_not_computed); | 1133 if_hash_not_computed); |
| 1132 } | 1134 } |
| 1133 return Word32Shr(hash_field, Int32Constant(Name::kHashShift)); | 1135 return Word32Shr(hash_field, Int32Constant(Name::kHashShift)); |
| 1134 } | 1136 } |
| 1135 | 1137 |
| 1136 Node* CodeStubAssembler::LoadStringLength(Node* object) { | 1138 Node* CodeStubAssembler::LoadStringLength(Node* object) { |
| 1137 CSA_ASSERT(IsString(object)); | 1139 CSA_ASSERT(this, IsString(object)); |
| 1138 return LoadObjectField(object, String::kLengthOffset); | 1140 return LoadObjectField(object, String::kLengthOffset); |
| 1139 } | 1141 } |
| 1140 | 1142 |
| 1141 Node* CodeStubAssembler::LoadJSValueValue(Node* object) { | 1143 Node* CodeStubAssembler::LoadJSValueValue(Node* object) { |
| 1142 CSA_ASSERT(IsJSValue(object)); | 1144 CSA_ASSERT(this, IsJSValue(object)); |
| 1143 return LoadObjectField(object, JSValue::kValueOffset); | 1145 return LoadObjectField(object, JSValue::kValueOffset); |
| 1144 } | 1146 } |
| 1145 | 1147 |
| 1146 Node* CodeStubAssembler::LoadWeakCellValueUnchecked(Node* weak_cell) { | 1148 Node* CodeStubAssembler::LoadWeakCellValueUnchecked(Node* weak_cell) { |
| 1147 // TODO(ishell): fix callers. | 1149 // TODO(ishell): fix callers. |
| 1148 return LoadObjectField(weak_cell, WeakCell::kValueOffset); | 1150 return LoadObjectField(weak_cell, WeakCell::kValueOffset); |
| 1149 } | 1151 } |
| 1150 | 1152 |
| 1151 Node* CodeStubAssembler::LoadWeakCellValue(Node* weak_cell, Label* if_cleared) { | 1153 Node* CodeStubAssembler::LoadWeakCellValue(Node* weak_cell, Label* if_cleared) { |
| 1152 CSA_ASSERT(IsWeakCell(weak_cell)); | 1154 CSA_ASSERT(this, IsWeakCell(weak_cell)); |
| 1153 Node* value = LoadWeakCellValueUnchecked(weak_cell); | 1155 Node* value = LoadWeakCellValueUnchecked(weak_cell); |
| 1154 if (if_cleared != nullptr) { | 1156 if (if_cleared != nullptr) { |
| 1155 GotoIf(WordEqual(value, IntPtrConstant(0)), if_cleared); | 1157 GotoIf(WordEqual(value, IntPtrConstant(0)), if_cleared); |
| 1156 } | 1158 } |
| 1157 return value; | 1159 return value; |
| 1158 } | 1160 } |
| 1159 | 1161 |
| 1160 Node* CodeStubAssembler::LoadFixedArrayElement(Node* object, Node* index_node, | 1162 Node* CodeStubAssembler::LoadFixedArrayElement(Node* object, Node* index_node, |
| 1161 int additional_offset, | 1163 int additional_offset, |
| 1162 ParameterMode parameter_mode) { | 1164 ParameterMode parameter_mode) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 if (Is64()) { | 1222 if (Is64()) { |
| 1221 return Load(MachineType::Int32(), object, offset); | 1223 return Load(MachineType::Int32(), object, offset); |
| 1222 } else { | 1224 } else { |
| 1223 return SmiToWord32(Load(MachineType::AnyTagged(), object, offset)); | 1225 return SmiToWord32(Load(MachineType::AnyTagged(), object, offset)); |
| 1224 } | 1226 } |
| 1225 } | 1227 } |
| 1226 | 1228 |
| 1227 Node* CodeStubAssembler::LoadFixedDoubleArrayElement( | 1229 Node* CodeStubAssembler::LoadFixedDoubleArrayElement( |
| 1228 Node* object, Node* index_node, MachineType machine_type, | 1230 Node* object, Node* index_node, MachineType machine_type, |
| 1229 int additional_offset, ParameterMode parameter_mode, Label* if_hole) { | 1231 int additional_offset, ParameterMode parameter_mode, Label* if_hole) { |
| 1230 CSA_ASSERT(IsFixedDoubleArray(object)); | 1232 CSA_ASSERT(this, IsFixedDoubleArray(object)); |
| 1231 int32_t header_size = | 1233 int32_t header_size = |
| 1232 FixedDoubleArray::kHeaderSize + additional_offset - kHeapObjectTag; | 1234 FixedDoubleArray::kHeaderSize + additional_offset - kHeapObjectTag; |
| 1233 Node* offset = ElementOffsetFromIndex(index_node, FAST_HOLEY_DOUBLE_ELEMENTS, | 1235 Node* offset = ElementOffsetFromIndex(index_node, FAST_HOLEY_DOUBLE_ELEMENTS, |
| 1234 parameter_mode, header_size); | 1236 parameter_mode, header_size); |
| 1235 return LoadDoubleWithHoleCheck(object, offset, if_hole, machine_type); | 1237 return LoadDoubleWithHoleCheck(object, offset, if_hole, machine_type); |
| 1236 } | 1238 } |
| 1237 | 1239 |
| 1238 Node* CodeStubAssembler::LoadDoubleWithHoleCheck(Node* base, Node* offset, | 1240 Node* CodeStubAssembler::LoadDoubleWithHoleCheck(Node* base, Node* offset, |
| 1239 Label* if_hole, | 1241 Label* if_hole, |
| 1240 MachineType machine_type) { | 1242 MachineType machine_type) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 IntPtrConstant(Context::kHeaderSize - kHeapObjectTag)); | 1288 IntPtrConstant(Context::kHeaderSize - kHeapObjectTag)); |
| 1287 return Store(MachineRepresentation::kTagged, context, offset, value); | 1289 return Store(MachineRepresentation::kTagged, context, offset, value); |
| 1288 } | 1290 } |
| 1289 | 1291 |
| 1290 Node* CodeStubAssembler::LoadNativeContext(Node* context) { | 1292 Node* CodeStubAssembler::LoadNativeContext(Node* context) { |
| 1291 return LoadContextElement(context, Context::NATIVE_CONTEXT_INDEX); | 1293 return LoadContextElement(context, Context::NATIVE_CONTEXT_INDEX); |
| 1292 } | 1294 } |
| 1293 | 1295 |
| 1294 Node* CodeStubAssembler::LoadJSArrayElementsMap(ElementsKind kind, | 1296 Node* CodeStubAssembler::LoadJSArrayElementsMap(ElementsKind kind, |
| 1295 Node* native_context) { | 1297 Node* native_context) { |
| 1296 CSA_ASSERT(IsNativeContext(native_context)); | 1298 CSA_ASSERT(this, IsNativeContext(native_context)); |
| 1297 return LoadFixedArrayElement(native_context, | 1299 return LoadFixedArrayElement(native_context, |
| 1298 IntPtrConstant(Context::ArrayMapIndex(kind))); | 1300 IntPtrConstant(Context::ArrayMapIndex(kind))); |
| 1299 } | 1301 } |
| 1300 | 1302 |
| 1301 Node* CodeStubAssembler::StoreHeapNumberValue(Node* object, Node* value) { | 1303 Node* CodeStubAssembler::StoreHeapNumberValue(Node* object, Node* value) { |
| 1302 return StoreObjectFieldNoWriteBarrier(object, HeapNumber::kValueOffset, value, | 1304 return StoreObjectFieldNoWriteBarrier(object, HeapNumber::kValueOffset, value, |
| 1303 MachineRepresentation::kFloat64); | 1305 MachineRepresentation::kFloat64); |
| 1304 } | 1306 } |
| 1305 | 1307 |
| 1306 Node* CodeStubAssembler::StoreObjectField( | 1308 Node* CodeStubAssembler::StoreObjectField( |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1362 MachineRepresentation rep = MachineRepresentation::kTagged; | 1364 MachineRepresentation rep = MachineRepresentation::kTagged; |
| 1363 if (barrier_mode == SKIP_WRITE_BARRIER) { | 1365 if (barrier_mode == SKIP_WRITE_BARRIER) { |
| 1364 return StoreNoWriteBarrier(rep, object, offset, value); | 1366 return StoreNoWriteBarrier(rep, object, offset, value); |
| 1365 } else { | 1367 } else { |
| 1366 return Store(rep, object, offset, value); | 1368 return Store(rep, object, offset, value); |
| 1367 } | 1369 } |
| 1368 } | 1370 } |
| 1369 | 1371 |
| 1370 Node* CodeStubAssembler::StoreFixedDoubleArrayElement( | 1372 Node* CodeStubAssembler::StoreFixedDoubleArrayElement( |
| 1371 Node* object, Node* index_node, Node* value, ParameterMode parameter_mode) { | 1373 Node* object, Node* index_node, Node* value, ParameterMode parameter_mode) { |
| 1372 CSA_ASSERT(IsFixedDoubleArray(object)); | 1374 CSA_ASSERT(this, IsFixedDoubleArray(object)); |
| 1373 Node* offset = | 1375 Node* offset = |
| 1374 ElementOffsetFromIndex(index_node, FAST_DOUBLE_ELEMENTS, parameter_mode, | 1376 ElementOffsetFromIndex(index_node, FAST_DOUBLE_ELEMENTS, parameter_mode, |
| 1375 FixedArray::kHeaderSize - kHeapObjectTag); | 1377 FixedArray::kHeaderSize - kHeapObjectTag); |
| 1376 MachineRepresentation rep = MachineRepresentation::kFloat64; | 1378 MachineRepresentation rep = MachineRepresentation::kFloat64; |
| 1377 return StoreNoWriteBarrier(rep, object, offset, value); | 1379 return StoreNoWriteBarrier(rep, object, offset, value); |
| 1378 } | 1380 } |
| 1379 | 1381 |
| 1380 Node* CodeStubAssembler::AllocateHeapNumber(MutableMode mode) { | 1382 Node* CodeStubAssembler::AllocateHeapNumber(MutableMode mode) { |
| 1381 Node* result = Allocate(HeapNumber::kSize, kNone); | 1383 Node* result = Allocate(HeapNumber::kSize, kNone); |
| 1382 Heap::RootListIndex heap_map_index = | 1384 Heap::RootListIndex heap_map_index = |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 Goto(&if_join); | 1512 Goto(&if_join); |
| 1511 } | 1513 } |
| 1512 | 1514 |
| 1513 Bind(&if_join); | 1515 Bind(&if_join); |
| 1514 return var_result.value(); | 1516 return var_result.value(); |
| 1515 } | 1517 } |
| 1516 | 1518 |
| 1517 Node* CodeStubAssembler::AllocateSlicedString( | 1519 Node* CodeStubAssembler::AllocateSlicedString( |
| 1518 Heap::RootListIndex map_root_index, Node* length, Node* parent, | 1520 Heap::RootListIndex map_root_index, Node* length, Node* parent, |
| 1519 Node* offset) { | 1521 Node* offset) { |
| 1520 CSA_ASSERT(TaggedIsSmi(length)); | 1522 CSA_ASSERT(this, TaggedIsSmi(length)); |
| 1521 Node* result = Allocate(SlicedString::kSize); | 1523 Node* result = Allocate(SlicedString::kSize); |
| 1522 Node* map = LoadRoot(map_root_index); | 1524 Node* map = LoadRoot(map_root_index); |
| 1523 DCHECK(Heap::RootIsImmortalImmovable(map_root_index)); | 1525 DCHECK(Heap::RootIsImmortalImmovable(map_root_index)); |
| 1524 StoreMapNoWriteBarrier(result, map); | 1526 StoreMapNoWriteBarrier(result, map); |
| 1525 StoreObjectFieldNoWriteBarrier(result, SlicedString::kLengthOffset, length, | 1527 StoreObjectFieldNoWriteBarrier(result, SlicedString::kLengthOffset, length, |
| 1526 MachineRepresentation::kTagged); | 1528 MachineRepresentation::kTagged); |
| 1527 StoreObjectFieldNoWriteBarrier(result, SlicedString::kHashFieldOffset, | 1529 StoreObjectFieldNoWriteBarrier(result, SlicedString::kHashFieldOffset, |
| 1528 Int32Constant(String::kEmptyHashField), | 1530 Int32Constant(String::kEmptyHashField), |
| 1529 MachineRepresentation::kWord32); | 1531 MachineRepresentation::kWord32); |
| 1530 StoreObjectFieldNoWriteBarrier(result, SlicedString::kParentOffset, parent, | 1532 StoreObjectFieldNoWriteBarrier(result, SlicedString::kParentOffset, parent, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1543 Node* CodeStubAssembler::AllocateSlicedTwoByteString(Node* length, Node* parent, | 1545 Node* CodeStubAssembler::AllocateSlicedTwoByteString(Node* length, Node* parent, |
| 1544 Node* offset) { | 1546 Node* offset) { |
| 1545 return AllocateSlicedString(Heap::kSlicedStringMapRootIndex, length, parent, | 1547 return AllocateSlicedString(Heap::kSlicedStringMapRootIndex, length, parent, |
| 1546 offset); | 1548 offset); |
| 1547 } | 1549 } |
| 1548 | 1550 |
| 1549 Node* CodeStubAssembler::AllocateConsString(Heap::RootListIndex map_root_index, | 1551 Node* CodeStubAssembler::AllocateConsString(Heap::RootListIndex map_root_index, |
| 1550 Node* length, Node* first, | 1552 Node* length, Node* first, |
| 1551 Node* second, | 1553 Node* second, |
| 1552 AllocationFlags flags) { | 1554 AllocationFlags flags) { |
| 1553 CSA_ASSERT(TaggedIsSmi(length)); | 1555 CSA_ASSERT(this, TaggedIsSmi(length)); |
| 1554 Node* result = Allocate(ConsString::kSize, flags); | 1556 Node* result = Allocate(ConsString::kSize, flags); |
| 1555 Node* map = LoadRoot(map_root_index); | 1557 Node* map = LoadRoot(map_root_index); |
| 1556 DCHECK(Heap::RootIsImmortalImmovable(map_root_index)); | 1558 DCHECK(Heap::RootIsImmortalImmovable(map_root_index)); |
| 1557 StoreMapNoWriteBarrier(result, map); | 1559 StoreMapNoWriteBarrier(result, map); |
| 1558 StoreObjectFieldNoWriteBarrier(result, ConsString::kLengthOffset, length, | 1560 StoreObjectFieldNoWriteBarrier(result, ConsString::kLengthOffset, length, |
| 1559 MachineRepresentation::kTagged); | 1561 MachineRepresentation::kTagged); |
| 1560 StoreObjectFieldNoWriteBarrier(result, ConsString::kHashFieldOffset, | 1562 StoreObjectFieldNoWriteBarrier(result, ConsString::kHashFieldOffset, |
| 1561 Int32Constant(String::kEmptyHashField), | 1563 Int32Constant(String::kEmptyHashField), |
| 1562 MachineRepresentation::kWord32); | 1564 MachineRepresentation::kWord32); |
| 1563 bool const new_space = !(flags & kPretenured); | 1565 bool const new_space = !(flags & kPretenured); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1582 | 1584 |
| 1583 Node* CodeStubAssembler::AllocateTwoByteConsString(Node* length, Node* first, | 1585 Node* CodeStubAssembler::AllocateTwoByteConsString(Node* length, Node* first, |
| 1584 Node* second, | 1586 Node* second, |
| 1585 AllocationFlags flags) { | 1587 AllocationFlags flags) { |
| 1586 return AllocateConsString(Heap::kConsStringMapRootIndex, length, first, | 1588 return AllocateConsString(Heap::kConsStringMapRootIndex, length, first, |
| 1587 second, flags); | 1589 second, flags); |
| 1588 } | 1590 } |
| 1589 | 1591 |
| 1590 Node* CodeStubAssembler::NewConsString(Node* context, Node* length, Node* left, | 1592 Node* CodeStubAssembler::NewConsString(Node* context, Node* length, Node* left, |
| 1591 Node* right, AllocationFlags flags) { | 1593 Node* right, AllocationFlags flags) { |
| 1592 CSA_ASSERT(TaggedIsSmi(length)); | 1594 CSA_ASSERT(this, TaggedIsSmi(length)); |
| 1593 // Added string can be a cons string. | 1595 // Added string can be a cons string. |
| 1594 Comment("Allocating ConsString"); | 1596 Comment("Allocating ConsString"); |
| 1595 Node* left_instance_type = LoadInstanceType(left); | 1597 Node* left_instance_type = LoadInstanceType(left); |
| 1596 Node* right_instance_type = LoadInstanceType(right); | 1598 Node* right_instance_type = LoadInstanceType(right); |
| 1597 | 1599 |
| 1598 // Compute intersection and difference of instance types. | 1600 // Compute intersection and difference of instance types. |
| 1599 Node* anded_instance_types = WordAnd(left_instance_type, right_instance_type); | 1601 Node* anded_instance_types = WordAnd(left_instance_type, right_instance_type); |
| 1600 Node* xored_instance_types = WordXor(left_instance_type, right_instance_type); | 1602 Node* xored_instance_types = WordXor(left_instance_type, right_instance_type); |
| 1601 | 1603 |
| 1602 // We create a one-byte cons string if | 1604 // We create a one-byte cons string if |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1637 | 1639 |
| 1638 Bind(&done); | 1640 Bind(&done); |
| 1639 | 1641 |
| 1640 return result.value(); | 1642 return result.value(); |
| 1641 } | 1643 } |
| 1642 | 1644 |
| 1643 Node* CodeStubAssembler::AllocateRegExpResult(Node* context, Node* length, | 1645 Node* CodeStubAssembler::AllocateRegExpResult(Node* context, Node* length, |
| 1644 Node* index, Node* input) { | 1646 Node* index, Node* input) { |
| 1645 Node* const max_length = | 1647 Node* const max_length = |
| 1646 SmiConstant(Smi::FromInt(JSArray::kInitialMaxFastElementArray)); | 1648 SmiConstant(Smi::FromInt(JSArray::kInitialMaxFastElementArray)); |
| 1647 CSA_ASSERT(SmiLessThanOrEqual(length, max_length)); | 1649 CSA_ASSERT(this, SmiLessThanOrEqual(length, max_length)); |
| 1650 USE(max_length); |
| 1648 | 1651 |
| 1649 // Allocate the JSRegExpResult. | 1652 // Allocate the JSRegExpResult. |
| 1650 // TODO(jgruber): Fold JSArray and FixedArray allocations, then remove | 1653 // TODO(jgruber): Fold JSArray and FixedArray allocations, then remove |
| 1651 // unneeded store of elements. | 1654 // unneeded store of elements. |
| 1652 Node* const result = Allocate(JSRegExpResult::kSize); | 1655 Node* const result = Allocate(JSRegExpResult::kSize); |
| 1653 | 1656 |
| 1654 // TODO(jgruber): Store map as Heap constant? | 1657 // TODO(jgruber): Store map as Heap constant? |
| 1655 Node* const native_context = LoadNativeContext(context); | 1658 Node* const native_context = LoadNativeContext(context); |
| 1656 Node* const map = | 1659 Node* const map = |
| 1657 LoadContextElement(native_context, Context::REGEXP_RESULT_MAP_INDEX); | 1660 LoadContextElement(native_context, Context::REGEXP_RESULT_MAP_INDEX); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1682 Heap::kUndefinedValueRootIndex, parameter_mode); | 1685 Heap::kUndefinedValueRootIndex, parameter_mode); |
| 1683 | 1686 |
| 1684 return result; | 1687 return result; |
| 1685 } | 1688 } |
| 1686 | 1689 |
| 1687 Node* CodeStubAssembler::AllocateNameDictionary(int at_least_space_for) { | 1690 Node* CodeStubAssembler::AllocateNameDictionary(int at_least_space_for) { |
| 1688 return AllocateNameDictionary(IntPtrConstant(at_least_space_for)); | 1691 return AllocateNameDictionary(IntPtrConstant(at_least_space_for)); |
| 1689 } | 1692 } |
| 1690 | 1693 |
| 1691 Node* CodeStubAssembler::AllocateNameDictionary(Node* at_least_space_for) { | 1694 Node* CodeStubAssembler::AllocateNameDictionary(Node* at_least_space_for) { |
| 1692 CSA_ASSERT(UintPtrLessThanOrEqual( | 1695 CSA_ASSERT(this, UintPtrLessThanOrEqual( |
| 1693 at_least_space_for, IntPtrConstant(NameDictionary::kMaxCapacity))); | 1696 at_least_space_for, |
| 1697 IntPtrConstant(NameDictionary::kMaxCapacity))); |
| 1694 | 1698 |
| 1695 Node* capacity = HashTableComputeCapacity(at_least_space_for); | 1699 Node* capacity = HashTableComputeCapacity(at_least_space_for); |
| 1696 CSA_ASSERT(WordIsPowerOfTwo(capacity)); | 1700 CSA_ASSERT(this, WordIsPowerOfTwo(capacity)); |
| 1697 | 1701 |
| 1698 Node* length = EntryToIndex<NameDictionary>(capacity); | 1702 Node* length = EntryToIndex<NameDictionary>(capacity); |
| 1699 Node* store_size = | 1703 Node* store_size = |
| 1700 IntPtrAddFoldConstants(WordShl(length, IntPtrConstant(kPointerSizeLog2)), | 1704 IntPtrAddFoldConstants(WordShl(length, IntPtrConstant(kPointerSizeLog2)), |
| 1701 IntPtrConstant(NameDictionary::kHeaderSize)); | 1705 IntPtrConstant(NameDictionary::kHeaderSize)); |
| 1702 | 1706 |
| 1703 Node* result = Allocate(store_size); | 1707 Node* result = Allocate(store_size); |
| 1704 Comment("Initialize NameDictionary"); | 1708 Comment("Initialize NameDictionary"); |
| 1705 // Initialize FixedArray fields. | 1709 // Initialize FixedArray fields. |
| 1706 StoreObjectFieldRoot(result, FixedArray::kMapOffset, | 1710 StoreObjectFieldRoot(result, FixedArray::kMapOffset, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1731 kHeapObjectTag)); | 1735 kHeapObjectTag)); |
| 1732 Node* end_address = IntPtrAdd( | 1736 Node* end_address = IntPtrAdd( |
| 1733 result, | 1737 result, |
| 1734 IntPtrSubFoldConstants(store_size, IntPtrConstant(kHeapObjectTag))); | 1738 IntPtrSubFoldConstants(store_size, IntPtrConstant(kHeapObjectTag))); |
| 1735 StoreFieldsNoWriteBarrier(start_address, end_address, filler); | 1739 StoreFieldsNoWriteBarrier(start_address, end_address, filler); |
| 1736 return result; | 1740 return result; |
| 1737 } | 1741 } |
| 1738 | 1742 |
| 1739 Node* CodeStubAssembler::AllocateJSObjectFromMap(Node* map, Node* properties, | 1743 Node* CodeStubAssembler::AllocateJSObjectFromMap(Node* map, Node* properties, |
| 1740 Node* elements) { | 1744 Node* elements) { |
| 1741 CSA_ASSERT(IsMap(map)); | 1745 CSA_ASSERT(this, IsMap(map)); |
| 1742 Node* size = | 1746 Node* size = |
| 1743 IntPtrMul(LoadMapInstanceSize(map), IntPtrConstant(kPointerSize)); | 1747 IntPtrMul(LoadMapInstanceSize(map), IntPtrConstant(kPointerSize)); |
| 1744 CSA_ASSERT(IsRegularHeapObjectSize(size)); | 1748 CSA_ASSERT(this, IsRegularHeapObjectSize(size)); |
| 1745 Node* object = Allocate(size); | 1749 Node* object = Allocate(size); |
| 1746 StoreMapNoWriteBarrier(object, map); | 1750 StoreMapNoWriteBarrier(object, map); |
| 1747 InitializeJSObjectFromMap(object, map, size, properties, elements); | 1751 InitializeJSObjectFromMap(object, map, size, properties, elements); |
| 1748 return object; | 1752 return object; |
| 1749 } | 1753 } |
| 1750 | 1754 |
| 1751 void CodeStubAssembler::InitializeJSObjectFromMap(Node* object, Node* map, | 1755 void CodeStubAssembler::InitializeJSObjectFromMap(Node* object, Node* map, |
| 1752 Node* size, Node* properties, | 1756 Node* size, Node* properties, |
| 1753 Node* elements) { | 1757 Node* elements) { |
| 1754 // This helper assumes that the object is in new-space, as guarded by the | 1758 // This helper assumes that the object is in new-space, as guarded by the |
| 1755 // check in AllocatedJSObjectFromMap. | 1759 // check in AllocatedJSObjectFromMap. |
| 1756 if (properties == nullptr) { | 1760 if (properties == nullptr) { |
| 1757 CSA_ASSERT(Word32BinaryNot(IsDictionaryMap((map)))); | 1761 CSA_ASSERT(this, Word32BinaryNot(IsDictionaryMap((map)))); |
| 1758 StoreObjectFieldRoot(object, JSObject::kPropertiesOffset, | 1762 StoreObjectFieldRoot(object, JSObject::kPropertiesOffset, |
| 1759 Heap::kEmptyFixedArrayRootIndex); | 1763 Heap::kEmptyFixedArrayRootIndex); |
| 1760 } else { | 1764 } else { |
| 1761 StoreObjectFieldNoWriteBarrier(object, JSObject::kPropertiesOffset, | 1765 StoreObjectFieldNoWriteBarrier(object, JSObject::kPropertiesOffset, |
| 1762 properties); | 1766 properties); |
| 1763 } | 1767 } |
| 1764 if (elements == nullptr) { | 1768 if (elements == nullptr) { |
| 1765 StoreObjectFieldRoot(object, JSObject::kElementsOffset, | 1769 StoreObjectFieldRoot(object, JSObject::kElementsOffset, |
| 1766 Heap::kEmptyFixedArrayRootIndex); | 1770 Heap::kEmptyFixedArrayRootIndex); |
| 1767 } else { | 1771 } else { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1780 IntPtrAdd(object, IntPtrConstant(start_offset - kHeapObjectTag)); | 1784 IntPtrAdd(object, IntPtrConstant(start_offset - kHeapObjectTag)); |
| 1781 Node* end_address = | 1785 Node* end_address = |
| 1782 IntPtrSub(IntPtrAdd(object, size), IntPtrConstant(kHeapObjectTag)); | 1786 IntPtrSub(IntPtrAdd(object, size), IntPtrConstant(kHeapObjectTag)); |
| 1783 StoreFieldsNoWriteBarrier(start_address, end_address, filler); | 1787 StoreFieldsNoWriteBarrier(start_address, end_address, filler); |
| 1784 } | 1788 } |
| 1785 | 1789 |
| 1786 void CodeStubAssembler::StoreFieldsNoWriteBarrier(Node* start_address, | 1790 void CodeStubAssembler::StoreFieldsNoWriteBarrier(Node* start_address, |
| 1787 Node* end_address, | 1791 Node* end_address, |
| 1788 Node* value) { | 1792 Node* value) { |
| 1789 Comment("StoreFieldsNoWriteBarrier"); | 1793 Comment("StoreFieldsNoWriteBarrier"); |
| 1790 CSA_ASSERT(WordIsWordAligned(start_address)); | 1794 CSA_ASSERT(this, WordIsWordAligned(start_address)); |
| 1791 CSA_ASSERT(WordIsWordAligned(end_address)); | 1795 CSA_ASSERT(this, WordIsWordAligned(end_address)); |
| 1792 BuildFastLoop( | 1796 BuildFastLoop( |
| 1793 MachineType::PointerRepresentation(), start_address, end_address, | 1797 MachineType::PointerRepresentation(), start_address, end_address, |
| 1794 [value](CodeStubAssembler* a, Node* current) { | 1798 [value](CodeStubAssembler* a, Node* current) { |
| 1795 a->StoreNoWriteBarrier(MachineRepresentation::kTagged, current, value); | 1799 a->StoreNoWriteBarrier(MachineRepresentation::kTagged, current, value); |
| 1796 }, | 1800 }, |
| 1797 kPointerSize, IndexAdvanceMode::kPost); | 1801 kPointerSize, IndexAdvanceMode::kPost); |
| 1798 } | 1802 } |
| 1799 | 1803 |
| 1800 Node* CodeStubAssembler::AllocateUninitializedJSArrayWithoutElements( | 1804 Node* CodeStubAssembler::AllocateUninitializedJSArrayWithoutElements( |
| 1801 ElementsKind kind, Node* array_map, Node* length, Node* allocation_site) { | 1805 ElementsKind kind, Node* array_map, Node* length, Node* allocation_site) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1883 : IntPtrConstant(0), | 1887 : IntPtrConstant(0), |
| 1884 capacity, Heap::kTheHoleValueRootIndex, capacity_mode); | 1888 capacity, Heap::kTheHoleValueRootIndex, capacity_mode); |
| 1885 | 1889 |
| 1886 return array; | 1890 return array; |
| 1887 } | 1891 } |
| 1888 | 1892 |
| 1889 Node* CodeStubAssembler::AllocateFixedArray(ElementsKind kind, | 1893 Node* CodeStubAssembler::AllocateFixedArray(ElementsKind kind, |
| 1890 Node* capacity_node, | 1894 Node* capacity_node, |
| 1891 ParameterMode mode, | 1895 ParameterMode mode, |
| 1892 AllocationFlags flags) { | 1896 AllocationFlags flags) { |
| 1893 CSA_ASSERT(IntPtrGreaterThan(capacity_node, IntPtrOrSmiConstant(0, mode))); | 1897 CSA_ASSERT(this, |
| 1898 IntPtrGreaterThan(capacity_node, IntPtrOrSmiConstant(0, mode))); |
| 1894 Node* total_size = GetFixedArrayAllocationSize(capacity_node, kind, mode); | 1899 Node* total_size = GetFixedArrayAllocationSize(capacity_node, kind, mode); |
| 1895 | 1900 |
| 1896 // Allocate both array and elements object, and initialize the JSArray. | 1901 // Allocate both array and elements object, and initialize the JSArray. |
| 1897 Node* array = Allocate(total_size, flags); | 1902 Node* array = Allocate(total_size, flags); |
| 1898 Heap* heap = isolate()->heap(); | 1903 Heap* heap = isolate()->heap(); |
| 1899 Handle<Map> map(IsFastDoubleElementsKind(kind) | 1904 Handle<Map> map(IsFastDoubleElementsKind(kind) |
| 1900 ? heap->fixed_double_array_map() | 1905 ? heap->fixed_double_array_map() |
| 1901 : heap->fixed_array_map()); | 1906 : heap->fixed_array_map()); |
| 1902 if (flags & kPretenured) { | 1907 if (flags & kPretenured) { |
| 1903 StoreObjectField(array, JSObject::kMapOffset, HeapConstant(map)); | 1908 StoreObjectField(array, JSObject::kMapOffset, HeapConstant(map)); |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2651 value); | 2656 value); |
| 2652 var_value_map.Bind(UndefinedConstant()); | 2657 var_value_map.Bind(UndefinedConstant()); |
| 2653 Goto(&out); // Never reached. | 2658 Goto(&out); // Never reached. |
| 2654 | 2659 |
| 2655 Bind(&out); | 2660 Bind(&out); |
| 2656 return var_value_map.value(); | 2661 return var_value_map.value(); |
| 2657 } | 2662 } |
| 2658 | 2663 |
| 2659 Node* CodeStubAssembler::IsSpecialReceiverMap(Node* map) { | 2664 Node* CodeStubAssembler::IsSpecialReceiverMap(Node* map) { |
| 2660 Node* is_special = IsSpecialReceiverInstanceType(LoadMapInstanceType(map)); | 2665 Node* is_special = IsSpecialReceiverInstanceType(LoadMapInstanceType(map)); |
| 2661 Node* bit_field = LoadMapBitField(map); | |
| 2662 uint32_t mask = | 2666 uint32_t mask = |
| 2663 1 << Map::kHasNamedInterceptor | 1 << Map::kIsAccessCheckNeeded; | 2667 1 << Map::kHasNamedInterceptor | 1 << Map::kIsAccessCheckNeeded; |
| 2668 USE(mask); |
| 2664 // Interceptors or access checks imply special receiver. | 2669 // Interceptors or access checks imply special receiver. |
| 2665 CSA_ASSERT( | 2670 CSA_ASSERT(this, Select(IsSetWord32(LoadMapBitField(map), mask), is_special, |
| 2666 Select(IsSetWord32(bit_field, mask), is_special, Int32Constant(1))); | 2671 Int32Constant(1), MachineRepresentation::kWord32)); |
| 2667 return is_special; | 2672 return is_special; |
| 2668 } | 2673 } |
| 2669 | 2674 |
| 2670 Node* CodeStubAssembler::IsDictionaryMap(Node* map) { | 2675 Node* CodeStubAssembler::IsDictionaryMap(Node* map) { |
| 2671 CSA_SLOW_ASSERT(IsMap(map)); | 2676 CSA_SLOW_ASSERT(this, IsMap(map)); |
| 2672 Node* bit_field3 = LoadMapBitField3(map); | 2677 Node* bit_field3 = LoadMapBitField3(map); |
| 2673 return Word32NotEqual(IsSetWord32<Map::DictionaryMap>(bit_field3), | 2678 return Word32NotEqual(IsSetWord32<Map::DictionaryMap>(bit_field3), |
| 2674 Int32Constant(0)); | 2679 Int32Constant(0)); |
| 2675 } | 2680 } |
| 2676 | 2681 |
| 2677 Node* CodeStubAssembler::IsCallableMap(Node* map) { | 2682 Node* CodeStubAssembler::IsCallableMap(Node* map) { |
| 2678 CSA_ASSERT(IsMap(map)); | 2683 CSA_ASSERT(this, IsMap(map)); |
| 2679 return Word32NotEqual( | 2684 return Word32NotEqual( |
| 2680 Word32And(LoadMapBitField(map), Int32Constant(1 << Map::kIsCallable)), | 2685 Word32And(LoadMapBitField(map), Int32Constant(1 << Map::kIsCallable)), |
| 2681 Int32Constant(0)); | 2686 Int32Constant(0)); |
| 2682 } | 2687 } |
| 2683 | 2688 |
| 2684 Node* CodeStubAssembler::IsSpecialReceiverInstanceType(Node* instance_type) { | 2689 Node* CodeStubAssembler::IsSpecialReceiverInstanceType(Node* instance_type) { |
| 2685 STATIC_ASSERT(JS_GLOBAL_OBJECT_TYPE <= LAST_SPECIAL_RECEIVER_TYPE); | 2690 STATIC_ASSERT(JS_GLOBAL_OBJECT_TYPE <= LAST_SPECIAL_RECEIVER_TYPE); |
| 2686 return Int32LessThanOrEqual(instance_type, | 2691 return Int32LessThanOrEqual(instance_type, |
| 2687 Int32Constant(LAST_SPECIAL_RECEIVER_TYPE)); | 2692 Int32Constant(LAST_SPECIAL_RECEIVER_TYPE)); |
| 2688 } | 2693 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2755 Node* CodeStubAssembler::IsDictionary(Node* object) { | 2760 Node* CodeStubAssembler::IsDictionary(Node* object) { |
| 2756 return WordOr(IsHashTable(object), IsUnseededNumberDictionary(object)); | 2761 return WordOr(IsHashTable(object), IsUnseededNumberDictionary(object)); |
| 2757 } | 2762 } |
| 2758 | 2763 |
| 2759 Node* CodeStubAssembler::IsUnseededNumberDictionary(Node* object) { | 2764 Node* CodeStubAssembler::IsUnseededNumberDictionary(Node* object) { |
| 2760 return WordEqual(LoadMap(object), | 2765 return WordEqual(LoadMap(object), |
| 2761 LoadRoot(Heap::kUnseededNumberDictionaryMapRootIndex)); | 2766 LoadRoot(Heap::kUnseededNumberDictionaryMapRootIndex)); |
| 2762 } | 2767 } |
| 2763 | 2768 |
| 2764 Node* CodeStubAssembler::StringCharCodeAt(Node* string, Node* index) { | 2769 Node* CodeStubAssembler::StringCharCodeAt(Node* string, Node* index) { |
| 2765 CSA_ASSERT(IsString(string)); | 2770 CSA_ASSERT(this, IsString(string)); |
| 2766 // Translate the {index} into a Word. | 2771 // Translate the {index} into a Word. |
| 2767 index = SmiToWord(index); | 2772 index = SmiToWord(index); |
| 2768 | 2773 |
| 2769 // We may need to loop in case of cons or sliced strings. | 2774 // We may need to loop in case of cons or sliced strings. |
| 2770 Variable var_index(this, MachineType::PointerRepresentation()); | 2775 Variable var_index(this, MachineType::PointerRepresentation()); |
| 2771 Variable var_result(this, MachineRepresentation::kWord32); | 2776 Variable var_result(this, MachineRepresentation::kWord32); |
| 2772 Variable var_string(this, MachineRepresentation::kTagged); | 2777 Variable var_string(this, MachineRepresentation::kTagged); |
| 2773 Variable* loop_vars[] = {&var_index, &var_string}; | 2778 Variable* loop_vars[] = {&var_index, &var_string}; |
| 2774 Label done_loop(this, &var_result), loop(this, 2, loop_vars); | 2779 Label done_loop(this, &var_result), loop(this, 2, loop_vars); |
| 2775 var_string.Bind(string); | 2780 var_string.Bind(string); |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3287 result.Bind(right); | 3292 result.Bind(right); |
| 3288 Goto(&done_native); | 3293 Goto(&done_native); |
| 3289 | 3294 |
| 3290 Bind(&check_right); | 3295 Bind(&check_right); |
| 3291 Node* right_length = LoadStringLength(right); | 3296 Node* right_length = LoadStringLength(right); |
| 3292 GotoIf(WordNotEqual(IntPtrConstant(0), right_length), &cons); | 3297 GotoIf(WordNotEqual(IntPtrConstant(0), right_length), &cons); |
| 3293 result.Bind(left); | 3298 result.Bind(left); |
| 3294 Goto(&done_native); | 3299 Goto(&done_native); |
| 3295 | 3300 |
| 3296 Bind(&cons); | 3301 Bind(&cons); |
| 3297 CSA_ASSERT(TaggedIsSmi(left_length)); | 3302 CSA_ASSERT(this, TaggedIsSmi(left_length)); |
| 3298 CSA_ASSERT(TaggedIsSmi(right_length)); | 3303 CSA_ASSERT(this, TaggedIsSmi(right_length)); |
| 3299 Node* new_length = SmiAdd(left_length, right_length); | 3304 Node* new_length = SmiAdd(left_length, right_length); |
| 3300 GotoIf(UintPtrGreaterThanOrEqual( | 3305 GotoIf(UintPtrGreaterThanOrEqual( |
| 3301 new_length, SmiConstant(Smi::FromInt(String::kMaxLength))), | 3306 new_length, SmiConstant(Smi::FromInt(String::kMaxLength))), |
| 3302 &runtime); | 3307 &runtime); |
| 3303 | 3308 |
| 3304 GotoIf(IntPtrLessThan(new_length, | 3309 GotoIf(IntPtrLessThan(new_length, |
| 3305 SmiConstant(Smi::FromInt(ConsString::kMinLength))), | 3310 SmiConstant(Smi::FromInt(ConsString::kMinLength))), |
| 3306 &non_cons); | 3311 &non_cons); |
| 3307 | 3312 |
| 3308 result.Bind(NewConsString(context, new_length, left, right, flags)); | 3313 result.Bind(NewConsString(context, new_length, left, right, flags)); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3372 IncrementCounter(counters->string_add_native(), 1); | 3377 IncrementCounter(counters->string_add_native(), 1); |
| 3373 Goto(&done); | 3378 Goto(&done); |
| 3374 } | 3379 } |
| 3375 | 3380 |
| 3376 Bind(&done); | 3381 Bind(&done); |
| 3377 return result.value(); | 3382 return result.value(); |
| 3378 } | 3383 } |
| 3379 | 3384 |
| 3380 Node* CodeStubAssembler::StringIndexOfChar(Node* context, Node* string, | 3385 Node* CodeStubAssembler::StringIndexOfChar(Node* context, Node* string, |
| 3381 Node* needle_char, Node* from) { | 3386 Node* needle_char, Node* from) { |
| 3382 CSA_ASSERT(IsString(string)); | 3387 CSA_ASSERT(this, IsString(string)); |
| 3383 Variable var_result(this, MachineRepresentation::kTagged); | 3388 Variable var_result(this, MachineRepresentation::kTagged); |
| 3384 | 3389 |
| 3385 Label out(this), runtime(this, Label::kDeferred); | 3390 Label out(this), runtime(this, Label::kDeferred); |
| 3386 | 3391 |
| 3387 // Let runtime handle non-one-byte {needle_char}. | 3392 // Let runtime handle non-one-byte {needle_char}. |
| 3388 | 3393 |
| 3389 Node* const one_byte_char_mask = IntPtrConstant(0xFF); | 3394 Node* const one_byte_char_mask = IntPtrConstant(0xFF); |
| 3390 GotoUnless(WordEqual(WordAnd(needle_char, one_byte_char_mask), needle_char), | 3395 GotoUnless(WordEqual(WordAnd(needle_char, one_byte_char_mask), needle_char), |
| 3391 &runtime); | 3396 &runtime); |
| 3392 | 3397 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3644 Goto(&end); | 3649 Goto(&end); |
| 3645 } | 3650 } |
| 3646 } | 3651 } |
| 3647 | 3652 |
| 3648 Bind(&end); | 3653 Bind(&end); |
| 3649 return var_result.value(); | 3654 return var_result.value(); |
| 3650 } | 3655 } |
| 3651 | 3656 |
| 3652 Node* CodeStubAssembler::NonNumberToNumber(Node* context, Node* input) { | 3657 Node* CodeStubAssembler::NonNumberToNumber(Node* context, Node* input) { |
| 3653 // Assert input is a HeapObject (not smi or heap number) | 3658 // Assert input is a HeapObject (not smi or heap number) |
| 3654 CSA_ASSERT(Word32BinaryNot(TaggedIsSmi(input))); | 3659 CSA_ASSERT(this, Word32BinaryNot(TaggedIsSmi(input))); |
| 3655 CSA_ASSERT(Word32NotEqual(LoadMap(input), HeapNumberMapConstant())); | 3660 CSA_ASSERT(this, Word32NotEqual(LoadMap(input), HeapNumberMapConstant())); |
| 3656 | 3661 |
| 3657 // We might need to loop once here due to ToPrimitive conversions. | 3662 // We might need to loop once here due to ToPrimitive conversions. |
| 3658 Variable var_input(this, MachineRepresentation::kTagged); | 3663 Variable var_input(this, MachineRepresentation::kTagged); |
| 3659 Variable var_result(this, MachineRepresentation::kTagged); | 3664 Variable var_result(this, MachineRepresentation::kTagged); |
| 3660 Label loop(this, &var_input); | 3665 Label loop(this, &var_input); |
| 3661 Label end(this); | 3666 Label end(this); |
| 3662 var_input.Bind(input); | 3667 var_input.Bind(input); |
| 3663 Goto(&loop); | 3668 Goto(&loop); |
| 3664 Bind(&loop); | 3669 Bind(&loop); |
| 3665 { | 3670 { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3802 { | 3807 { |
| 3803 result.Bind(CallRuntime(Runtime::kToString, context, input)); | 3808 result.Bind(CallRuntime(Runtime::kToString, context, input)); |
| 3804 Goto(&done); | 3809 Goto(&done); |
| 3805 } | 3810 } |
| 3806 | 3811 |
| 3807 Bind(&done); | 3812 Bind(&done); |
| 3808 return result.value(); | 3813 return result.value(); |
| 3809 } | 3814 } |
| 3810 | 3815 |
| 3811 Node* CodeStubAssembler::FlattenString(Node* string) { | 3816 Node* CodeStubAssembler::FlattenString(Node* string) { |
| 3812 CSA_ASSERT(IsString(string)); | 3817 CSA_ASSERT(this, IsString(string)); |
| 3813 Variable var_result(this, MachineRepresentation::kTagged); | 3818 Variable var_result(this, MachineRepresentation::kTagged); |
| 3814 var_result.Bind(string); | 3819 var_result.Bind(string); |
| 3815 | 3820 |
| 3816 Node* instance_type = LoadInstanceType(string); | 3821 Node* instance_type = LoadInstanceType(string); |
| 3817 | 3822 |
| 3818 // Check if the {string} is not a ConsString (i.e. already flat). | 3823 // Check if the {string} is not a ConsString (i.e. already flat). |
| 3819 Label is_cons(this, Label::kDeferred), is_flat_in_cons(this), end(this); | 3824 Label is_cons(this, Label::kDeferred), is_flat_in_cons(this), end(this); |
| 3820 { | 3825 { |
| 3821 GotoUnless(Word32Equal(Word32And(instance_type, | 3826 GotoUnless(Word32Equal(Word32And(instance_type, |
| 3822 Int32Constant(kStringRepresentationMask)), | 3827 Int32Constant(kStringRepresentationMask)), |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4036 return Select(IntPtrGreaterThanOrEqual(left, right), left, right, | 4041 return Select(IntPtrGreaterThanOrEqual(left, right), left, right, |
| 4037 MachineType::PointerRepresentation()); | 4042 MachineType::PointerRepresentation()); |
| 4038 } | 4043 } |
| 4039 | 4044 |
| 4040 template <typename Dictionary> | 4045 template <typename Dictionary> |
| 4041 void CodeStubAssembler::NameDictionaryLookup(Node* dictionary, | 4046 void CodeStubAssembler::NameDictionaryLookup(Node* dictionary, |
| 4042 Node* unique_name, Label* if_found, | 4047 Node* unique_name, Label* if_found, |
| 4043 Variable* var_name_index, | 4048 Variable* var_name_index, |
| 4044 Label* if_not_found, | 4049 Label* if_not_found, |
| 4045 int inlined_probes) { | 4050 int inlined_probes) { |
| 4046 CSA_ASSERT(IsDictionary(dictionary)); | 4051 CSA_ASSERT(this, IsDictionary(dictionary)); |
| 4047 DCHECK_EQ(MachineType::PointerRepresentation(), var_name_index->rep()); | 4052 DCHECK_EQ(MachineType::PointerRepresentation(), var_name_index->rep()); |
| 4048 Comment("NameDictionaryLookup"); | 4053 Comment("NameDictionaryLookup"); |
| 4049 | 4054 |
| 4050 Node* capacity = SmiUntag(LoadFixedArrayElement( | 4055 Node* capacity = SmiUntag(LoadFixedArrayElement( |
| 4051 dictionary, IntPtrConstant(Dictionary::kCapacityIndex), 0, | 4056 dictionary, IntPtrConstant(Dictionary::kCapacityIndex), 0, |
| 4052 INTPTR_PARAMETERS)); | 4057 INTPTR_PARAMETERS)); |
| 4053 Node* mask = IntPtrSub(capacity, IntPtrConstant(1)); | 4058 Node* mask = IntPtrSub(capacity, IntPtrConstant(1)); |
| 4054 Node* hash = ChangeUint32ToWord(LoadNameHash(unique_name)); | 4059 Node* hash = ChangeUint32ToWord(LoadNameHash(unique_name)); |
| 4055 | 4060 |
| 4056 // See Dictionary::FirstProbe(). | 4061 // See Dictionary::FirstProbe(). |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4121 hash = Word32Xor(hash, Word32Shr(hash, Int32Constant(16))); | 4126 hash = Word32Xor(hash, Word32Shr(hash, Int32Constant(16))); |
| 4122 return Word32And(hash, Int32Constant(0x3fffffff)); | 4127 return Word32And(hash, Int32Constant(0x3fffffff)); |
| 4123 } | 4128 } |
| 4124 | 4129 |
| 4125 template <typename Dictionary> | 4130 template <typename Dictionary> |
| 4126 void CodeStubAssembler::NumberDictionaryLookup(Node* dictionary, | 4131 void CodeStubAssembler::NumberDictionaryLookup(Node* dictionary, |
| 4127 Node* intptr_index, | 4132 Node* intptr_index, |
| 4128 Label* if_found, | 4133 Label* if_found, |
| 4129 Variable* var_entry, | 4134 Variable* var_entry, |
| 4130 Label* if_not_found) { | 4135 Label* if_not_found) { |
| 4131 CSA_ASSERT(IsDictionary(dictionary)); | 4136 CSA_ASSERT(this, IsDictionary(dictionary)); |
| 4132 DCHECK_EQ(MachineType::PointerRepresentation(), var_entry->rep()); | 4137 DCHECK_EQ(MachineType::PointerRepresentation(), var_entry->rep()); |
| 4133 Comment("NumberDictionaryLookup"); | 4138 Comment("NumberDictionaryLookup"); |
| 4134 | 4139 |
| 4135 Node* capacity = SmiUntag(LoadFixedArrayElement( | 4140 Node* capacity = SmiUntag(LoadFixedArrayElement( |
| 4136 dictionary, IntPtrConstant(Dictionary::kCapacityIndex), 0, | 4141 dictionary, IntPtrConstant(Dictionary::kCapacityIndex), 0, |
| 4137 INTPTR_PARAMETERS)); | 4142 INTPTR_PARAMETERS)); |
| 4138 Node* mask = IntPtrSub(capacity, IntPtrConstant(1)); | 4143 Node* mask = IntPtrSub(capacity, IntPtrConstant(1)); |
| 4139 | 4144 |
| 4140 Node* int32_seed; | 4145 Node* int32_seed; |
| 4141 if (Dictionary::ShapeT::UsesSeed) { | 4146 if (Dictionary::ShapeT::UsesSeed) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4228 Label* if_bailout) { | 4233 Label* if_bailout) { |
| 4229 DCHECK_EQ(MachineRepresentation::kTagged, var_meta_storage->rep()); | 4234 DCHECK_EQ(MachineRepresentation::kTagged, var_meta_storage->rep()); |
| 4230 DCHECK_EQ(MachineType::PointerRepresentation(), var_name_index->rep()); | 4235 DCHECK_EQ(MachineType::PointerRepresentation(), var_name_index->rep()); |
| 4231 | 4236 |
| 4232 Label if_objectisspecial(this); | 4237 Label if_objectisspecial(this); |
| 4233 STATIC_ASSERT(JS_GLOBAL_OBJECT_TYPE <= LAST_SPECIAL_RECEIVER_TYPE); | 4238 STATIC_ASSERT(JS_GLOBAL_OBJECT_TYPE <= LAST_SPECIAL_RECEIVER_TYPE); |
| 4234 GotoIf(Int32LessThanOrEqual(instance_type, | 4239 GotoIf(Int32LessThanOrEqual(instance_type, |
| 4235 Int32Constant(LAST_SPECIAL_RECEIVER_TYPE)), | 4240 Int32Constant(LAST_SPECIAL_RECEIVER_TYPE)), |
| 4236 &if_objectisspecial); | 4241 &if_objectisspecial); |
| 4237 | 4242 |
| 4238 Node* bit_field = LoadMapBitField(map); | 4243 uint32_t mask = |
| 4239 Node* mask = Int32Constant(1 << Map::kHasNamedInterceptor | | 4244 1 << Map::kHasNamedInterceptor | 1 << Map::kIsAccessCheckNeeded; |
| 4240 1 << Map::kIsAccessCheckNeeded); | 4245 CSA_ASSERT(this, Word32BinaryNot(IsSetWord32(LoadMapBitField(map), mask))); |
| 4241 CSA_ASSERT(Word32Equal(Word32And(bit_field, mask), Int32Constant(0))); | 4246 USE(mask); |
| 4242 | 4247 |
| 4243 Node* bit_field3 = LoadMapBitField3(map); | 4248 Node* bit_field3 = LoadMapBitField3(map); |
| 4244 Label if_isfastmap(this), if_isslowmap(this); | 4249 Label if_isfastmap(this), if_isslowmap(this); |
| 4245 Branch(IsSetWord32<Map::DictionaryMap>(bit_field3), &if_isslowmap, | 4250 Branch(IsSetWord32<Map::DictionaryMap>(bit_field3), &if_isslowmap, |
| 4246 &if_isfastmap); | 4251 &if_isfastmap); |
| 4247 Bind(&if_isfastmap); | 4252 Bind(&if_isfastmap); |
| 4248 { | 4253 { |
| 4249 Comment("DescriptorArrayLookup"); | 4254 Comment("DescriptorArrayLookup"); |
| 4250 Node* nof = | 4255 Node* nof = |
| 4251 DecodeWordFromWord32<Map::NumberOfOwnDescriptorsBits>(bit_field3); | 4256 DecodeWordFromWord32<Map::NumberOfOwnDescriptorsBits>(bit_field3); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4424 Bind(&done); | 4429 Bind(&done); |
| 4425 | 4430 |
| 4426 Comment("] LoadPropertyFromFastObject"); | 4431 Comment("] LoadPropertyFromFastObject"); |
| 4427 } | 4432 } |
| 4428 | 4433 |
| 4429 void CodeStubAssembler::LoadPropertyFromNameDictionary(Node* dictionary, | 4434 void CodeStubAssembler::LoadPropertyFromNameDictionary(Node* dictionary, |
| 4430 Node* name_index, | 4435 Node* name_index, |
| 4431 Variable* var_details, | 4436 Variable* var_details, |
| 4432 Variable* var_value) { | 4437 Variable* var_value) { |
| 4433 Comment("LoadPropertyFromNameDictionary"); | 4438 Comment("LoadPropertyFromNameDictionary"); |
| 4434 CSA_ASSERT(IsDictionary(dictionary)); | 4439 CSA_ASSERT(this, IsDictionary(dictionary)); |
| 4435 const int name_to_details_offset = | 4440 const int name_to_details_offset = |
| 4436 (NameDictionary::kEntryDetailsIndex - NameDictionary::kEntryKeyIndex) * | 4441 (NameDictionary::kEntryDetailsIndex - NameDictionary::kEntryKeyIndex) * |
| 4437 kPointerSize; | 4442 kPointerSize; |
| 4438 const int name_to_value_offset = | 4443 const int name_to_value_offset = |
| 4439 (NameDictionary::kEntryValueIndex - NameDictionary::kEntryKeyIndex) * | 4444 (NameDictionary::kEntryValueIndex - NameDictionary::kEntryKeyIndex) * |
| 4440 kPointerSize; | 4445 kPointerSize; |
| 4441 | 4446 |
| 4442 Node* details = LoadAndUntagToWord32FixedArrayElement(dictionary, name_index, | 4447 Node* details = LoadAndUntagToWord32FixedArrayElement(dictionary, name_index, |
| 4443 name_to_details_offset); | 4448 name_to_details_offset); |
| 4444 | 4449 |
| 4445 var_details->Bind(details); | 4450 var_details->Bind(details); |
| 4446 var_value->Bind( | 4451 var_value->Bind( |
| 4447 LoadFixedArrayElement(dictionary, name_index, name_to_value_offset)); | 4452 LoadFixedArrayElement(dictionary, name_index, name_to_value_offset)); |
| 4448 | 4453 |
| 4449 Comment("] LoadPropertyFromNameDictionary"); | 4454 Comment("] LoadPropertyFromNameDictionary"); |
| 4450 } | 4455 } |
| 4451 | 4456 |
| 4452 void CodeStubAssembler::LoadPropertyFromGlobalDictionary(Node* dictionary, | 4457 void CodeStubAssembler::LoadPropertyFromGlobalDictionary(Node* dictionary, |
| 4453 Node* name_index, | 4458 Node* name_index, |
| 4454 Variable* var_details, | 4459 Variable* var_details, |
| 4455 Variable* var_value, | 4460 Variable* var_value, |
| 4456 Label* if_deleted) { | 4461 Label* if_deleted) { |
| 4457 Comment("[ LoadPropertyFromGlobalDictionary"); | 4462 Comment("[ LoadPropertyFromGlobalDictionary"); |
| 4458 CSA_ASSERT(IsDictionary(dictionary)); | 4463 CSA_ASSERT(this, IsDictionary(dictionary)); |
| 4459 | 4464 |
| 4460 const int name_to_value_offset = | 4465 const int name_to_value_offset = |
| 4461 (GlobalDictionary::kEntryValueIndex - GlobalDictionary::kEntryKeyIndex) * | 4466 (GlobalDictionary::kEntryValueIndex - GlobalDictionary::kEntryKeyIndex) * |
| 4462 kPointerSize; | 4467 kPointerSize; |
| 4463 | 4468 |
| 4464 Node* property_cell = | 4469 Node* property_cell = |
| 4465 LoadFixedArrayElement(dictionary, name_index, name_to_value_offset); | 4470 LoadFixedArrayElement(dictionary, name_index, name_to_value_offset); |
| 4466 | 4471 |
| 4467 Node* value = LoadObjectField(property_cell, PropertyCell::kValueOffset); | 4472 Node* value = LoadObjectField(property_cell, PropertyCell::kValueOffset); |
| 4468 GotoIf(WordEqual(value, TheHoleConstant()), if_deleted); | 4473 GotoIf(WordEqual(value, TheHoleConstant()), if_deleted); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 4488 | 4493 |
| 4489 Node* kind = DecodeWord32<PropertyDetails::KindField>(details); | 4494 Node* kind = DecodeWord32<PropertyDetails::KindField>(details); |
| 4490 GotoIf(Word32Equal(kind, Int32Constant(kData)), &done); | 4495 GotoIf(Word32Equal(kind, Int32Constant(kData)), &done); |
| 4491 | 4496 |
| 4492 // Accessor case. | 4497 // Accessor case. |
| 4493 { | 4498 { |
| 4494 Node* accessor_pair = value; | 4499 Node* accessor_pair = value; |
| 4495 GotoIf(Word32Equal(LoadInstanceType(accessor_pair), | 4500 GotoIf(Word32Equal(LoadInstanceType(accessor_pair), |
| 4496 Int32Constant(ACCESSOR_INFO_TYPE)), | 4501 Int32Constant(ACCESSOR_INFO_TYPE)), |
| 4497 if_bailout); | 4502 if_bailout); |
| 4498 CSA_ASSERT(HasInstanceType(accessor_pair, ACCESSOR_PAIR_TYPE)); | 4503 CSA_ASSERT(this, HasInstanceType(accessor_pair, ACCESSOR_PAIR_TYPE)); |
| 4499 Node* getter = LoadObjectField(accessor_pair, AccessorPair::kGetterOffset); | 4504 Node* getter = LoadObjectField(accessor_pair, AccessorPair::kGetterOffset); |
| 4500 Node* getter_map = LoadMap(getter); | 4505 Node* getter_map = LoadMap(getter); |
| 4501 Node* instance_type = LoadMapInstanceType(getter_map); | 4506 Node* instance_type = LoadMapInstanceType(getter_map); |
| 4502 // FunctionTemplateInfo getters are not supported yet. | 4507 // FunctionTemplateInfo getters are not supported yet. |
| 4503 GotoIf( | 4508 GotoIf( |
| 4504 Word32Equal(instance_type, Int32Constant(FUNCTION_TEMPLATE_INFO_TYPE)), | 4509 Word32Equal(instance_type, Int32Constant(FUNCTION_TEMPLATE_INFO_TYPE)), |
| 4505 if_bailout); | 4510 if_bailout); |
| 4506 | 4511 |
| 4507 // Return undefined if the {getter} is not callable. | 4512 // Return undefined if the {getter} is not callable. |
| 4508 var_value.Bind(UndefinedConstant()); | 4513 var_value.Bind(UndefinedConstant()); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4643 } | 4648 } |
| 4644 Bind(&if_isdictionary); | 4649 Bind(&if_isdictionary); |
| 4645 { | 4650 { |
| 4646 Variable var_entry(this, MachineType::PointerRepresentation()); | 4651 Variable var_entry(this, MachineType::PointerRepresentation()); |
| 4647 Node* elements = LoadElements(object); | 4652 Node* elements = LoadElements(object); |
| 4648 NumberDictionaryLookup<SeededNumberDictionary>( | 4653 NumberDictionaryLookup<SeededNumberDictionary>( |
| 4649 elements, intptr_index, if_found, &var_entry, if_not_found); | 4654 elements, intptr_index, if_found, &var_entry, if_not_found); |
| 4650 } | 4655 } |
| 4651 Bind(&if_isfaststringwrapper); | 4656 Bind(&if_isfaststringwrapper); |
| 4652 { | 4657 { |
| 4653 CSA_ASSERT(HasInstanceType(object, JS_VALUE_TYPE)); | 4658 CSA_ASSERT(this, HasInstanceType(object, JS_VALUE_TYPE)); |
| 4654 Node* string = LoadJSValueValue(object); | 4659 Node* string = LoadJSValueValue(object); |
| 4655 CSA_ASSERT(IsStringInstanceType(LoadInstanceType(string))); | 4660 CSA_ASSERT(this, IsStringInstanceType(LoadInstanceType(string))); |
| 4656 Node* length = LoadStringLength(string); | 4661 Node* length = LoadStringLength(string); |
| 4657 GotoIf(UintPtrLessThan(intptr_index, SmiUntag(length)), if_found); | 4662 GotoIf(UintPtrLessThan(intptr_index, SmiUntag(length)), if_found); |
| 4658 Goto(&if_isobjectorsmi); | 4663 Goto(&if_isobjectorsmi); |
| 4659 } | 4664 } |
| 4660 Bind(&if_isslowstringwrapper); | 4665 Bind(&if_isslowstringwrapper); |
| 4661 { | 4666 { |
| 4662 CSA_ASSERT(HasInstanceType(object, JS_VALUE_TYPE)); | 4667 CSA_ASSERT(this, HasInstanceType(object, JS_VALUE_TYPE)); |
| 4663 Node* string = LoadJSValueValue(object); | 4668 Node* string = LoadJSValueValue(object); |
| 4664 CSA_ASSERT(IsStringInstanceType(LoadInstanceType(string))); | 4669 CSA_ASSERT(this, IsStringInstanceType(LoadInstanceType(string))); |
| 4665 Node* length = LoadStringLength(string); | 4670 Node* length = LoadStringLength(string); |
| 4666 GotoIf(UintPtrLessThan(intptr_index, SmiUntag(length)), if_found); | 4671 GotoIf(UintPtrLessThan(intptr_index, SmiUntag(length)), if_found); |
| 4667 Goto(&if_isdictionary); | 4672 Goto(&if_isdictionary); |
| 4668 } | 4673 } |
| 4669 Bind(&if_oob); | 4674 Bind(&if_oob); |
| 4670 { | 4675 { |
| 4671 // Positive OOB indices mean "not found", negative indices must be | 4676 // Positive OOB indices mean "not found", negative indices must be |
| 4672 // converted to property names. | 4677 // converted to property names. |
| 4673 GotoIf(IntPtrLessThan(intptr_index, IntPtrConstant(0)), if_bailout); | 4678 GotoIf(IntPtrLessThan(intptr_index, IntPtrConstant(0)), if_bailout); |
| 4674 Goto(if_not_found); | 4679 Goto(if_not_found); |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5127 // The loop falls through if no handler was found. | 5132 // The loop falls through if no handler was found. |
| 5128 Goto(if_miss); | 5133 Goto(if_miss); |
| 5129 } | 5134 } |
| 5130 | 5135 |
| 5131 compiler::Node* CodeStubAssembler::StubCachePrimaryOffset(compiler::Node* name, | 5136 compiler::Node* CodeStubAssembler::StubCachePrimaryOffset(compiler::Node* name, |
| 5132 compiler::Node* map) { | 5137 compiler::Node* map) { |
| 5133 // See v8::internal::StubCache::PrimaryOffset(). | 5138 // See v8::internal::StubCache::PrimaryOffset(). |
| 5134 STATIC_ASSERT(StubCache::kCacheIndexShift == Name::kHashShift); | 5139 STATIC_ASSERT(StubCache::kCacheIndexShift == Name::kHashShift); |
| 5135 // Compute the hash of the name (use entire hash field). | 5140 // Compute the hash of the name (use entire hash field). |
| 5136 Node* hash_field = LoadNameHashField(name); | 5141 Node* hash_field = LoadNameHashField(name); |
| 5137 CSA_ASSERT(Word32Equal( | 5142 CSA_ASSERT(this, |
| 5138 Word32And(hash_field, Int32Constant(Name::kHashNotComputedMask)), | 5143 Word32Equal(Word32And(hash_field, |
| 5139 Int32Constant(0))); | 5144 Int32Constant(Name::kHashNotComputedMask)), |
| 5145 Int32Constant(0))); |
| 5140 | 5146 |
| 5141 // Using only the low bits in 64-bit mode is unlikely to increase the | 5147 // Using only the low bits in 64-bit mode is unlikely to increase the |
| 5142 // risk of collision even if the heap is spread over an area larger than | 5148 // risk of collision even if the heap is spread over an area larger than |
| 5143 // 4Gb (and not at all if it isn't). | 5149 // 4Gb (and not at all if it isn't). |
| 5144 Node* hash = Int32Add(hash_field, map); | 5150 Node* hash = Int32Add(hash_field, map); |
| 5145 // Base the offset on a simple combination of name and map. | 5151 // Base the offset on a simple combination of name and map. |
| 5146 hash = Word32Xor(hash, Int32Constant(StubCache::kPrimaryMagic)); | 5152 hash = Word32Xor(hash, Int32Constant(StubCache::kPrimaryMagic)); |
| 5147 uint32_t mask = (StubCache::kPrimaryTableSize - 1) | 5153 uint32_t mask = (StubCache::kPrimaryTableSize - 1) |
| 5148 << StubCache::kCacheIndexShift; | 5154 << StubCache::kCacheIndexShift; |
| 5149 return ChangeUint32ToWord(Word32And(hash, Int32Constant(mask))); | 5155 return ChangeUint32ToWord(Word32And(hash, Int32Constant(mask))); |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5605 Return(AllocateHeapNumberWithValue(var_double_value.value())); | 5611 Return(AllocateHeapNumberWithValue(var_double_value.value())); |
| 5606 } | 5612 } |
| 5607 | 5613 |
| 5608 Bind(&constant); | 5614 Bind(&constant); |
| 5609 { | 5615 { |
| 5610 Comment("constant_load"); | 5616 Comment("constant_load"); |
| 5611 Node* descriptors = LoadMapDescriptors(LoadMap(holder)); | 5617 Node* descriptors = LoadMapDescriptors(LoadMap(holder)); |
| 5612 Node* descriptor = | 5618 Node* descriptor = |
| 5613 DecodeWord<LoadHandler::DescriptorValueIndexBits>(handler_word); | 5619 DecodeWord<LoadHandler::DescriptorValueIndexBits>(handler_word); |
| 5614 #if defined(DEBUG) | 5620 #if defined(DEBUG) |
| 5615 CSA_ASSERT(UintPtrLessThan( | 5621 CSA_ASSERT( |
| 5616 descriptor, LoadAndUntagFixedArrayBaseLength(descriptors))); | 5622 this, UintPtrLessThan(descriptor, |
| 5623 LoadAndUntagFixedArrayBaseLength(descriptors))); |
| 5617 #endif | 5624 #endif |
| 5618 Node* value = | 5625 Node* value = |
| 5619 LoadFixedArrayElement(descriptors, descriptor, 0, INTPTR_PARAMETERS); | 5626 LoadFixedArrayElement(descriptors, descriptor, 0, INTPTR_PARAMETERS); |
| 5620 | 5627 |
| 5621 Label if_accessor_info(this); | 5628 Label if_accessor_info(this); |
| 5622 GotoIf(IsSetWord<LoadHandler::IsAccessorInfoBits>(handler_word), | 5629 GotoIf(IsSetWord<LoadHandler::IsAccessorInfoBits>(handler_word), |
| 5623 &if_accessor_info); | 5630 &if_accessor_info); |
| 5624 Return(value); | 5631 Return(value); |
| 5625 | 5632 |
| 5626 Bind(&if_accessor_info); | 5633 Bind(&if_accessor_info); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5668 GotoIf(WordEqual(validity_cell, IntPtrConstant(0)), | 5675 GotoIf(WordEqual(validity_cell, IntPtrConstant(0)), |
| 5669 &validity_cell_check_done); | 5676 &validity_cell_check_done); |
| 5670 Node* cell_value = LoadObjectField(validity_cell, Cell::kValueOffset); | 5677 Node* cell_value = LoadObjectField(validity_cell, Cell::kValueOffset); |
| 5671 GotoIf(WordNotEqual(cell_value, | 5678 GotoIf(WordNotEqual(cell_value, |
| 5672 SmiConstant(Smi::FromInt(Map::kPrototypeChainValid))), | 5679 SmiConstant(Smi::FromInt(Map::kPrototypeChainValid))), |
| 5673 miss); | 5680 miss); |
| 5674 Goto(&validity_cell_check_done); | 5681 Goto(&validity_cell_check_done); |
| 5675 | 5682 |
| 5676 Bind(&validity_cell_check_done); | 5683 Bind(&validity_cell_check_done); |
| 5677 Node* smi_handler = LoadObjectField(handler, LoadHandler::kSmiHandlerOffset); | 5684 Node* smi_handler = LoadObjectField(handler, LoadHandler::kSmiHandlerOffset); |
| 5678 CSA_ASSERT(TaggedIsSmi(smi_handler)); | 5685 CSA_ASSERT(this, TaggedIsSmi(smi_handler)); |
| 5679 Node* handler_flags = SmiUntag(smi_handler); | 5686 Node* handler_flags = SmiUntag(smi_handler); |
| 5680 | 5687 |
| 5681 Label check_prototypes(this); | 5688 Label check_prototypes(this); |
| 5682 GotoUnless( | 5689 GotoUnless( |
| 5683 IsSetWord<LoadHandler::DoNegativeLookupOnReceiverBits>(handler_flags), | 5690 IsSetWord<LoadHandler::DoNegativeLookupOnReceiverBits>(handler_flags), |
| 5684 &check_prototypes); | 5691 &check_prototypes); |
| 5685 { | 5692 { |
| 5686 // We have a dictionary receiver, do a negative lookup check. | 5693 // We have a dictionary receiver, do a negative lookup check. |
| 5687 NameDictionaryNegativeLookup(p->receiver, p->name, miss); | 5694 NameDictionaryNegativeLookup(p->receiver, p->name, miss); |
| 5688 Goto(&check_prototypes); | 5695 Goto(&check_prototypes); |
| 5689 } | 5696 } |
| 5690 | 5697 |
| 5691 Bind(&check_prototypes); | 5698 Bind(&check_prototypes); |
| 5692 Node* maybe_holder_cell = | 5699 Node* maybe_holder_cell = |
| 5693 LoadObjectField(handler, LoadHandler::kHolderCellOffset); | 5700 LoadObjectField(handler, LoadHandler::kHolderCellOffset); |
| 5694 Label array_handler(this), tuple_handler(this); | 5701 Label array_handler(this), tuple_handler(this); |
| 5695 Branch(TaggedIsSmi(maybe_holder_cell), &array_handler, &tuple_handler); | 5702 Branch(TaggedIsSmi(maybe_holder_cell), &array_handler, &tuple_handler); |
| 5696 | 5703 |
| 5697 Bind(&tuple_handler); | 5704 Bind(&tuple_handler); |
| 5698 { | 5705 { |
| 5699 Label load_existent(this); | 5706 Label load_existent(this); |
| 5700 GotoIf(WordNotEqual(maybe_holder_cell, NullConstant()), &load_existent); | 5707 GotoIf(WordNotEqual(maybe_holder_cell, NullConstant()), &load_existent); |
| 5701 // This is a handler for a load of a non-existent value. | 5708 // This is a handler for a load of a non-existent value. |
| 5702 Return(UndefinedConstant()); | 5709 Return(UndefinedConstant()); |
| 5703 | 5710 |
| 5704 Bind(&load_existent); | 5711 Bind(&load_existent); |
| 5705 Node* holder = LoadWeakCellValue(maybe_holder_cell); | 5712 Node* holder = LoadWeakCellValue(maybe_holder_cell); |
| 5706 // The |holder| is guaranteed to be alive at this point since we passed | 5713 // The |holder| is guaranteed to be alive at this point since we passed |
| 5707 // both the receiver map check and the validity cell check. | 5714 // both the receiver map check and the validity cell check. |
| 5708 CSA_ASSERT(WordNotEqual(holder, IntPtrConstant(0))); | 5715 CSA_ASSERT(this, WordNotEqual(holder, IntPtrConstant(0))); |
| 5709 | 5716 |
| 5710 var_holder->Bind(holder); | 5717 var_holder->Bind(holder); |
| 5711 var_smi_handler->Bind(smi_handler); | 5718 var_smi_handler->Bind(smi_handler); |
| 5712 Goto(if_smi_handler); | 5719 Goto(if_smi_handler); |
| 5713 } | 5720 } |
| 5714 | 5721 |
| 5715 Bind(&array_handler); | 5722 Bind(&array_handler); |
| 5716 { | 5723 { |
| 5717 Node* length = SmiUntag(maybe_holder_cell); | 5724 Node* length = SmiUntag(maybe_holder_cell); |
| 5718 | 5725 |
| 5719 Variable start_index(this, MachineType::PointerRepresentation()); | 5726 Variable start_index(this, MachineType::PointerRepresentation()); |
| 5720 start_index.Bind(IntPtrConstant(LoadHandler::kFirstPrototypeIndex)); | 5727 start_index.Bind(IntPtrConstant(LoadHandler::kFirstPrototypeIndex)); |
| 5721 | 5728 |
| 5722 Label can_access(this); | 5729 Label can_access(this); |
| 5723 GotoUnless( | 5730 GotoUnless( |
| 5724 IsSetWord<LoadHandler::DoAccessCheckOnReceiverBits>(handler_flags), | 5731 IsSetWord<LoadHandler::DoAccessCheckOnReceiverBits>(handler_flags), |
| 5725 &can_access); | 5732 &can_access); |
| 5726 { | 5733 { |
| 5727 // Skip this entry of a handler. | 5734 // Skip this entry of a handler. |
| 5728 start_index.Bind(IntPtrConstant(LoadHandler::kFirstPrototypeIndex + 1)); | 5735 start_index.Bind(IntPtrConstant(LoadHandler::kFirstPrototypeIndex + 1)); |
| 5729 | 5736 |
| 5730 int offset = | 5737 int offset = |
| 5731 FixedArray::OffsetOfElementAt(LoadHandler::kFirstPrototypeIndex); | 5738 FixedArray::OffsetOfElementAt(LoadHandler::kFirstPrototypeIndex); |
| 5732 Node* expected_native_context = | 5739 Node* expected_native_context = |
| 5733 LoadWeakCellValue(LoadObjectField(handler, offset), miss); | 5740 LoadWeakCellValue(LoadObjectField(handler, offset), miss); |
| 5734 CSA_ASSERT(IsNativeContext(expected_native_context)); | 5741 CSA_ASSERT(this, IsNativeContext(expected_native_context)); |
| 5735 | 5742 |
| 5736 Node* native_context = LoadNativeContext(p->context); | 5743 Node* native_context = LoadNativeContext(p->context); |
| 5737 GotoIf(WordEqual(expected_native_context, native_context), &can_access); | 5744 GotoIf(WordEqual(expected_native_context, native_context), &can_access); |
| 5738 // If the receiver is not a JSGlobalProxy then we miss. | 5745 // If the receiver is not a JSGlobalProxy then we miss. |
| 5739 GotoUnless(IsJSGlobalProxy(p->receiver), miss); | 5746 GotoUnless(IsJSGlobalProxy(p->receiver), miss); |
| 5740 // For JSGlobalProxy receiver try to compare security tokens of current | 5747 // For JSGlobalProxy receiver try to compare security tokens of current |
| 5741 // and expected native contexts. | 5748 // and expected native contexts. |
| 5742 Node* expected_token = LoadContextElement(expected_native_context, | 5749 Node* expected_token = LoadContextElement(expected_native_context, |
| 5743 Context::SECURITY_TOKEN_INDEX); | 5750 Context::SECURITY_TOKEN_INDEX); |
| 5744 Node* current_token = | 5751 Node* current_token = |
| (...skipping 17 matching lines...) Expand all Loading... |
| 5762 Label load_existent(this); | 5769 Label load_existent(this); |
| 5763 GotoIf(WordNotEqual(maybe_holder_cell, NullConstant()), &load_existent); | 5770 GotoIf(WordNotEqual(maybe_holder_cell, NullConstant()), &load_existent); |
| 5764 // This is a handler for a load of a non-existent value. | 5771 // This is a handler for a load of a non-existent value. |
| 5765 Return(UndefinedConstant()); | 5772 Return(UndefinedConstant()); |
| 5766 | 5773 |
| 5767 Bind(&load_existent); | 5774 Bind(&load_existent); |
| 5768 Node* holder = LoadWeakCellValue(maybe_holder_cell); | 5775 Node* holder = LoadWeakCellValue(maybe_holder_cell); |
| 5769 // The |holder| is guaranteed to be alive at this point since we passed | 5776 // The |holder| is guaranteed to be alive at this point since we passed |
| 5770 // the receiver map check, the validity cell check and the prototype chain | 5777 // the receiver map check, the validity cell check and the prototype chain |
| 5771 // check. | 5778 // check. |
| 5772 CSA_ASSERT(WordNotEqual(holder, IntPtrConstant(0))); | 5779 CSA_ASSERT(this, WordNotEqual(holder, IntPtrConstant(0))); |
| 5773 | 5780 |
| 5774 var_holder->Bind(holder); | 5781 var_holder->Bind(holder); |
| 5775 var_smi_handler->Bind(smi_handler); | 5782 var_smi_handler->Bind(smi_handler); |
| 5776 Goto(if_smi_handler); | 5783 Goto(if_smi_handler); |
| 5777 } | 5784 } |
| 5778 } | 5785 } |
| 5779 | 5786 |
| 5780 void CodeStubAssembler::CheckPrototype(Node* prototype_cell, Node* name, | 5787 void CodeStubAssembler::CheckPrototype(Node* prototype_cell, Node* name, |
| 5781 Label* miss) { | 5788 Label* miss) { |
| 5782 Node* maybe_prototype = LoadWeakCellValue(prototype_cell, miss); | 5789 Node* maybe_prototype = LoadWeakCellValue(prototype_cell, miss); |
| 5783 | 5790 |
| 5784 Label done(this); | 5791 Label done(this); |
| 5785 Label if_property_cell(this), if_dictionary_object(this); | 5792 Label if_property_cell(this), if_dictionary_object(this); |
| 5786 | 5793 |
| 5787 // |maybe_prototype| is either a PropertyCell or a slow-mode prototype. | 5794 // |maybe_prototype| is either a PropertyCell or a slow-mode prototype. |
| 5788 Branch(WordEqual(LoadMap(maybe_prototype), | 5795 Branch(WordEqual(LoadMap(maybe_prototype), |
| 5789 LoadRoot(Heap::kGlobalPropertyCellMapRootIndex)), | 5796 LoadRoot(Heap::kGlobalPropertyCellMapRootIndex)), |
| 5790 &if_property_cell, &if_dictionary_object); | 5797 &if_property_cell, &if_dictionary_object); |
| 5791 | 5798 |
| 5792 Bind(&if_dictionary_object); | 5799 Bind(&if_dictionary_object); |
| 5793 { | 5800 { |
| 5794 CSA_ASSERT(IsDictionaryMap(LoadMap(maybe_prototype))); | 5801 CSA_ASSERT(this, IsDictionaryMap(LoadMap(maybe_prototype))); |
| 5795 NameDictionaryNegativeLookup(maybe_prototype, name, miss); | 5802 NameDictionaryNegativeLookup(maybe_prototype, name, miss); |
| 5796 Goto(&done); | 5803 Goto(&done); |
| 5797 } | 5804 } |
| 5798 | 5805 |
| 5799 Bind(&if_property_cell); | 5806 Bind(&if_property_cell); |
| 5800 { | 5807 { |
| 5801 // Ensure the property cell still contains the hole. | 5808 // Ensure the property cell still contains the hole. |
| 5802 Node* value = LoadObjectField(maybe_prototype, PropertyCell::kValueOffset); | 5809 Node* value = LoadObjectField(maybe_prototype, PropertyCell::kValueOffset); |
| 5803 GotoIf(WordNotEqual(value, LoadRoot(Heap::kTheHoleValueRootIndex)), miss); | 5810 GotoIf(WordNotEqual(value, LoadRoot(Heap::kTheHoleValueRootIndex)), miss); |
| 5804 Goto(&done); | 5811 Goto(&done); |
| 5805 } | 5812 } |
| 5806 | 5813 |
| 5807 Bind(&done); | 5814 Bind(&done); |
| 5808 } | 5815 } |
| 5809 | 5816 |
| 5810 void CodeStubAssembler::NameDictionaryNegativeLookup(Node* object, Node* name, | 5817 void CodeStubAssembler::NameDictionaryNegativeLookup(Node* object, Node* name, |
| 5811 Label* miss) { | 5818 Label* miss) { |
| 5812 CSA_ASSERT(IsDictionaryMap(LoadMap(object))); | 5819 CSA_ASSERT(this, IsDictionaryMap(LoadMap(object))); |
| 5813 Node* properties = LoadProperties(object); | 5820 Node* properties = LoadProperties(object); |
| 5814 // Ensure the property does not exist in a dictionary-mode object. | 5821 // Ensure the property does not exist in a dictionary-mode object. |
| 5815 Variable var_name_index(this, MachineType::PointerRepresentation()); | 5822 Variable var_name_index(this, MachineType::PointerRepresentation()); |
| 5816 Label done(this); | 5823 Label done(this); |
| 5817 NameDictionaryLookup<NameDictionary>(properties, name, miss, &var_name_index, | 5824 NameDictionaryLookup<NameDictionary>(properties, name, miss, &var_name_index, |
| 5818 &done); | 5825 &done); |
| 5819 Bind(&done); | 5826 Bind(&done); |
| 5820 } | 5827 } |
| 5821 | 5828 |
| 5822 void CodeStubAssembler::LoadIC(const LoadICParameters* p) { | 5829 void CodeStubAssembler::LoadIC(const LoadICParameters* p) { |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6119 Label if_smi_field(this), if_double_field(this), if_heap_object_field(this), | 6126 Label if_smi_field(this), if_double_field(this), if_heap_object_field(this), |
| 6120 if_tagged_field(this); | 6127 if_tagged_field(this); |
| 6121 | 6128 |
| 6122 GotoIf(WordEqual(field_representation, IntPtrConstant(StoreHandler::kTagged)), | 6129 GotoIf(WordEqual(field_representation, IntPtrConstant(StoreHandler::kTagged)), |
| 6123 &if_tagged_field); | 6130 &if_tagged_field); |
| 6124 GotoIf(WordEqual(field_representation, | 6131 GotoIf(WordEqual(field_representation, |
| 6125 IntPtrConstant(StoreHandler::kHeapObject)), | 6132 IntPtrConstant(StoreHandler::kHeapObject)), |
| 6126 &if_heap_object_field); | 6133 &if_heap_object_field); |
| 6127 GotoIf(WordEqual(field_representation, IntPtrConstant(StoreHandler::kDouble)), | 6134 GotoIf(WordEqual(field_representation, IntPtrConstant(StoreHandler::kDouble)), |
| 6128 &if_double_field); | 6135 &if_double_field); |
| 6129 CSA_ASSERT( | 6136 CSA_ASSERT(this, WordEqual(field_representation, |
| 6130 WordEqual(field_representation, IntPtrConstant(StoreHandler::kSmi))); | 6137 IntPtrConstant(StoreHandler::kSmi))); |
| 6131 Goto(&if_smi_field); | 6138 Goto(&if_smi_field); |
| 6132 | 6139 |
| 6133 Bind(&if_tagged_field); | 6140 Bind(&if_tagged_field); |
| 6134 { | 6141 { |
| 6135 Comment("store tagged field"); | 6142 Comment("store tagged field"); |
| 6136 HandleStoreFieldAndReturn(handler_word, holder, Representation::Tagged(), | 6143 HandleStoreFieldAndReturn(handler_word, holder, Representation::Tagged(), |
| 6137 value, transition_to_field, miss); | 6144 value, transition_to_field, miss); |
| 6138 } | 6145 } |
| 6139 | 6146 |
| 6140 Bind(&if_double_field); | 6147 Bind(&if_double_field); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6325 Comment("KeyedStoreIC_miss"); | 6332 Comment("KeyedStoreIC_miss"); |
| 6326 TailCallRuntime(Runtime::kKeyedStoreIC_Miss, p->context, p->value, p->slot, | 6333 TailCallRuntime(Runtime::kKeyedStoreIC_Miss, p->context, p->value, p->slot, |
| 6327 p->vector, p->receiver, p->name); | 6334 p->vector, p->receiver, p->name); |
| 6328 } | 6335 } |
| 6329 } | 6336 } |
| 6330 | 6337 |
| 6331 void CodeStubAssembler::LoadGlobalIC(const LoadICParameters* p) { | 6338 void CodeStubAssembler::LoadGlobalIC(const LoadICParameters* p) { |
| 6332 Label try_handler(this), miss(this); | 6339 Label try_handler(this), miss(this); |
| 6333 Node* weak_cell = | 6340 Node* weak_cell = |
| 6334 LoadFixedArrayElement(p->vector, p->slot, 0, SMI_PARAMETERS); | 6341 LoadFixedArrayElement(p->vector, p->slot, 0, SMI_PARAMETERS); |
| 6335 CSA_ASSERT(HasInstanceType(weak_cell, WEAK_CELL_TYPE)); | 6342 CSA_ASSERT(this, HasInstanceType(weak_cell, WEAK_CELL_TYPE)); |
| 6336 | 6343 |
| 6337 // Load value or try handler case if the {weak_cell} is cleared. | 6344 // Load value or try handler case if the {weak_cell} is cleared. |
| 6338 Node* property_cell = LoadWeakCellValue(weak_cell, &try_handler); | 6345 Node* property_cell = LoadWeakCellValue(weak_cell, &try_handler); |
| 6339 CSA_ASSERT(HasInstanceType(property_cell, PROPERTY_CELL_TYPE)); | 6346 CSA_ASSERT(this, HasInstanceType(property_cell, PROPERTY_CELL_TYPE)); |
| 6340 | 6347 |
| 6341 Node* value = LoadObjectField(property_cell, PropertyCell::kValueOffset); | 6348 Node* value = LoadObjectField(property_cell, PropertyCell::kValueOffset); |
| 6342 GotoIf(WordEqual(value, TheHoleConstant()), &miss); | 6349 GotoIf(WordEqual(value, TheHoleConstant()), &miss); |
| 6343 Return(value); | 6350 Return(value); |
| 6344 | 6351 |
| 6345 Bind(&try_handler); | 6352 Bind(&try_handler); |
| 6346 { | 6353 { |
| 6347 Node* handler = | 6354 Node* handler = |
| 6348 LoadFixedArrayElement(p->vector, p->slot, kPointerSize, SMI_PARAMETERS); | 6355 LoadFixedArrayElement(p->vector, p->slot, kPointerSize, SMI_PARAMETERS); |
| 6349 GotoIf(WordEqual(handler, LoadRoot(Heap::kuninitialized_symbolRootIndex)), | 6356 GotoIf(WordEqual(handler, LoadRoot(Heap::kuninitialized_symbolRootIndex)), |
| 6350 &miss); | 6357 &miss); |
| 6351 | 6358 |
| 6352 // In this case {handler} must be a Code object. | 6359 // In this case {handler} must be a Code object. |
| 6353 CSA_ASSERT(HasInstanceType(handler, CODE_TYPE)); | 6360 CSA_ASSERT(this, HasInstanceType(handler, CODE_TYPE)); |
| 6354 LoadWithVectorDescriptor descriptor(isolate()); | 6361 LoadWithVectorDescriptor descriptor(isolate()); |
| 6355 Node* native_context = LoadNativeContext(p->context); | 6362 Node* native_context = LoadNativeContext(p->context); |
| 6356 Node* receiver = | 6363 Node* receiver = |
| 6357 LoadContextElement(native_context, Context::EXTENSION_INDEX); | 6364 LoadContextElement(native_context, Context::EXTENSION_INDEX); |
| 6358 Node* fake_name = IntPtrConstant(0); | 6365 Node* fake_name = IntPtrConstant(0); |
| 6359 TailCallStub(descriptor, handler, p->context, receiver, fake_name, p->slot, | 6366 TailCallStub(descriptor, handler, p->context, receiver, fake_name, p->slot, |
| 6360 p->vector); | 6367 p->vector); |
| 6361 } | 6368 } |
| 6362 Bind(&miss); | 6369 Bind(&miss); |
| 6363 { | 6370 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 6375 | 6382 |
| 6376 Node* delta = IntPtrOrSmiConstant(JSObject::kFieldsAdded, mode); | 6383 Node* delta = IntPtrOrSmiConstant(JSObject::kFieldsAdded, mode); |
| 6377 Node* new_capacity = IntPtrAdd(length, delta); | 6384 Node* new_capacity = IntPtrAdd(length, delta); |
| 6378 | 6385 |
| 6379 // Grow properties array. | 6386 // Grow properties array. |
| 6380 ElementsKind kind = FAST_ELEMENTS; | 6387 ElementsKind kind = FAST_ELEMENTS; |
| 6381 DCHECK(kMaxNumberOfDescriptors + JSObject::kFieldsAdded < | 6388 DCHECK(kMaxNumberOfDescriptors + JSObject::kFieldsAdded < |
| 6382 FixedArrayBase::GetMaxLengthForNewSpaceAllocation(kind)); | 6389 FixedArrayBase::GetMaxLengthForNewSpaceAllocation(kind)); |
| 6383 // The size of a new properties backing store is guaranteed to be small | 6390 // The size of a new properties backing store is guaranteed to be small |
| 6384 // enough that the new backing store will be allocated in new space. | 6391 // enough that the new backing store will be allocated in new space. |
| 6385 CSA_ASSERT(UintPtrLessThan( | 6392 CSA_ASSERT(this, UintPtrLessThan(new_capacity, |
| 6386 new_capacity, | 6393 IntPtrConstant(kMaxNumberOfDescriptors + |
| 6387 IntPtrConstant(kMaxNumberOfDescriptors + JSObject::kFieldsAdded))); | 6394 JSObject::kFieldsAdded))); |
| 6388 | 6395 |
| 6389 Node* new_properties = AllocateFixedArray(kind, new_capacity, mode); | 6396 Node* new_properties = AllocateFixedArray(kind, new_capacity, mode); |
| 6390 | 6397 |
| 6391 FillFixedArrayWithValue(kind, new_properties, length, new_capacity, | 6398 FillFixedArrayWithValue(kind, new_properties, length, new_capacity, |
| 6392 Heap::kUndefinedValueRootIndex, mode); | 6399 Heap::kUndefinedValueRootIndex, mode); |
| 6393 | 6400 |
| 6394 // |new_properties| is guaranteed to be in new space, so we can skip | 6401 // |new_properties| is guaranteed to be in new space, so we can skip |
| 6395 // the write barrier. | 6402 // the write barrier. |
| 6396 CopyFixedArrayElements(kind, properties, new_properties, length, | 6403 CopyFixedArrayElements(kind, properties, new_properties, length, |
| 6397 SKIP_WRITE_BARRIER, mode); | 6404 SKIP_WRITE_BARRIER, mode); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6524 Node* adjusted_length = IntPtrSub(elements_length, intptr_two); | 6531 Node* adjusted_length = IntPtrSub(elements_length, intptr_two); |
| 6525 | 6532 |
| 6526 GotoIf(UintPtrGreaterThanOrEqual(key, adjusted_length), &if_unmapped); | 6533 GotoIf(UintPtrGreaterThanOrEqual(key, adjusted_length), &if_unmapped); |
| 6527 | 6534 |
| 6528 Node* mapped_index = LoadFixedArrayElement( | 6535 Node* mapped_index = LoadFixedArrayElement( |
| 6529 elements, IntPtrAdd(key, intptr_two), 0, INTPTR_PARAMETERS); | 6536 elements, IntPtrAdd(key, intptr_two), 0, INTPTR_PARAMETERS); |
| 6530 Branch(WordEqual(mapped_index, TheHoleConstant()), &if_unmapped, &if_mapped); | 6537 Branch(WordEqual(mapped_index, TheHoleConstant()), &if_unmapped, &if_mapped); |
| 6531 | 6538 |
| 6532 Bind(&if_mapped); | 6539 Bind(&if_mapped); |
| 6533 { | 6540 { |
| 6534 CSA_ASSERT(TaggedIsSmi(mapped_index)); | 6541 CSA_ASSERT(this, TaggedIsSmi(mapped_index)); |
| 6535 mapped_index = SmiUntag(mapped_index); | 6542 mapped_index = SmiUntag(mapped_index); |
| 6536 Node* the_context = LoadFixedArrayElement(elements, IntPtrConstant(0), 0, | 6543 Node* the_context = LoadFixedArrayElement(elements, IntPtrConstant(0), 0, |
| 6537 INTPTR_PARAMETERS); | 6544 INTPTR_PARAMETERS); |
| 6538 // Assert that we can use LoadFixedArrayElement/StoreFixedArrayElement | 6545 // Assert that we can use LoadFixedArrayElement/StoreFixedArrayElement |
| 6539 // methods for accessing Context. | 6546 // methods for accessing Context. |
| 6540 STATIC_ASSERT(Context::kHeaderSize == FixedArray::kHeaderSize); | 6547 STATIC_ASSERT(Context::kHeaderSize == FixedArray::kHeaderSize); |
| 6541 DCHECK_EQ(Context::SlotOffset(0) + kHeapObjectTag, | 6548 DCHECK_EQ(Context::SlotOffset(0) + kHeapObjectTag, |
| 6542 FixedArray::OffsetOfElementAt(0)); | 6549 FixedArray::OffsetOfElementAt(0)); |
| 6543 if (is_load) { | 6550 if (is_load) { |
| 6544 Node* result = LoadFixedArrayElement(the_context, mapped_index, 0, | 6551 Node* result = LoadFixedArrayElement(the_context, mapped_index, 0, |
| 6545 INTPTR_PARAMETERS); | 6552 INTPTR_PARAMETERS); |
| 6546 CSA_ASSERT(WordNotEqual(result, TheHoleConstant())); | 6553 CSA_ASSERT(this, WordNotEqual(result, TheHoleConstant())); |
| 6547 var_result.Bind(result); | 6554 var_result.Bind(result); |
| 6548 } else { | 6555 } else { |
| 6549 StoreFixedArrayElement(the_context, mapped_index, value, | 6556 StoreFixedArrayElement(the_context, mapped_index, value, |
| 6550 UPDATE_WRITE_BARRIER, INTPTR_PARAMETERS); | 6557 UPDATE_WRITE_BARRIER, INTPTR_PARAMETERS); |
| 6551 } | 6558 } |
| 6552 Goto(&end); | 6559 Goto(&end); |
| 6553 } | 6560 } |
| 6554 | 6561 |
| 6555 Bind(&if_unmapped); | 6562 Bind(&if_unmapped); |
| 6556 { | 6563 { |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6930 } | 6937 } |
| 6931 Bind(&no_memento_found); | 6938 Bind(&no_memento_found); |
| 6932 Comment("] TrapAllocationMemento"); | 6939 Comment("] TrapAllocationMemento"); |
| 6933 } | 6940 } |
| 6934 | 6941 |
| 6935 Node* CodeStubAssembler::PageFromAddress(Node* address) { | 6942 Node* CodeStubAssembler::PageFromAddress(Node* address) { |
| 6936 return WordAnd(address, IntPtrConstant(~Page::kPageAlignmentMask)); | 6943 return WordAnd(address, IntPtrConstant(~Page::kPageAlignmentMask)); |
| 6937 } | 6944 } |
| 6938 | 6945 |
| 6939 Node* CodeStubAssembler::EnumLength(Node* map) { | 6946 Node* CodeStubAssembler::EnumLength(Node* map) { |
| 6940 CSA_ASSERT(IsMap(map)); | 6947 CSA_ASSERT(this, IsMap(map)); |
| 6941 Node* bitfield_3 = LoadMapBitField3(map); | 6948 Node* bitfield_3 = LoadMapBitField3(map); |
| 6942 Node* enum_length = DecodeWordFromWord32<Map::EnumLengthBits>(bitfield_3); | 6949 Node* enum_length = DecodeWordFromWord32<Map::EnumLengthBits>(bitfield_3); |
| 6943 return SmiTag(enum_length); | 6950 return SmiTag(enum_length); |
| 6944 } | 6951 } |
| 6945 | 6952 |
| 6946 void CodeStubAssembler::CheckEnumCache(Node* receiver, Label* use_cache, | 6953 void CodeStubAssembler::CheckEnumCache(Node* receiver, Label* use_cache, |
| 6947 Label* use_runtime) { | 6954 Label* use_runtime) { |
| 6948 Variable current_js_object(this, MachineRepresentation::kTagged); | 6955 Variable current_js_object(this, MachineRepresentation::kTagged); |
| 6949 current_js_object.Bind(receiver); | 6956 current_js_object.Bind(receiver); |
| 6950 | 6957 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7195 BranchIfSmiLessThan(rhs, lhs, if_true, if_false); | 7202 BranchIfSmiLessThan(rhs, lhs, if_true, if_false); |
| 7196 break; | 7203 break; |
| 7197 case kGreaterThanOrEqual: | 7204 case kGreaterThanOrEqual: |
| 7198 BranchIfSmiLessThanOrEqual(rhs, lhs, if_true, if_false); | 7205 BranchIfSmiLessThanOrEqual(rhs, lhs, if_true, if_false); |
| 7199 break; | 7206 break; |
| 7200 } | 7207 } |
| 7201 } | 7208 } |
| 7202 | 7209 |
| 7203 Bind(&if_rhsisnotsmi); | 7210 Bind(&if_rhsisnotsmi); |
| 7204 { | 7211 { |
| 7205 CSA_ASSERT(WordEqual(LoadMap(rhs), HeapNumberMapConstant())); | 7212 CSA_ASSERT(this, WordEqual(LoadMap(rhs), HeapNumberMapConstant())); |
| 7206 // Convert the {lhs} and {rhs} to floating point values, and | 7213 // Convert the {lhs} and {rhs} to floating point values, and |
| 7207 // perform a floating point comparison. | 7214 // perform a floating point comparison. |
| 7208 var_fcmp_lhs.Bind(SmiToFloat64(lhs)); | 7215 var_fcmp_lhs.Bind(SmiToFloat64(lhs)); |
| 7209 var_fcmp_rhs.Bind(LoadHeapNumberValue(rhs)); | 7216 var_fcmp_rhs.Bind(LoadHeapNumberValue(rhs)); |
| 7210 Goto(&do_fcmp); | 7217 Goto(&do_fcmp); |
| 7211 } | 7218 } |
| 7212 } | 7219 } |
| 7213 | 7220 |
| 7214 Bind(&if_lhsisnotsmi); | 7221 Bind(&if_lhsisnotsmi); |
| 7215 { | 7222 { |
| 7216 CSA_ASSERT(WordEqual(LoadMap(lhs), HeapNumberMapConstant())); | 7223 CSA_ASSERT(this, WordEqual(LoadMap(lhs), HeapNumberMapConstant())); |
| 7217 | 7224 |
| 7218 // Check if {rhs} is a Smi or a HeapObject. | 7225 // Check if {rhs} is a Smi or a HeapObject. |
| 7219 Label if_rhsissmi(this), if_rhsisnotsmi(this); | 7226 Label if_rhsissmi(this), if_rhsisnotsmi(this); |
| 7220 Branch(TaggedIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi); | 7227 Branch(TaggedIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi); |
| 7221 | 7228 |
| 7222 Bind(&if_rhsissmi); | 7229 Bind(&if_rhsissmi); |
| 7223 { | 7230 { |
| 7224 // Convert the {lhs} and {rhs} to floating point values, and | 7231 // Convert the {lhs} and {rhs} to floating point values, and |
| 7225 // perform a floating point comparison. | 7232 // perform a floating point comparison. |
| 7226 var_fcmp_lhs.Bind(LoadHeapNumberValue(lhs)); | 7233 var_fcmp_lhs.Bind(LoadHeapNumberValue(lhs)); |
| 7227 var_fcmp_rhs.Bind(SmiToFloat64(rhs)); | 7234 var_fcmp_rhs.Bind(SmiToFloat64(rhs)); |
| 7228 Goto(&do_fcmp); | 7235 Goto(&do_fcmp); |
| 7229 } | 7236 } |
| 7230 | 7237 |
| 7231 Bind(&if_rhsisnotsmi); | 7238 Bind(&if_rhsisnotsmi); |
| 7232 { | 7239 { |
| 7233 CSA_ASSERT(WordEqual(LoadMap(rhs), HeapNumberMapConstant())); | 7240 CSA_ASSERT(this, WordEqual(LoadMap(rhs), HeapNumberMapConstant())); |
| 7234 | 7241 |
| 7235 // Convert the {lhs} and {rhs} to floating point values, and | 7242 // Convert the {lhs} and {rhs} to floating point values, and |
| 7236 // perform a floating point comparison. | 7243 // perform a floating point comparison. |
| 7237 var_fcmp_lhs.Bind(LoadHeapNumberValue(lhs)); | 7244 var_fcmp_lhs.Bind(LoadHeapNumberValue(lhs)); |
| 7238 var_fcmp_rhs.Bind(LoadHeapNumberValue(rhs)); | 7245 var_fcmp_rhs.Bind(LoadHeapNumberValue(rhs)); |
| 7239 Goto(&do_fcmp); | 7246 Goto(&do_fcmp); |
| 7240 } | 7247 } |
| 7241 } | 7248 } |
| 7242 | 7249 |
| 7243 Bind(&do_fcmp); | 7250 Bind(&do_fcmp); |
| (...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8522 | 8529 |
| 8523 GotoIf(IsStringInstanceType(instance_type), &return_string); | 8530 GotoIf(IsStringInstanceType(instance_type), &return_string); |
| 8524 | 8531 |
| 8525 #define SIMD128_BRANCH(TYPE, Type, type, lane_count, lane_type) \ | 8532 #define SIMD128_BRANCH(TYPE, Type, type, lane_count, lane_type) \ |
| 8526 Label return_##type(this); \ | 8533 Label return_##type(this); \ |
| 8527 Node* type##_map = HeapConstant(factory()->type##_map()); \ | 8534 Node* type##_map = HeapConstant(factory()->type##_map()); \ |
| 8528 GotoIf(WordEqual(map, type##_map), &return_##type); | 8535 GotoIf(WordEqual(map, type##_map), &return_##type); |
| 8529 SIMD128_TYPES(SIMD128_BRANCH) | 8536 SIMD128_TYPES(SIMD128_BRANCH) |
| 8530 #undef SIMD128_BRANCH | 8537 #undef SIMD128_BRANCH |
| 8531 | 8538 |
| 8532 CSA_ASSERT(Word32Equal(instance_type, Int32Constant(SYMBOL_TYPE))); | 8539 CSA_ASSERT(this, Word32Equal(instance_type, Int32Constant(SYMBOL_TYPE))); |
| 8533 result_var.Bind(HeapConstant(isolate()->factory()->symbol_string())); | 8540 result_var.Bind(HeapConstant(isolate()->factory()->symbol_string())); |
| 8534 Goto(&return_result); | 8541 Goto(&return_result); |
| 8535 | 8542 |
| 8536 Bind(&return_number); | 8543 Bind(&return_number); |
| 8537 { | 8544 { |
| 8538 result_var.Bind(HeapConstant(isolate()->factory()->number_string())); | 8545 result_var.Bind(HeapConstant(isolate()->factory()->number_string())); |
| 8539 Goto(&return_result); | 8546 Goto(&return_result); |
| 8540 } | 8547 } |
| 8541 | 8548 |
| 8542 Bind(&if_oddball); | 8549 Bind(&if_oddball); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8640 Bind(&if_overflow); | 8647 Bind(&if_overflow); |
| 8641 { | 8648 { |
| 8642 var_finc_value.Bind(SmiToFloat64(value)); | 8649 var_finc_value.Bind(SmiToFloat64(value)); |
| 8643 Goto(&do_finc); | 8650 Goto(&do_finc); |
| 8644 } | 8651 } |
| 8645 } | 8652 } |
| 8646 | 8653 |
| 8647 Bind(&if_isnotsmi); | 8654 Bind(&if_isnotsmi); |
| 8648 { | 8655 { |
| 8649 // Check if the value is a HeapNumber. | 8656 // Check if the value is a HeapNumber. |
| 8650 CSA_ASSERT(IsHeapNumberMap(LoadMap(value))); | 8657 CSA_ASSERT(this, IsHeapNumberMap(LoadMap(value))); |
| 8651 | 8658 |
| 8652 // Load the HeapNumber value. | 8659 // Load the HeapNumber value. |
| 8653 var_finc_value.Bind(LoadHeapNumberValue(value)); | 8660 var_finc_value.Bind(LoadHeapNumberValue(value)); |
| 8654 Goto(&do_finc); | 8661 Goto(&do_finc); |
| 8655 } | 8662 } |
| 8656 | 8663 |
| 8657 Bind(&do_finc); | 8664 Bind(&do_finc); |
| 8658 { | 8665 { |
| 8659 Node* finc_value = var_finc_value.value(); | 8666 Node* finc_value = var_finc_value.value(); |
| 8660 Node* one = Float64Constant(1.0); | 8667 Node* one = Float64Constant(1.0); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8695 | 8702 |
| 8696 // Slow Array iterator map index: (kBaseIndex + kSlowIteratorOffset) | 8703 // Slow Array iterator map index: (kBaseIndex + kSlowIteratorOffset) |
| 8697 const int kSlowIteratorOffset = | 8704 const int kSlowIteratorOffset = |
| 8698 Context::GENERIC_ARRAY_VALUE_ITERATOR_MAP_INDEX - | 8705 Context::GENERIC_ARRAY_VALUE_ITERATOR_MAP_INDEX - |
| 8699 Context::UINT8_ARRAY_VALUE_ITERATOR_MAP_INDEX; | 8706 Context::UINT8_ARRAY_VALUE_ITERATOR_MAP_INDEX; |
| 8700 STATIC_ASSERT(kSlowIteratorOffset == | 8707 STATIC_ASSERT(kSlowIteratorOffset == |
| 8701 (Context::GENERIC_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX - | 8708 (Context::GENERIC_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX - |
| 8702 Context::UINT8_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX)); | 8709 Context::UINT8_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX)); |
| 8703 | 8710 |
| 8704 // Assert: Type(array) is Object | 8711 // Assert: Type(array) is Object |
| 8705 CSA_ASSERT(IsJSReceiverInstanceType(array_type)); | 8712 CSA_ASSERT(this, IsJSReceiverInstanceType(array_type)); |
| 8706 | 8713 |
| 8707 Variable var_result(this, MachineRepresentation::kTagged); | 8714 Variable var_result(this, MachineRepresentation::kTagged); |
| 8708 Variable var_map_index(this, MachineType::PointerRepresentation()); | 8715 Variable var_map_index(this, MachineType::PointerRepresentation()); |
| 8709 Variable var_array_map(this, MachineRepresentation::kTagged); | 8716 Variable var_array_map(this, MachineRepresentation::kTagged); |
| 8710 | 8717 |
| 8711 Label return_result(this); | 8718 Label return_result(this); |
| 8712 Label allocate_iterator(this); | 8719 Label allocate_iterator(this); |
| 8713 | 8720 |
| 8714 if (mode == IterationKind::kKeys) { | 8721 if (mode == IterationKind::kKeys) { |
| 8715 // There are only two key iterator maps, branch depending on whether or not | 8722 // There are only two key iterator maps, branch depending on whether or not |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8754 Bind(&if_isgeneric); | 8761 Bind(&if_isgeneric); |
| 8755 { | 8762 { |
| 8756 Label if_isfast(this), if_isslow(this); | 8763 Label if_isfast(this), if_isslow(this); |
| 8757 BranchIfFastJSArray(array, context, &if_isfast, &if_isslow); | 8764 BranchIfFastJSArray(array, context, &if_isfast, &if_isslow); |
| 8758 | 8765 |
| 8759 Bind(&if_isfast); | 8766 Bind(&if_isfast); |
| 8760 { | 8767 { |
| 8761 Node* map_index = | 8768 Node* map_index = |
| 8762 IntPtrAdd(IntPtrConstant(kBaseMapIndex + kFastIteratorOffset), | 8769 IntPtrAdd(IntPtrConstant(kBaseMapIndex + kFastIteratorOffset), |
| 8763 LoadMapElementsKind(array_map)); | 8770 LoadMapElementsKind(array_map)); |
| 8764 CSA_ASSERT(IntPtrGreaterThanOrEqual( | 8771 CSA_ASSERT(this, IntPtrGreaterThanOrEqual( |
| 8765 map_index, IntPtrConstant(kBaseMapIndex + kFastIteratorOffset))); | 8772 map_index, IntPtrConstant(kBaseMapIndex + |
| 8766 CSA_ASSERT(IntPtrLessThan( | 8773 kFastIteratorOffset))); |
| 8767 map_index, IntPtrConstant(kBaseMapIndex + kSlowIteratorOffset))); | 8774 CSA_ASSERT(this, IntPtrLessThan(map_index, |
| 8775 IntPtrConstant(kBaseMapIndex + |
| 8776 kSlowIteratorOffset))); |
| 8768 | 8777 |
| 8769 var_map_index.Bind(map_index); | 8778 var_map_index.Bind(map_index); |
| 8770 var_array_map.Bind(array_map); | 8779 var_array_map.Bind(array_map); |
| 8771 Goto(&allocate_iterator); | 8780 Goto(&allocate_iterator); |
| 8772 } | 8781 } |
| 8773 | 8782 |
| 8774 Bind(&if_isslow); | 8783 Bind(&if_isslow); |
| 8775 { | 8784 { |
| 8776 Node* map_index = IntPtrAdd(IntPtrConstant(kBaseMapIndex), | 8785 Node* map_index = IntPtrAdd(IntPtrConstant(kBaseMapIndex), |
| 8777 IntPtrConstant(kSlowIteratorOffset)); | 8786 IntPtrConstant(kSlowIteratorOffset)); |
| 8778 var_map_index.Bind(map_index); | 8787 var_map_index.Bind(map_index); |
| 8779 var_array_map.Bind(UndefinedConstant()); | 8788 var_array_map.Bind(UndefinedConstant()); |
| 8780 Goto(&allocate_iterator); | 8789 Goto(&allocate_iterator); |
| 8781 } | 8790 } |
| 8782 } | 8791 } |
| 8783 | 8792 |
| 8784 Bind(&if_istypedarray); | 8793 Bind(&if_istypedarray); |
| 8785 { | 8794 { |
| 8786 Node* map_index = | 8795 Node* map_index = |
| 8787 IntPtrAdd(IntPtrConstant(kBaseMapIndex - UINT8_ELEMENTS), | 8796 IntPtrAdd(IntPtrConstant(kBaseMapIndex - UINT8_ELEMENTS), |
| 8788 LoadMapElementsKind(array_map)); | 8797 LoadMapElementsKind(array_map)); |
| 8789 CSA_ASSERT(IntPtrLessThan( | |
| 8790 map_index, IntPtrConstant(kBaseMapIndex + kFastIteratorOffset))); | |
| 8791 CSA_ASSERT( | 8798 CSA_ASSERT( |
| 8792 IntPtrGreaterThanOrEqual(map_index, IntPtrConstant(kBaseMapIndex))); | 8799 this, IntPtrLessThan(map_index, IntPtrConstant(kBaseMapIndex + |
| 8800 kFastIteratorOffset))); |
| 8801 CSA_ASSERT(this, IntPtrGreaterThanOrEqual(map_index, |
| 8802 IntPtrConstant(kBaseMapIndex))); |
| 8793 var_map_index.Bind(map_index); | 8803 var_map_index.Bind(map_index); |
| 8794 var_array_map.Bind(UndefinedConstant()); | 8804 var_array_map.Bind(UndefinedConstant()); |
| 8795 Goto(&allocate_iterator); | 8805 Goto(&allocate_iterator); |
| 8796 } | 8806 } |
| 8797 } | 8807 } |
| 8798 | 8808 |
| 8799 Bind(&allocate_iterator); | 8809 Bind(&allocate_iterator); |
| 8800 { | 8810 { |
| 8801 Node* map = | 8811 Node* map = |
| 8802 LoadFixedArrayElement(LoadNativeContext(context), var_map_index.value(), | 8812 LoadFixedArrayElement(LoadNativeContext(context), var_map_index.value(), |
| (...skipping 17 matching lines...) Expand all Loading... |
| 8820 StoreObjectFieldNoWriteBarrier(iterator, | 8830 StoreObjectFieldNoWriteBarrier(iterator, |
| 8821 JSArrayIterator::kIteratedObjectOffset, array); | 8831 JSArrayIterator::kIteratedObjectOffset, array); |
| 8822 StoreObjectFieldNoWriteBarrier(iterator, JSArrayIterator::kNextIndexOffset, | 8832 StoreObjectFieldNoWriteBarrier(iterator, JSArrayIterator::kNextIndexOffset, |
| 8823 SmiConstant(Smi::FromInt(0))); | 8833 SmiConstant(Smi::FromInt(0))); |
| 8824 StoreObjectFieldNoWriteBarrier( | 8834 StoreObjectFieldNoWriteBarrier( |
| 8825 iterator, JSArrayIterator::kIteratedObjectMapOffset, array_map); | 8835 iterator, JSArrayIterator::kIteratedObjectMapOffset, array_map); |
| 8826 return iterator; | 8836 return iterator; |
| 8827 } | 8837 } |
| 8828 | 8838 |
| 8829 compiler::Node* CodeStubAssembler::IsDetachedBuffer(compiler::Node* buffer) { | 8839 compiler::Node* CodeStubAssembler::IsDetachedBuffer(compiler::Node* buffer) { |
| 8830 CSA_ASSERT(HasInstanceType(buffer, JS_ARRAY_BUFFER_TYPE)); | 8840 CSA_ASSERT(this, HasInstanceType(buffer, JS_ARRAY_BUFFER_TYPE)); |
| 8831 | 8841 |
| 8832 Node* buffer_bit_field = LoadObjectField( | 8842 Node* buffer_bit_field = LoadObjectField( |
| 8833 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); | 8843 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); |
| 8834 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); | 8844 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); |
| 8835 | 8845 |
| 8836 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), | 8846 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), |
| 8837 Int32Constant(0)); | 8847 Int32Constant(0)); |
| 8838 } | 8848 } |
| 8839 | 8849 |
| 8840 CodeStubArguments::CodeStubArguments(CodeStubAssembler* assembler, | 8850 CodeStubArguments::CodeStubArguments(CodeStubAssembler* assembler, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8903 } | 8913 } |
| 8904 | 8914 |
| 8905 void CodeStubArguments::PopAndReturn(compiler::Node* value) { | 8915 void CodeStubArguments::PopAndReturn(compiler::Node* value) { |
| 8906 assembler_->PopAndReturn( | 8916 assembler_->PopAndReturn( |
| 8907 assembler_->IntPtrAddFoldConstants(argc_, assembler_->IntPtrConstant(1)), | 8917 assembler_->IntPtrAddFoldConstants(argc_, assembler_->IntPtrConstant(1)), |
| 8908 value); | 8918 value); |
| 8909 } | 8919 } |
| 8910 | 8920 |
| 8911 } // namespace internal | 8921 } // namespace internal |
| 8912 } // namespace v8 | 8922 } // namespace v8 |
| OLD | NEW |