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 3333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3344 | 3344 |
3345 void Map::init_instance_descriptors() { | 3345 void Map::init_instance_descriptors() { |
3346 WRITE_FIELD(this, kInstanceDescriptorsOrBitField3Offset, Smi::FromInt(0)); | 3346 WRITE_FIELD(this, kInstanceDescriptorsOrBitField3Offset, Smi::FromInt(0)); |
3347 } | 3347 } |
3348 | 3348 |
3349 | 3349 |
3350 void Map::clear_instance_descriptors() { | 3350 void Map::clear_instance_descriptors() { |
3351 Object* object = READ_FIELD(this, | 3351 Object* object = READ_FIELD(this, |
3352 kInstanceDescriptorsOrBitField3Offset); | 3352 kInstanceDescriptorsOrBitField3Offset); |
3353 if (!object->IsSmi()) { | 3353 if (!object->IsSmi()) { |
| 3354 #ifdef DEBUG |
| 3355 ZapInstanceDescriptors(); |
| 3356 #endif |
3354 WRITE_FIELD( | 3357 WRITE_FIELD( |
3355 this, | 3358 this, |
3356 kInstanceDescriptorsOrBitField3Offset, | 3359 kInstanceDescriptorsOrBitField3Offset, |
3357 Smi::FromInt(DescriptorArray::cast(object)->bit_field3_storage())); | 3360 Smi::FromInt(DescriptorArray::cast(object)->bit_field3_storage())); |
3358 } | 3361 } |
3359 } | 3362 } |
3360 | 3363 |
3361 | 3364 |
3362 void Map::set_instance_descriptors(DescriptorArray* value, | 3365 void Map::set_instance_descriptors(DescriptorArray* value, |
3363 WriteBarrierMode mode) { | 3366 WriteBarrierMode mode) { |
3364 Object* object = READ_FIELD(this, | 3367 Object* object = READ_FIELD(this, |
3365 kInstanceDescriptorsOrBitField3Offset); | 3368 kInstanceDescriptorsOrBitField3Offset); |
3366 Heap* heap = GetHeap(); | 3369 Heap* heap = GetHeap(); |
3367 if (value == heap->empty_descriptor_array()) { | 3370 if (value == heap->empty_descriptor_array()) { |
3368 clear_instance_descriptors(); | 3371 clear_instance_descriptors(); |
3369 return; | 3372 return; |
3370 } else { | 3373 } else { |
3371 if (object->IsSmi()) { | 3374 if (object->IsSmi()) { |
3372 value->set_bit_field3_storage(Smi::cast(object)->value()); | 3375 value->set_bit_field3_storage(Smi::cast(object)->value()); |
3373 } else { | 3376 } else { |
3374 value->set_bit_field3_storage( | 3377 value->set_bit_field3_storage( |
3375 DescriptorArray::cast(object)->bit_field3_storage()); | 3378 DescriptorArray::cast(object)->bit_field3_storage()); |
3376 } | 3379 } |
3377 } | 3380 } |
3378 ASSERT(!is_shared()); | 3381 ASSERT(!is_shared()); |
| 3382 #ifdef DEBUG |
| 3383 if (value != instance_descriptors()) { |
| 3384 ZapInstanceDescriptors(); |
| 3385 } |
| 3386 #endif |
3379 WRITE_FIELD(this, kInstanceDescriptorsOrBitField3Offset, value); | 3387 WRITE_FIELD(this, kInstanceDescriptorsOrBitField3Offset, value); |
3380 CONDITIONAL_WRITE_BARRIER( | 3388 CONDITIONAL_WRITE_BARRIER( |
3381 heap, this, kInstanceDescriptorsOrBitField3Offset, value, mode); | 3389 heap, this, kInstanceDescriptorsOrBitField3Offset, value, mode); |
3382 } | 3390 } |
3383 | 3391 |
3384 | 3392 |
3385 int Map::bit_field3() { | 3393 int Map::bit_field3() { |
3386 Object* object = READ_FIELD(this, | 3394 Object* object = READ_FIELD(this, |
3387 kInstanceDescriptorsOrBitField3Offset); | 3395 kInstanceDescriptorsOrBitField3Offset); |
3388 if (object->IsSmi()) { | 3396 if (object->IsSmi()) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3441 } else { | 3449 } else { |
3442 return GetHeap()->empty_fixed_array(); | 3450 return GetHeap()->empty_fixed_array(); |
3443 } | 3451 } |
3444 } | 3452 } |
3445 | 3453 |
3446 | 3454 |
3447 void Map::set_prototype_transitions(FixedArray* value, WriteBarrierMode mode) { | 3455 void Map::set_prototype_transitions(FixedArray* value, WriteBarrierMode mode) { |
3448 Heap* heap = GetHeap(); | 3456 Heap* heap = GetHeap(); |
3449 ASSERT(value != heap->empty_fixed_array()); | 3457 ASSERT(value != heap->empty_fixed_array()); |
3450 value->set(kProtoTransitionBackPointerOffset, GetBackPointer()); | 3458 value->set(kProtoTransitionBackPointerOffset, GetBackPointer()); |
| 3459 #ifdef DEBUG |
| 3460 if (value != prototype_transitions()) { |
| 3461 ZapPrototypeTransitions(); |
| 3462 } |
| 3463 #endif |
3451 WRITE_FIELD(this, kPrototypeTransitionsOrBackPointerOffset, value); | 3464 WRITE_FIELD(this, kPrototypeTransitionsOrBackPointerOffset, value); |
3452 CONDITIONAL_WRITE_BARRIER( | 3465 CONDITIONAL_WRITE_BARRIER( |
3453 heap, this, kPrototypeTransitionsOrBackPointerOffset, value, mode); | 3466 heap, this, kPrototypeTransitionsOrBackPointerOffset, value, mode); |
3454 } | 3467 } |
3455 | 3468 |
3456 | 3469 |
3457 void Map::init_prototype_transitions(Object* undefined) { | 3470 void Map::init_prototype_transitions(Object* undefined) { |
3458 ASSERT(undefined->IsUndefined()); | 3471 ASSERT(undefined->IsUndefined()); |
3459 WRITE_FIELD(this, kPrototypeTransitionsOrBackPointerOffset, undefined); | 3472 WRITE_FIELD(this, kPrototypeTransitionsOrBackPointerOffset, undefined); |
3460 } | 3473 } |
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5014 #undef WRITE_UINT32_FIELD | 5027 #undef WRITE_UINT32_FIELD |
5015 #undef READ_SHORT_FIELD | 5028 #undef READ_SHORT_FIELD |
5016 #undef WRITE_SHORT_FIELD | 5029 #undef WRITE_SHORT_FIELD |
5017 #undef READ_BYTE_FIELD | 5030 #undef READ_BYTE_FIELD |
5018 #undef WRITE_BYTE_FIELD | 5031 #undef WRITE_BYTE_FIELD |
5019 | 5032 |
5020 | 5033 |
5021 } } // namespace v8::internal | 5034 } } // namespace v8::internal |
5022 | 5035 |
5023 #endif // V8_OBJECTS_INL_H_ | 5036 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |