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 3599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3610 set_bit_field3(Deprecated::update(bit_field3(), true)); | 3610 set_bit_field3(Deprecated::update(bit_field3(), true)); |
3611 } | 3611 } |
3612 | 3612 |
3613 | 3613 |
3614 bool Map::is_deprecated() { | 3614 bool Map::is_deprecated() { |
3615 if (!FLAG_track_fields) return false; | 3615 if (!FLAG_track_fields) return false; |
3616 return Deprecated::decode(bit_field3()); | 3616 return Deprecated::decode(bit_field3()); |
3617 } | 3617 } |
3618 | 3618 |
3619 | 3619 |
| 3620 void Map::set_migration_target(bool value) { |
| 3621 set_bit_field3(IsMigrationTarget::update(bit_field3(), value)); |
| 3622 } |
| 3623 |
| 3624 |
| 3625 bool Map::is_migration_target() { |
| 3626 if (!FLAG_track_fields) return false; |
| 3627 return IsMigrationTarget::decode(bit_field3()); |
| 3628 } |
| 3629 |
| 3630 |
3620 void Map::freeze() { | 3631 void Map::freeze() { |
3621 set_bit_field3(IsFrozen::update(bit_field3(), true)); | 3632 set_bit_field3(IsFrozen::update(bit_field3(), true)); |
3622 } | 3633 } |
3623 | 3634 |
3624 | 3635 |
3625 bool Map::is_frozen() { | 3636 bool Map::is_frozen() { |
3626 return IsFrozen::decode(bit_field3()); | 3637 return IsFrozen::decode(bit_field3()); |
3627 } | 3638 } |
3628 | 3639 |
3629 | 3640 |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4208 | 4219 |
4209 | 4220 |
4210 void Map::InitializeDescriptors(DescriptorArray* descriptors) { | 4221 void Map::InitializeDescriptors(DescriptorArray* descriptors) { |
4211 int len = descriptors->number_of_descriptors(); | 4222 int len = descriptors->number_of_descriptors(); |
4212 set_instance_descriptors(descriptors); | 4223 set_instance_descriptors(descriptors); |
4213 SetNumberOfOwnDescriptors(len); | 4224 SetNumberOfOwnDescriptors(len); |
4214 } | 4225 } |
4215 | 4226 |
4216 | 4227 |
4217 ACCESSORS(Map, instance_descriptors, DescriptorArray, kDescriptorsOffset) | 4228 ACCESSORS(Map, instance_descriptors, DescriptorArray, kDescriptorsOffset) |
4218 SMI_ACCESSORS(Map, bit_field3, kBitField3Offset) | 4229 |
| 4230 |
| 4231 void Map::set_bit_field3(uint32_t bits) { |
| 4232 // Ensure the upper 2 bits have the same value by sign extending it. This is |
| 4233 // necessary to be able to use the 31st bit. |
| 4234 int value = bits << 1; |
| 4235 WRITE_FIELD(this, kBitField3Offset, Smi::FromInt(value >> 1)); |
| 4236 } |
| 4237 |
| 4238 |
| 4239 uint32_t Map::bit_field3() { |
| 4240 Object* value = READ_FIELD(this, kBitField3Offset); |
| 4241 return Smi::cast(value)->value(); |
| 4242 } |
4219 | 4243 |
4220 | 4244 |
4221 void Map::ClearTransitions(Heap* heap, WriteBarrierMode mode) { | 4245 void Map::ClearTransitions(Heap* heap, WriteBarrierMode mode) { |
4222 Object* back_pointer = GetBackPointer(); | 4246 Object* back_pointer = GetBackPointer(); |
4223 | 4247 |
4224 if (Heap::ShouldZapGarbage() && HasTransitionArray()) { | 4248 if (Heap::ShouldZapGarbage() && HasTransitionArray()) { |
4225 ZapTransitions(); | 4249 ZapTransitions(); |
4226 } | 4250 } |
4227 | 4251 |
4228 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, back_pointer); | 4252 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, back_pointer); |
(...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6237 #undef WRITE_UINT32_FIELD | 6261 #undef WRITE_UINT32_FIELD |
6238 #undef READ_SHORT_FIELD | 6262 #undef READ_SHORT_FIELD |
6239 #undef WRITE_SHORT_FIELD | 6263 #undef WRITE_SHORT_FIELD |
6240 #undef READ_BYTE_FIELD | 6264 #undef READ_BYTE_FIELD |
6241 #undef WRITE_BYTE_FIELD | 6265 #undef WRITE_BYTE_FIELD |
6242 | 6266 |
6243 | 6267 |
6244 } } // namespace v8::internal | 6268 } } // namespace v8::internal |
6245 | 6269 |
6246 #endif // V8_OBJECTS_INL_H_ | 6270 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |