OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
(...skipping 4547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4558 int Map::unused_property_fields() { | 4558 int Map::unused_property_fields() { |
4559 return READ_BYTE_FIELD(this, kUnusedPropertyFieldsOffset); | 4559 return READ_BYTE_FIELD(this, kUnusedPropertyFieldsOffset); |
4560 } | 4560 } |
4561 | 4561 |
4562 | 4562 |
4563 void Map::set_unused_property_fields(int value) { | 4563 void Map::set_unused_property_fields(int value) { |
4564 WRITE_BYTE_FIELD(this, kUnusedPropertyFieldsOffset, Min(value, 255)); | 4564 WRITE_BYTE_FIELD(this, kUnusedPropertyFieldsOffset, Min(value, 255)); |
4565 } | 4565 } |
4566 | 4566 |
4567 | 4567 |
4568 byte Map::bit_field() { | 4568 byte Map::bit_field() const { return READ_BYTE_FIELD(this, kBitFieldOffset); } |
4569 return READ_BYTE_FIELD(this, kBitFieldOffset); | |
4570 } | |
4571 | 4569 |
4572 | 4570 |
4573 void Map::set_bit_field(byte value) { | 4571 void Map::set_bit_field(byte value) { |
4574 WRITE_BYTE_FIELD(this, kBitFieldOffset, value); | 4572 WRITE_BYTE_FIELD(this, kBitFieldOffset, value); |
4575 } | 4573 } |
4576 | 4574 |
4577 | 4575 |
4578 byte Map::bit_field2() { | 4576 byte Map::bit_field2() const { return READ_BYTE_FIELD(this, kBitField2Offset); } |
4579 return READ_BYTE_FIELD(this, kBitField2Offset); | |
4580 } | |
4581 | 4577 |
4582 | 4578 |
4583 void Map::set_bit_field2(byte value) { | 4579 void Map::set_bit_field2(byte value) { |
4584 WRITE_BYTE_FIELD(this, kBitField2Offset, value); | 4580 WRITE_BYTE_FIELD(this, kBitField2Offset, value); |
4585 } | 4581 } |
4586 | 4582 |
4587 | 4583 |
4588 void Map::set_non_instance_prototype(bool value) { | 4584 void Map::set_non_instance_prototype(bool value) { |
4589 if (value) { | 4585 if (value) { |
4590 set_bit_field(bit_field() | (1 << kHasNonInstancePrototype)); | 4586 set_bit_field(bit_field() | (1 << kHasNonInstancePrototype)); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4633 | 4629 |
4634 bool Map::is_extensible() { | 4630 bool Map::is_extensible() { |
4635 return ((1 << kIsExtensible) & bit_field2()) != 0; | 4631 return ((1 << kIsExtensible) & bit_field2()) != 0; |
4636 } | 4632 } |
4637 | 4633 |
4638 | 4634 |
4639 void Map::set_is_prototype_map(bool value) { | 4635 void Map::set_is_prototype_map(bool value) { |
4640 set_bit_field2(IsPrototypeMapBits::update(bit_field2(), value)); | 4636 set_bit_field2(IsPrototypeMapBits::update(bit_field2(), value)); |
4641 } | 4637 } |
4642 | 4638 |
4643 bool Map::is_prototype_map() { | 4639 bool Map::is_prototype_map() const { |
4644 return IsPrototypeMapBits::decode(bit_field2()); | 4640 return IsPrototypeMapBits::decode(bit_field2()); |
4645 } | 4641 } |
4646 | 4642 |
4647 | 4643 |
4648 void Map::set_dictionary_map(bool value) { | 4644 void Map::set_dictionary_map(bool value) { |
4649 uint32_t new_bit_field3 = DictionaryMap::update(bit_field3(), value); | 4645 uint32_t new_bit_field3 = DictionaryMap::update(bit_field3(), value); |
4650 new_bit_field3 = IsUnstable::update(new_bit_field3, value); | 4646 new_bit_field3 = IsUnstable::update(new_bit_field3, value); |
4651 set_bit_field3(new_bit_field3); | 4647 set_bit_field3(new_bit_field3); |
4652 } | 4648 } |
4653 | 4649 |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5327 | 5323 |
5328 | 5324 |
5329 void Map::set_bit_field3(uint32_t bits) { | 5325 void Map::set_bit_field3(uint32_t bits) { |
5330 if (kInt32Size != kPointerSize) { | 5326 if (kInt32Size != kPointerSize) { |
5331 WRITE_UINT32_FIELD(this, kBitField3Offset + kInt32Size, 0); | 5327 WRITE_UINT32_FIELD(this, kBitField3Offset + kInt32Size, 0); |
5332 } | 5328 } |
5333 WRITE_UINT32_FIELD(this, kBitField3Offset, bits); | 5329 WRITE_UINT32_FIELD(this, kBitField3Offset, bits); |
5334 } | 5330 } |
5335 | 5331 |
5336 | 5332 |
5337 uint32_t Map::bit_field3() { | 5333 uint32_t Map::bit_field3() const { |
5338 return READ_UINT32_FIELD(this, kBitField3Offset); | 5334 return READ_UINT32_FIELD(this, kBitField3Offset); |
5339 } | 5335 } |
5340 | 5336 |
5341 | 5337 |
5342 LayoutDescriptor* Map::GetLayoutDescriptor() { | 5338 LayoutDescriptor* Map::GetLayoutDescriptor() { |
5343 return FLAG_unbox_double_fields ? layout_descriptor() | 5339 return FLAG_unbox_double_fields ? layout_descriptor() |
5344 : LayoutDescriptor::FastPointerLayout(); | 5340 : LayoutDescriptor::FastPointerLayout(); |
5345 } | 5341 } |
5346 | 5342 |
5347 | 5343 |
(...skipping 21 matching lines...) Expand all Loading... |
5369 return GetIsolate()->heap()->undefined_value(); | 5365 return GetIsolate()->heap()->undefined_value(); |
5370 } | 5366 } |
5371 | 5367 |
5372 | 5368 |
5373 Map* Map::ElementsTransitionMap() { | 5369 Map* Map::ElementsTransitionMap() { |
5374 return TransitionArray::SearchSpecial( | 5370 return TransitionArray::SearchSpecial( |
5375 this, GetHeap()->elements_transition_symbol()); | 5371 this, GetHeap()->elements_transition_symbol()); |
5376 } | 5372 } |
5377 | 5373 |
5378 | 5374 |
5379 ACCESSORS(Map, raw_transitions, Object, kTransitionsOffset) | 5375 ACCESSORS(Map, raw_transitions, Object, kTransitionsOrPrototypeInfoOffset) |
| 5376 |
| 5377 |
| 5378 Object* Map::prototype_info() const { |
| 5379 DCHECK(is_prototype_map()); |
| 5380 return READ_FIELD(this, Map::kTransitionsOrPrototypeInfoOffset); |
| 5381 } |
| 5382 |
| 5383 |
| 5384 void Map::set_prototype_info(Object* value, WriteBarrierMode mode) { |
| 5385 DCHECK(is_prototype_map()); |
| 5386 WRITE_FIELD(this, Map::kTransitionsOrPrototypeInfoOffset, value); |
| 5387 CONDITIONAL_WRITE_BARRIER( |
| 5388 GetHeap(), this, Map::kTransitionsOrPrototypeInfoOffset, value, mode); |
| 5389 } |
5380 | 5390 |
5381 | 5391 |
5382 void Map::SetBackPointer(Object* value, WriteBarrierMode mode) { | 5392 void Map::SetBackPointer(Object* value, WriteBarrierMode mode) { |
5383 DCHECK(instance_type() >= FIRST_JS_RECEIVER_TYPE); | 5393 DCHECK(instance_type() >= FIRST_JS_RECEIVER_TYPE); |
5384 DCHECK((value->IsUndefined() && GetBackPointer()->IsMap()) || | 5394 DCHECK((value->IsUndefined() && GetBackPointer()->IsMap()) || |
5385 (value->IsMap() && GetBackPointer()->IsUndefined())); | 5395 (value->IsMap() && GetBackPointer()->IsUndefined())); |
5386 DCHECK(!value->IsMap() || | 5396 DCHECK(!value->IsMap() || |
5387 Map::cast(value)->GetConstructor() == constructor_or_backpointer()); | 5397 Map::cast(value)->GetConstructor() == constructor_or_backpointer()); |
5388 set_constructor_or_backpointer(value, mode); | 5398 set_constructor_or_backpointer(value, mode); |
5389 } | 5399 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5429 ACCESSORS_TO_SMI(AccessorInfo, flag, kFlagOffset) | 5439 ACCESSORS_TO_SMI(AccessorInfo, flag, kFlagOffset) |
5430 ACCESSORS(AccessorInfo, expected_receiver_type, Object, | 5440 ACCESSORS(AccessorInfo, expected_receiver_type, Object, |
5431 kExpectedReceiverTypeOffset) | 5441 kExpectedReceiverTypeOffset) |
5432 | 5442 |
5433 ACCESSORS(ExecutableAccessorInfo, getter, Object, kGetterOffset) | 5443 ACCESSORS(ExecutableAccessorInfo, getter, Object, kGetterOffset) |
5434 ACCESSORS(ExecutableAccessorInfo, setter, Object, kSetterOffset) | 5444 ACCESSORS(ExecutableAccessorInfo, setter, Object, kSetterOffset) |
5435 ACCESSORS(ExecutableAccessorInfo, data, Object, kDataOffset) | 5445 ACCESSORS(ExecutableAccessorInfo, data, Object, kDataOffset) |
5436 | 5446 |
5437 ACCESSORS(Box, value, Object, kValueOffset) | 5447 ACCESSORS(Box, value, Object, kValueOffset) |
5438 | 5448 |
| 5449 ACCESSORS(PrototypeInfo, prototype_users, Object, kPrototypeUsersOffset) |
| 5450 ACCESSORS(PrototypeInfo, validity_cell, Object, kValidityCellOffset) |
| 5451 |
5439 ACCESSORS(AccessorPair, getter, Object, kGetterOffset) | 5452 ACCESSORS(AccessorPair, getter, Object, kGetterOffset) |
5440 ACCESSORS(AccessorPair, setter, Object, kSetterOffset) | 5453 ACCESSORS(AccessorPair, setter, Object, kSetterOffset) |
5441 | 5454 |
5442 ACCESSORS(AccessCheckInfo, named_callback, Object, kNamedCallbackOffset) | 5455 ACCESSORS(AccessCheckInfo, named_callback, Object, kNamedCallbackOffset) |
5443 ACCESSORS(AccessCheckInfo, indexed_callback, Object, kIndexedCallbackOffset) | 5456 ACCESSORS(AccessCheckInfo, indexed_callback, Object, kIndexedCallbackOffset) |
5444 ACCESSORS(AccessCheckInfo, data, Object, kDataOffset) | 5457 ACCESSORS(AccessCheckInfo, data, Object, kDataOffset) |
5445 | 5458 |
5446 ACCESSORS(InterceptorInfo, getter, Object, kGetterOffset) | 5459 ACCESSORS(InterceptorInfo, getter, Object, kGetterOffset) |
5447 ACCESSORS(InterceptorInfo, setter, Object, kSetterOffset) | 5460 ACCESSORS(InterceptorInfo, setter, Object, kSetterOffset) |
5448 ACCESSORS(InterceptorInfo, query, Object, kQueryOffset) | 5461 ACCESSORS(InterceptorInfo, query, Object, kQueryOffset) |
(...skipping 2053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7502 #undef READ_SHORT_FIELD | 7515 #undef READ_SHORT_FIELD |
7503 #undef WRITE_SHORT_FIELD | 7516 #undef WRITE_SHORT_FIELD |
7504 #undef READ_BYTE_FIELD | 7517 #undef READ_BYTE_FIELD |
7505 #undef WRITE_BYTE_FIELD | 7518 #undef WRITE_BYTE_FIELD |
7506 #undef NOBARRIER_READ_BYTE_FIELD | 7519 #undef NOBARRIER_READ_BYTE_FIELD |
7507 #undef NOBARRIER_WRITE_BYTE_FIELD | 7520 #undef NOBARRIER_WRITE_BYTE_FIELD |
7508 | 7521 |
7509 } } // namespace v8::internal | 7522 } } // namespace v8::internal |
7510 | 7523 |
7511 #endif // V8_OBJECTS_INL_H_ | 7524 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |