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 4015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4026 } | 4026 } |
4027 } | 4027 } |
4028 | 4028 |
4029 | 4029 |
4030 bool Map::has_non_instance_prototype() { | 4030 bool Map::has_non_instance_prototype() { |
4031 return ((1 << kHasNonInstancePrototype) & bit_field()) != 0; | 4031 return ((1 << kHasNonInstancePrototype) & bit_field()) != 0; |
4032 } | 4032 } |
4033 | 4033 |
4034 | 4034 |
4035 void Map::set_function_with_prototype(bool value) { | 4035 void Map::set_function_with_prototype(bool value) { |
4036 set_bit_field(FunctionWithPrototype::update(bit_field(), value)); | 4036 set_bit_field3(FunctionWithPrototype::update(bit_field3(), value)); |
4037 } | 4037 } |
4038 | 4038 |
4039 | 4039 |
4040 bool Map::function_with_prototype() { | 4040 bool Map::function_with_prototype() { |
4041 return FunctionWithPrototype::decode(bit_field()); | 4041 return FunctionWithPrototype::decode(bit_field3()); |
4042 } | 4042 } |
4043 | 4043 |
4044 | 4044 |
4045 void Map::set_is_access_check_needed(bool access_check_needed) { | 4045 void Map::set_is_access_check_needed(bool access_check_needed) { |
4046 if (access_check_needed) { | 4046 if (access_check_needed) { |
4047 set_bit_field(bit_field() | (1 << kIsAccessCheckNeeded)); | 4047 set_bit_field(bit_field() | (1 << kIsAccessCheckNeeded)); |
4048 } else { | 4048 } else { |
4049 set_bit_field(bit_field() & ~(1 << kIsAccessCheckNeeded)); | 4049 set_bit_field(bit_field() & ~(1 << kIsAccessCheckNeeded)); |
4050 } | 4050 } |
4051 } | 4051 } |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4746 int len = descriptors->number_of_descriptors(); | 4746 int len = descriptors->number_of_descriptors(); |
4747 set_instance_descriptors(descriptors); | 4747 set_instance_descriptors(descriptors); |
4748 SetNumberOfOwnDescriptors(len); | 4748 SetNumberOfOwnDescriptors(len); |
4749 } | 4749 } |
4750 | 4750 |
4751 | 4751 |
4752 ACCESSORS(Map, instance_descriptors, DescriptorArray, kDescriptorsOffset) | 4752 ACCESSORS(Map, instance_descriptors, DescriptorArray, kDescriptorsOffset) |
4753 | 4753 |
4754 | 4754 |
4755 void Map::set_bit_field3(uint32_t bits) { | 4755 void Map::set_bit_field3(uint32_t bits) { |
4756 if (kInt32Size != kPointerSize) { | 4756 // Ensure the upper 2 bits have the same value by sign extending it. This is |
4757 WRITE_UINT32_FIELD(this, kBitField3Offset + kInt32Size, 0); | 4757 // necessary to be able to use the 31st bit. |
4758 } | 4758 int value = bits << 1; |
4759 WRITE_UINT32_FIELD(this, kBitField3Offset, bits); | 4759 WRITE_FIELD(this, kBitField3Offset, Smi::FromInt(value >> 1)); |
4760 } | 4760 } |
4761 | 4761 |
4762 | 4762 |
4763 uint32_t Map::bit_field3() { | 4763 uint32_t Map::bit_field3() { |
4764 return READ_UINT32_FIELD(this, kBitField3Offset); | 4764 Object* value = READ_FIELD(this, kBitField3Offset); |
| 4765 return Smi::cast(value)->value(); |
4765 } | 4766 } |
4766 | 4767 |
4767 | 4768 |
4768 void Map::AppendDescriptor(Descriptor* desc) { | 4769 void Map::AppendDescriptor(Descriptor* desc) { |
4769 DescriptorArray* descriptors = instance_descriptors(); | 4770 DescriptorArray* descriptors = instance_descriptors(); |
4770 int number_of_own_descriptors = NumberOfOwnDescriptors(); | 4771 int number_of_own_descriptors = NumberOfOwnDescriptors(); |
4771 ASSERT(descriptors->number_of_descriptors() == number_of_own_descriptors); | 4772 ASSERT(descriptors->number_of_descriptors() == number_of_own_descriptors); |
4772 descriptors->Append(desc); | 4773 descriptors->Append(desc); |
4773 SetNumberOfOwnDescriptors(number_of_own_descriptors + 1); | 4774 SetNumberOfOwnDescriptors(number_of_own_descriptors + 1); |
4774 } | 4775 } |
(...skipping 2080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6855 #undef READ_SHORT_FIELD | 6856 #undef READ_SHORT_FIELD |
6856 #undef WRITE_SHORT_FIELD | 6857 #undef WRITE_SHORT_FIELD |
6857 #undef READ_BYTE_FIELD | 6858 #undef READ_BYTE_FIELD |
6858 #undef WRITE_BYTE_FIELD | 6859 #undef WRITE_BYTE_FIELD |
6859 #undef NOBARRIER_READ_BYTE_FIELD | 6860 #undef NOBARRIER_READ_BYTE_FIELD |
6860 #undef NOBARRIER_WRITE_BYTE_FIELD | 6861 #undef NOBARRIER_WRITE_BYTE_FIELD |
6861 | 6862 |
6862 } } // namespace v8::internal | 6863 } } // namespace v8::internal |
6863 | 6864 |
6864 #endif // V8_OBJECTS_INL_H_ | 6865 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |