| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 bool Object::HasValidElements() { | 272 bool Object::HasValidElements() { |
| 273 // Dictionary is covered under FixedArray. | 273 // Dictionary is covered under FixedArray. |
| 274 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray() || | 274 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray() || |
| 275 IsFixedTypedArrayBase(); | 275 IsFixedTypedArrayBase(); |
| 276 } | 276 } |
| 277 | 277 |
| 278 | 278 |
| 279 MaybeObject* Object::AllocateNewStorageFor(Heap* heap, | 279 MaybeObject* Object::AllocateNewStorageFor(Heap* heap, |
| 280 Representation representation) { | 280 Representation representation) { |
| 281 if (FLAG_track_fields && representation.IsSmi() && IsUninitialized()) { | 281 if (representation.IsSmi() && IsUninitialized()) { |
| 282 return Smi::FromInt(0); | 282 return Smi::FromInt(0); |
| 283 } | 283 } |
| 284 if (!FLAG_track_double_fields) return this; | |
| 285 if (!representation.IsDouble()) return this; | 284 if (!representation.IsDouble()) return this; |
| 286 if (IsUninitialized()) { | 285 if (IsUninitialized()) { |
| 287 return heap->AllocateHeapNumber(0); | 286 return heap->AllocateHeapNumber(0); |
| 288 } | 287 } |
| 289 return heap->AllocateHeapNumber(Number()); | 288 return heap->AllocateHeapNumber(Number()); |
| 290 } | 289 } |
| 291 | 290 |
| 292 | 291 |
| 293 StringShape::StringShape(String* str) | 292 StringShape::StringShape(String* str) |
| 294 : type_(str->map()->instance_type()) { | 293 : type_(str->map()->instance_type()) { |
| (...skipping 3683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3978 return ((1 << kAttachedToSharedFunctionInfo) & bit_field2()) != 0; | 3977 return ((1 << kAttachedToSharedFunctionInfo) & bit_field2()) != 0; |
| 3979 } | 3978 } |
| 3980 | 3979 |
| 3981 | 3980 |
| 3982 void Map::set_is_shared(bool value) { | 3981 void Map::set_is_shared(bool value) { |
| 3983 set_bit_field3(IsShared::update(bit_field3(), value)); | 3982 set_bit_field3(IsShared::update(bit_field3(), value)); |
| 3984 } | 3983 } |
| 3985 | 3984 |
| 3986 | 3985 |
| 3987 bool Map::is_shared() { | 3986 bool Map::is_shared() { |
| 3988 return IsShared::decode(bit_field3()); | 3987 return IsShared::decode(bit_field3()); } |
| 3989 } | |
| 3990 | 3988 |
| 3991 | 3989 |
| 3992 void Map::set_dictionary_map(bool value) { | 3990 void Map::set_dictionary_map(bool value) { |
| 3993 uint32_t new_bit_field3 = DictionaryMap::update(bit_field3(), value); | 3991 uint32_t new_bit_field3 = DictionaryMap::update(bit_field3(), value); |
| 3994 new_bit_field3 = IsUnstable::update(new_bit_field3, value); | 3992 new_bit_field3 = IsUnstable::update(new_bit_field3, value); |
| 3995 set_bit_field3(new_bit_field3); | 3993 set_bit_field3(new_bit_field3); |
| 3996 } | 3994 } |
| 3997 | 3995 |
| 3998 | 3996 |
| 3999 bool Map::is_dictionary_map() { | 3997 bool Map::is_dictionary_map() { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 4025 return HasInstanceCallHandler::decode(bit_field3()); | 4023 return HasInstanceCallHandler::decode(bit_field3()); |
| 4026 } | 4024 } |
| 4027 | 4025 |
| 4028 | 4026 |
| 4029 void Map::deprecate() { | 4027 void Map::deprecate() { |
| 4030 set_bit_field3(Deprecated::update(bit_field3(), true)); | 4028 set_bit_field3(Deprecated::update(bit_field3(), true)); |
| 4031 } | 4029 } |
| 4032 | 4030 |
| 4033 | 4031 |
| 4034 bool Map::is_deprecated() { | 4032 bool Map::is_deprecated() { |
| 4035 if (!FLAG_track_fields) return false; | |
| 4036 return Deprecated::decode(bit_field3()); | 4033 return Deprecated::decode(bit_field3()); |
| 4037 } | 4034 } |
| 4038 | 4035 |
| 4039 | 4036 |
| 4040 void Map::set_migration_target(bool value) { | 4037 void Map::set_migration_target(bool value) { |
| 4041 set_bit_field3(IsMigrationTarget::update(bit_field3(), value)); | 4038 set_bit_field3(IsMigrationTarget::update(bit_field3(), value)); |
| 4042 } | 4039 } |
| 4043 | 4040 |
| 4044 | 4041 |
| 4045 bool Map::is_migration_target() { | 4042 bool Map::is_migration_target() { |
| 4046 if (!FLAG_track_fields) return false; | |
| 4047 return IsMigrationTarget::decode(bit_field3()); | 4043 return IsMigrationTarget::decode(bit_field3()); |
| 4048 } | 4044 } |
| 4049 | 4045 |
| 4050 | 4046 |
| 4051 void Map::freeze() { | 4047 void Map::freeze() { |
| 4052 set_bit_field3(IsFrozen::update(bit_field3(), true)); | 4048 set_bit_field3(IsFrozen::update(bit_field3(), true)); |
| 4053 } | 4049 } |
| 4054 | 4050 |
| 4055 | 4051 |
| 4056 bool Map::is_frozen() { | 4052 bool Map::is_frozen() { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4070 | 4066 |
| 4071 bool Map::has_code_cache() { | 4067 bool Map::has_code_cache() { |
| 4072 return code_cache() != GetIsolate()->heap()->empty_fixed_array(); | 4068 return code_cache() != GetIsolate()->heap()->empty_fixed_array(); |
| 4073 } | 4069 } |
| 4074 | 4070 |
| 4075 | 4071 |
| 4076 bool Map::CanBeDeprecated() { | 4072 bool Map::CanBeDeprecated() { |
| 4077 int descriptor = LastAdded(); | 4073 int descriptor = LastAdded(); |
| 4078 for (int i = 0; i <= descriptor; i++) { | 4074 for (int i = 0; i <= descriptor; i++) { |
| 4079 PropertyDetails details = instance_descriptors()->GetDetails(i); | 4075 PropertyDetails details = instance_descriptors()->GetDetails(i); |
| 4080 if (FLAG_track_fields && details.representation().IsNone()) { | 4076 if (details.representation().IsNone()) return true; |
| 4081 return true; | 4077 if (details.representation().IsSmi()) return true; |
| 4082 } | 4078 if (details.representation().IsDouble()) return true; |
| 4083 if (FLAG_track_fields && details.representation().IsSmi()) { | 4079 if (details.representation().IsHeapObject()) return true; |
| 4084 return true; | 4080 if (details.type() == CONSTANT) return true; |
| 4085 } | |
| 4086 if (FLAG_track_double_fields && details.representation().IsDouble()) { | |
| 4087 return true; | |
| 4088 } | |
| 4089 if (FLAG_track_heap_object_fields && | |
| 4090 details.representation().IsHeapObject()) { | |
| 4091 return true; | |
| 4092 } | |
| 4093 if (FLAG_track_fields && details.type() == CONSTANT) { | |
| 4094 return true; | |
| 4095 } | |
| 4096 } | 4081 } |
| 4097 return false; | 4082 return false; |
| 4098 } | 4083 } |
| 4099 | 4084 |
| 4100 | 4085 |
| 4101 void Map::NotifyLeafMapLayoutChange() { | 4086 void Map::NotifyLeafMapLayoutChange() { |
| 4102 if (is_stable()) { | 4087 if (is_stable()) { |
| 4103 mark_unstable(); | 4088 mark_unstable(); |
| 4104 dependent_code()->DeoptimizeDependentCodeGroup( | 4089 dependent_code()->DeoptimizeDependentCodeGroup( |
| 4105 GetIsolate(), | 4090 GetIsolate(), |
| (...skipping 2647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6753 #undef READ_UINT32_FIELD | 6738 #undef READ_UINT32_FIELD |
| 6754 #undef WRITE_UINT32_FIELD | 6739 #undef WRITE_UINT32_FIELD |
| 6755 #undef READ_SHORT_FIELD | 6740 #undef READ_SHORT_FIELD |
| 6756 #undef WRITE_SHORT_FIELD | 6741 #undef WRITE_SHORT_FIELD |
| 6757 #undef READ_BYTE_FIELD | 6742 #undef READ_BYTE_FIELD |
| 6758 #undef WRITE_BYTE_FIELD | 6743 #undef WRITE_BYTE_FIELD |
| 6759 | 6744 |
| 6760 } } // namespace v8::internal | 6745 } } // namespace v8::internal |
| 6761 | 6746 |
| 6762 #endif // V8_OBJECTS_INL_H_ | 6747 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |