@@ -2231,16 +2231,18 @@ int Map::NumberOfOwnDescriptors() const {
22312231
22322232
22332233void Map::SetNumberOfOwnDescriptors (int number) {
2234- DCHECK (number <= instance_descriptors ()->number_of_descriptors ());
2234+ CHECK_LE (static_cast <unsigned >(number),
2235+ static_cast <unsigned >(kMaxNumberOfDescriptors ));
22352236 set_bit_field3 (NumberOfOwnDescriptorsBits::update (bit_field3 (), number));
22362237}
22372238
22382239int Map::EnumLength () const { return EnumLengthBits::decode (bit_field3 ()); }
22392240
22402241void Map::SetEnumLength (int length) {
22412242 if (length != kInvalidEnumCacheSentinel ) {
2242- DCHECK_GE (length, 0 );
2243- DCHECK (length <= NumberOfOwnDescriptors ());
2243+ DCHECK_LE (length, NumberOfOwnDescriptors ());
2244+ CHECK_LE (static_cast <unsigned >(length),
2245+ static_cast <unsigned >(kMaxNumberOfDescriptors ));
22442246 }
22452247 set_bit_field3 (EnumLengthBits::update (bit_field3 (), length));
22462248}
@@ -3002,9 +3004,9 @@ int Map::instance_size() const {
30023004}
30033005
30043006void Map::set_instance_size (int value) {
3005- DCHECK_EQ (0 , value & (kPointerSize - 1 ));
3007+ CHECK_EQ (0 , value & (kPointerSize - 1 ));
30063008 value >>= kPointerSizeLog2 ;
3007- DCHECK ( 0 <= value && value < 256 );
3009+ CHECK_LT ( static_cast < unsigned >( value), 256 );
30083010 set_instance_size_in_words (value);
30093011}
30103012
@@ -3015,8 +3017,7 @@ int Map::inobject_properties_start_or_constructor_function_index() const {
30153017
30163018void Map::set_inobject_properties_start_or_constructor_function_index (
30173019 int value) {
3018- DCHECK_LE (0 , value);
3019- DCHECK_LT (value, 256 );
3020+ CHECK_LT (static_cast <unsigned >(value), 256 );
30203021 RELAXED_WRITE_BYTE_FIELD (
30213022 this , kInObjectPropertiesStartOrConstructorFunctionIndexOffset ,
30223023 static_cast <byte>(value));
@@ -3028,7 +3029,7 @@ int Map::GetInObjectPropertiesStartInWords() const {
30283029}
30293030
30303031void Map::SetInObjectPropertiesStartInWords (int value) {
3031- DCHECK (IsJSObjectMap ());
3032+ CHECK (IsJSObjectMap ());
30323033 set_inobject_properties_start_or_constructor_function_index (value);
30333034}
30343035
@@ -3044,7 +3045,7 @@ int Map::GetConstructorFunctionIndex() const {
30443045
30453046
30463047void Map::SetConstructorFunctionIndex (int value) {
3047- DCHECK (IsPrimitiveMap ());
3048+ CHECK (IsPrimitiveMap ());
30483049 set_inobject_properties_start_or_constructor_function_index (value);
30493050}
30503051
@@ -3153,8 +3154,7 @@ int Map::used_or_unused_instance_size_in_words() const {
31533154}
31543155
31553156void Map::set_used_or_unused_instance_size_in_words (int value) {
3156- DCHECK_LE (0 , value);
3157- DCHECK_LE (value, 255 );
3157+ CHECK_LE (static_cast <unsigned >(value), 255 );
31583158 WRITE_BYTE_FIELD (this , kUsedOrUnusedInstanceSizeInWordsOffset ,
31593159 static_cast <byte>(value));
31603160}
@@ -3172,12 +3172,12 @@ int Map::UsedInstanceSize() const {
31723172void Map::SetInObjectUnusedPropertyFields (int value) {
31733173 STATIC_ASSERT (JSObject::kFieldsAdded == JSObject::kHeaderSize / kPointerSize );
31743174 if (!IsJSObjectMap ()) {
3175- DCHECK_EQ (0 , value);
3175+ CHECK_EQ (0 , value);
31763176 set_used_or_unused_instance_size_in_words (0 );
31773177 DCHECK_EQ (0 , UnusedPropertyFields ());
31783178 return ;
31793179 }
3180- DCHECK_LE (0 , value);
3180+ CHECK_LE (0 , value);
31813181 DCHECK_LE (value, GetInObjectProperties ());
31823182 int used_inobject_properties = GetInObjectProperties () - value;
31833183 set_used_or_unused_instance_size_in_words (
@@ -3187,8 +3187,7 @@ void Map::SetInObjectUnusedPropertyFields(int value) {
31873187
31883188void Map::SetOutOfObjectUnusedPropertyFields (int value) {
31893189 STATIC_ASSERT (JSObject::kFieldsAdded == JSObject::kHeaderSize / kPointerSize );
3190- DCHECK_LE (0 , value);
3191- DCHECK_LT (value, JSObject::kFieldsAdded );
3190+ CHECK_LT (static_cast <unsigned >(value), JSObject::kFieldsAdded );
31923191 // For out of object properties "used_instance_size_in_words" byte encodes
31933192 // the slack in the property array.
31943193 set_used_or_unused_instance_size_in_words (value);
@@ -3227,8 +3226,8 @@ void Map::AccountAddedOutOfObjectPropertyField(int unused_in_property_array) {
32273226 if (unused_in_property_array < 0 ) {
32283227 unused_in_property_array += JSObject::kFieldsAdded ;
32293228 }
3230- DCHECK_GE ( unused_in_property_array, 0 );
3231- DCHECK_LT (unused_in_property_array, JSObject::kFieldsAdded );
3229+ CHECK_LT ( static_cast < unsigned >( unused_in_property_array),
3230+ JSObject::kFieldsAdded );
32323231 set_used_or_unused_instance_size_in_words (unused_in_property_array);
32333232 DCHECK_EQ (unused_in_property_array, UnusedPropertyFields ());
32343233}
@@ -3358,7 +3357,7 @@ bool Map::should_be_fast_prototype_map() const {
33583357}
33593358
33603359void Map::set_elements_kind (ElementsKind elements_kind) {
3361- DCHECK_LT (static_cast <int >(elements_kind), kElementsKindCount );
3360+ CHECK_LT (static_cast <int >(elements_kind), kElementsKindCount );
33623361 DCHECK_LE (kElementsKindCount , 1 << Map::ElementsKindBits::kSize );
33633362 set_bit_field2 (Map::ElementsKindBits::update (bit_field2 (), elements_kind));
33643363 DCHECK (this ->elements_kind () == elements_kind);
@@ -3700,19 +3699,19 @@ Object* Map::prototype_info() const {
37003699
37013700
37023701void Map::set_prototype_info (Object* value, WriteBarrierMode mode) {
3703- DCHECK (is_prototype_map ());
3702+ CHECK (is_prototype_map ());
37043703 WRITE_FIELD (this , Map::kTransitionsOrPrototypeInfoOffset , value);
37053704 CONDITIONAL_WRITE_BARRIER (
37063705 GetHeap (), this , Map::kTransitionsOrPrototypeInfoOffset , value, mode);
37073706}
37083707
37093708
37103709void Map::SetBackPointer (Object* value, WriteBarrierMode mode) {
3711- DCHECK (instance_type () >= FIRST_JS_RECEIVER_TYPE);
3712- DCHECK (value->IsMap ());
3713- DCHECK (GetBackPointer ()->IsUndefined (GetIsolate ()));
3714- DCHECK (! value->IsMap () ||
3715- Map::cast (value)-> GetConstructor () == constructor_or_backpointer ());
3710+ CHECK_GE (instance_type (), FIRST_JS_RECEIVER_TYPE);
3711+ CHECK (value->IsMap ());
3712+ CHECK (GetBackPointer ()->IsUndefined (GetIsolate ()));
3713+ CHECK_IMPLIES ( value->IsMap (), Map::cast (value)-> GetConstructor () ==
3714+ constructor_or_backpointer ());
37163715 set_constructor_or_backpointer (value, mode);
37173716}
37183717
@@ -3743,7 +3742,7 @@ FunctionTemplateInfo* Map::GetFunctionTemplateInfo() const {
37433742
37443743void Map::SetConstructor (Object* constructor, WriteBarrierMode mode) {
37453744 // Never overwrite a back pointer with a constructor.
3746- DCHECK (!constructor_or_backpointer ()->IsMap ());
3745+ CHECK (!constructor_or_backpointer ()->IsMap ());
37473746 set_constructor_or_backpointer (constructor, mode);
37483747}
37493748
0 commit comments