@@ -2231,16 +2231,18 @@ int Map::NumberOfOwnDescriptors() const {
2231
2231
2232
2232
2233
2233
void Map::SetNumberOfOwnDescriptors (int number) {
2234
- DCHECK (number <= instance_descriptors ()->number_of_descriptors ());
2234
+ CHECK_LE (static_cast <unsigned >(number),
2235
+ static_cast <unsigned >(kMaxNumberOfDescriptors ));
2235
2236
set_bit_field3 (NumberOfOwnDescriptorsBits::update (bit_field3 (), number));
2236
2237
}
2237
2238
2238
2239
int Map::EnumLength () const { return EnumLengthBits::decode (bit_field3 ()); }
2239
2240
2240
2241
void Map::SetEnumLength (int length) {
2241
2242
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 ));
2244
2246
}
2245
2247
set_bit_field3 (EnumLengthBits::update (bit_field3 (), length));
2246
2248
}
@@ -3002,9 +3004,9 @@ int Map::instance_size() const {
3002
3004
}
3003
3005
3004
3006
void Map::set_instance_size (int value) {
3005
- DCHECK_EQ (0 , value & (kPointerSize - 1 ));
3007
+ CHECK_EQ (0 , value & (kPointerSize - 1 ));
3006
3008
value >>= kPointerSizeLog2 ;
3007
- DCHECK ( 0 <= value && value < 256 );
3009
+ CHECK_LT ( static_cast < unsigned >( value), 256 );
3008
3010
set_instance_size_in_words (value);
3009
3011
}
3010
3012
@@ -3015,8 +3017,7 @@ int Map::inobject_properties_start_or_constructor_function_index() const {
3015
3017
3016
3018
void Map::set_inobject_properties_start_or_constructor_function_index (
3017
3019
int value) {
3018
- DCHECK_LE (0 , value);
3019
- DCHECK_LT (value, 256 );
3020
+ CHECK_LT (static_cast <unsigned >(value), 256 );
3020
3021
RELAXED_WRITE_BYTE_FIELD (
3021
3022
this , kInObjectPropertiesStartOrConstructorFunctionIndexOffset ,
3022
3023
static_cast <byte>(value));
@@ -3028,7 +3029,7 @@ int Map::GetInObjectPropertiesStartInWords() const {
3028
3029
}
3029
3030
3030
3031
void Map::SetInObjectPropertiesStartInWords (int value) {
3031
- DCHECK (IsJSObjectMap ());
3032
+ CHECK (IsJSObjectMap ());
3032
3033
set_inobject_properties_start_or_constructor_function_index (value);
3033
3034
}
3034
3035
@@ -3044,7 +3045,7 @@ int Map::GetConstructorFunctionIndex() const {
3044
3045
3045
3046
3046
3047
void Map::SetConstructorFunctionIndex (int value) {
3047
- DCHECK (IsPrimitiveMap ());
3048
+ CHECK (IsPrimitiveMap ());
3048
3049
set_inobject_properties_start_or_constructor_function_index (value);
3049
3050
}
3050
3051
@@ -3153,8 +3154,7 @@ int Map::used_or_unused_instance_size_in_words() const {
3153
3154
}
3154
3155
3155
3156
void 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 );
3158
3158
WRITE_BYTE_FIELD (this , kUsedOrUnusedInstanceSizeInWordsOffset ,
3159
3159
static_cast <byte>(value));
3160
3160
}
@@ -3172,12 +3172,12 @@ int Map::UsedInstanceSize() const {
3172
3172
void Map::SetInObjectUnusedPropertyFields (int value) {
3173
3173
STATIC_ASSERT (JSObject::kFieldsAdded == JSObject::kHeaderSize / kPointerSize );
3174
3174
if (!IsJSObjectMap ()) {
3175
- DCHECK_EQ (0 , value);
3175
+ CHECK_EQ (0 , value);
3176
3176
set_used_or_unused_instance_size_in_words (0 );
3177
3177
DCHECK_EQ (0 , UnusedPropertyFields ());
3178
3178
return ;
3179
3179
}
3180
- DCHECK_LE (0 , value);
3180
+ CHECK_LE (0 , value);
3181
3181
DCHECK_LE (value, GetInObjectProperties ());
3182
3182
int used_inobject_properties = GetInObjectProperties () - value;
3183
3183
set_used_or_unused_instance_size_in_words (
@@ -3187,8 +3187,7 @@ void Map::SetInObjectUnusedPropertyFields(int value) {
3187
3187
3188
3188
void Map::SetOutOfObjectUnusedPropertyFields (int value) {
3189
3189
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 );
3192
3191
// For out of object properties "used_instance_size_in_words" byte encodes
3193
3192
// the slack in the property array.
3194
3193
set_used_or_unused_instance_size_in_words (value);
@@ -3227,8 +3226,8 @@ void Map::AccountAddedOutOfObjectPropertyField(int unused_in_property_array) {
3227
3226
if (unused_in_property_array < 0 ) {
3228
3227
unused_in_property_array += JSObject::kFieldsAdded ;
3229
3228
}
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 );
3232
3231
set_used_or_unused_instance_size_in_words (unused_in_property_array);
3233
3232
DCHECK_EQ (unused_in_property_array, UnusedPropertyFields ());
3234
3233
}
@@ -3358,7 +3357,7 @@ bool Map::should_be_fast_prototype_map() const {
3358
3357
}
3359
3358
3360
3359
void 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 );
3362
3361
DCHECK_LE (kElementsKindCount , 1 << Map::ElementsKindBits::kSize );
3363
3362
set_bit_field2 (Map::ElementsKindBits::update (bit_field2 (), elements_kind));
3364
3363
DCHECK (this ->elements_kind () == elements_kind);
@@ -3700,19 +3699,19 @@ Object* Map::prototype_info() const {
3700
3699
3701
3700
3702
3701
void Map::set_prototype_info (Object* value, WriteBarrierMode mode) {
3703
- DCHECK (is_prototype_map ());
3702
+ CHECK (is_prototype_map ());
3704
3703
WRITE_FIELD (this , Map::kTransitionsOrPrototypeInfoOffset , value);
3705
3704
CONDITIONAL_WRITE_BARRIER (
3706
3705
GetHeap (), this , Map::kTransitionsOrPrototypeInfoOffset , value, mode);
3707
3706
}
3708
3707
3709
3708
3710
3709
void 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 ());
3716
3715
set_constructor_or_backpointer (value, mode);
3717
3716
}
3718
3717
@@ -3743,7 +3742,7 @@ FunctionTemplateInfo* Map::GetFunctionTemplateInfo() const {
3743
3742
3744
3743
void Map::SetConstructor (Object* constructor, WriteBarrierMode mode) {
3745
3744
// Never overwrite a back pointer with a constructor.
3746
- DCHECK (!constructor_or_backpointer ()->IsMap ());
3745
+ CHECK (!constructor_or_backpointer ()->IsMap ());
3747
3746
set_constructor_or_backpointer (constructor, mode);
3748
3747
}
3749
3748
0 commit comments