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 4271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4282 WRITE_FIELD(this, kBitField3Offset, Smi::FromInt(value >> 1)); | 4282 WRITE_FIELD(this, kBitField3Offset, Smi::FromInt(value >> 1)); |
4283 } | 4283 } |
4284 | 4284 |
4285 | 4285 |
4286 uint32_t Map::bit_field3() { | 4286 uint32_t Map::bit_field3() { |
4287 Object* value = READ_FIELD(this, kBitField3Offset); | 4287 Object* value = READ_FIELD(this, kBitField3Offset); |
4288 return Smi::cast(value)->value(); | 4288 return Smi::cast(value)->value(); |
4289 } | 4289 } |
4290 | 4290 |
4291 | 4291 |
4292 void Map::set_bit_field4(uint32_t bits) { | |
4293 // Ensure the upper 2 bits have the same value by sign extending it. This is | |
4294 // necessary to be able to use the 31st bit. | |
Toon Verwaest
2013/11/04 17:52:46
This trick isn't really necessary if you aren't us
Hannes Payer (out of office)
2013/11/20 10:36:47
The bit field 3 got cleaned up in the meantime. No
| |
4295 int value = bits << 1; | |
4296 WRITE_FIELD(this, kBitField4Offset, Smi::FromInt(value >> 1)); | |
4297 } | |
4298 | |
4299 | |
4300 uint32_t Map::bit_field4() { | |
4301 Object* value = READ_FIELD(this, kBitField4Offset); | |
4302 return Smi::cast(value)->value(); | |
4303 } | |
4304 | |
4305 | |
4306 void Map::set_has_migrated(bool value) { | |
4307 set_bit_field4(HasMigrated::update(bit_field4(), value)); | |
4308 } | |
4309 | |
4310 | |
4311 bool Map::has_migrated() { | |
4312 return HasMigrated::decode(bit_field4()); | |
4313 } | |
4314 | |
4315 | |
4292 void Map::ClearTransitions(Heap* heap, WriteBarrierMode mode) { | 4316 void Map::ClearTransitions(Heap* heap, WriteBarrierMode mode) { |
4293 Object* back_pointer = GetBackPointer(); | 4317 Object* back_pointer = GetBackPointer(); |
4294 | 4318 |
4295 if (Heap::ShouldZapGarbage() && HasTransitionArray()) { | 4319 if (Heap::ShouldZapGarbage() && HasTransitionArray()) { |
4296 ZapTransitions(); | 4320 ZapTransitions(); |
4297 } | 4321 } |
4298 | 4322 |
4299 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, back_pointer); | 4323 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, back_pointer); |
4300 CONDITIONAL_WRITE_BARRIER( | 4324 CONDITIONAL_WRITE_BARRIER( |
4301 heap, this, kTransitionsOrBackPointerOffset, back_pointer, mode); | 4325 heap, this, kTransitionsOrBackPointerOffset, back_pointer, mode); |
(...skipping 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6400 #undef WRITE_UINT32_FIELD | 6424 #undef WRITE_UINT32_FIELD |
6401 #undef READ_SHORT_FIELD | 6425 #undef READ_SHORT_FIELD |
6402 #undef WRITE_SHORT_FIELD | 6426 #undef WRITE_SHORT_FIELD |
6403 #undef READ_BYTE_FIELD | 6427 #undef READ_BYTE_FIELD |
6404 #undef WRITE_BYTE_FIELD | 6428 #undef WRITE_BYTE_FIELD |
6405 | 6429 |
6406 | 6430 |
6407 } } // namespace v8::internal | 6431 } } // namespace v8::internal |
6408 | 6432 |
6409 #endif // V8_OBJECTS_INL_H_ | 6433 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |