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 | |
3631 void Map::freeze() { | 3620 void Map::freeze() { |
3632 set_bit_field3(IsFrozen::update(bit_field3(), true)); | 3621 set_bit_field3(IsFrozen::update(bit_field3(), true)); |
3633 } | 3622 } |
3634 | 3623 |
3635 | 3624 |
3636 bool Map::is_frozen() { | 3625 bool Map::is_frozen() { |
3637 return IsFrozen::decode(bit_field3()); | 3626 return IsFrozen::decode(bit_field3()); |
3638 } | 3627 } |
3639 | 3628 |
3640 | 3629 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3681 void Map::NotifyLeafMapLayoutChange() { | 3670 void Map::NotifyLeafMapLayoutChange() { |
3682 if (is_stable()) { | 3671 if (is_stable()) { |
3683 mark_unstable(); | 3672 mark_unstable(); |
3684 dependent_code()->DeoptimizeDependentCodeGroup( | 3673 dependent_code()->DeoptimizeDependentCodeGroup( |
3685 GetIsolate(), | 3674 GetIsolate(), |
3686 DependentCode::kPrototypeCheckGroup); | 3675 DependentCode::kPrototypeCheckGroup); |
3687 } | 3676 } |
3688 } | 3677 } |
3689 | 3678 |
3690 | 3679 |
| 3680 bool Map::CanOmitPrototypeChecks() { |
| 3681 return is_stable() && FLAG_omit_prototype_checks_for_leaf_maps; |
| 3682 } |
| 3683 |
| 3684 |
3691 bool Map::CanOmitMapChecks() { | 3685 bool Map::CanOmitMapChecks() { |
3692 return is_stable() && FLAG_omit_map_checks_for_leaf_maps; | 3686 return is_stable() && FLAG_omit_map_checks_for_leaf_maps; |
3693 } | 3687 } |
3694 | 3688 |
3695 | 3689 |
3696 int DependentCode::number_of_entries(DependencyGroup group) { | 3690 int DependentCode::number_of_entries(DependencyGroup group) { |
3697 if (length() == 0) return 0; | 3691 if (length() == 0) return 0; |
3698 return Smi::cast(get(group))->value(); | 3692 return Smi::cast(get(group))->value(); |
3699 } | 3693 } |
3700 | 3694 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3815 | 3809 |
3816 inline void Code::set_is_crankshafted(bool value) { | 3810 inline void Code::set_is_crankshafted(bool value) { |
3817 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 3811 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); |
3818 int updated = IsCrankshaftedField::update(previous, value); | 3812 int updated = IsCrankshaftedField::update(previous, value); |
3819 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 3813 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); |
3820 } | 3814 } |
3821 | 3815 |
3822 | 3816 |
3823 int Code::major_key() { | 3817 int Code::major_key() { |
3824 ASSERT(kind() == STUB || | 3818 ASSERT(kind() == STUB || |
| 3819 kind() == UNARY_OP_IC || |
3825 kind() == BINARY_OP_IC || | 3820 kind() == BINARY_OP_IC || |
3826 kind() == COMPARE_IC || | 3821 kind() == COMPARE_IC || |
3827 kind() == COMPARE_NIL_IC || | 3822 kind() == COMPARE_NIL_IC || |
3828 kind() == STORE_IC || | 3823 kind() == STORE_IC || |
3829 kind() == LOAD_IC || | 3824 kind() == LOAD_IC || |
3830 kind() == KEYED_LOAD_IC || | 3825 kind() == KEYED_LOAD_IC || |
3831 kind() == TO_BOOLEAN_IC); | 3826 kind() == TO_BOOLEAN_IC); |
3832 return StubMajorKeyField::decode( | 3827 return StubMajorKeyField::decode( |
3833 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); | 3828 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); |
3834 } | 3829 } |
3835 | 3830 |
3836 | 3831 |
3837 void Code::set_major_key(int major) { | 3832 void Code::set_major_key(int major) { |
3838 ASSERT(kind() == STUB || | 3833 ASSERT(kind() == STUB || |
| 3834 kind() == UNARY_OP_IC || |
3839 kind() == BINARY_OP_IC || | 3835 kind() == BINARY_OP_IC || |
3840 kind() == COMPARE_IC || | 3836 kind() == COMPARE_IC || |
3841 kind() == COMPARE_NIL_IC || | 3837 kind() == COMPARE_NIL_IC || |
3842 kind() == LOAD_IC || | 3838 kind() == LOAD_IC || |
3843 kind() == KEYED_LOAD_IC || | 3839 kind() == KEYED_LOAD_IC || |
3844 kind() == STORE_IC || | 3840 kind() == STORE_IC || |
3845 kind() == KEYED_STORE_IC || | 3841 kind() == KEYED_STORE_IC || |
3846 kind() == TO_BOOLEAN_IC); | 3842 kind() == TO_BOOLEAN_IC); |
3847 ASSERT(0 <= major && major < 256); | 3843 ASSERT(0 <= major && major < 256); |
3848 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 3844 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4018 return static_cast<CheckType>(type); | 4014 return static_cast<CheckType>(type); |
4019 } | 4015 } |
4020 | 4016 |
4021 | 4017 |
4022 void Code::set_check_type(CheckType value) { | 4018 void Code::set_check_type(CheckType value) { |
4023 ASSERT(is_call_stub() || is_keyed_call_stub()); | 4019 ASSERT(is_call_stub() || is_keyed_call_stub()); |
4024 WRITE_BYTE_FIELD(this, kCheckTypeOffset, value); | 4020 WRITE_BYTE_FIELD(this, kCheckTypeOffset, value); |
4025 } | 4021 } |
4026 | 4022 |
4027 | 4023 |
| 4024 byte Code::unary_op_type() { |
| 4025 ASSERT(is_unary_op_stub()); |
| 4026 return UnaryOpTypeField::decode( |
| 4027 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); |
| 4028 } |
| 4029 |
| 4030 |
| 4031 void Code::set_unary_op_type(byte value) { |
| 4032 ASSERT(is_unary_op_stub()); |
| 4033 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset); |
| 4034 int updated = UnaryOpTypeField::update(previous, value); |
| 4035 WRITE_UINT32_FIELD(this, kKindSpecificFlags1Offset, updated); |
| 4036 } |
| 4037 |
| 4038 |
4028 byte Code::to_boolean_state() { | 4039 byte Code::to_boolean_state() { |
4029 return extended_extra_ic_state(); | 4040 return extended_extra_ic_state(); |
4030 } | 4041 } |
4031 | 4042 |
4032 | 4043 |
4033 bool Code::has_function_cache() { | 4044 bool Code::has_function_cache() { |
4034 ASSERT(kind() == STUB); | 4045 ASSERT(kind() == STUB); |
4035 return HasFunctionCacheField::decode( | 4046 return HasFunctionCacheField::decode( |
4036 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); | 4047 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); |
4037 } | 4048 } |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4202 | 4213 |
4203 | 4214 |
4204 void Map::InitializeDescriptors(DescriptorArray* descriptors) { | 4215 void Map::InitializeDescriptors(DescriptorArray* descriptors) { |
4205 int len = descriptors->number_of_descriptors(); | 4216 int len = descriptors->number_of_descriptors(); |
4206 set_instance_descriptors(descriptors); | 4217 set_instance_descriptors(descriptors); |
4207 SetNumberOfOwnDescriptors(len); | 4218 SetNumberOfOwnDescriptors(len); |
4208 } | 4219 } |
4209 | 4220 |
4210 | 4221 |
4211 ACCESSORS(Map, instance_descriptors, DescriptorArray, kDescriptorsOffset) | 4222 ACCESSORS(Map, instance_descriptors, DescriptorArray, kDescriptorsOffset) |
4212 | 4223 SMI_ACCESSORS(Map, bit_field3, kBitField3Offset) |
4213 | |
4214 void Map::set_bit_field3(uint32_t bits) { | |
4215 // Ensure the upper 2 bits have the same value by sign extending it. This is | |
4216 // necessary to be able to use the 31st bit. | |
4217 int value = bits << 1; | |
4218 WRITE_FIELD(this, kBitField3Offset, Smi::FromInt(value >> 1)); | |
4219 } | |
4220 | |
4221 | |
4222 uint32_t Map::bit_field3() { | |
4223 Object* value = READ_FIELD(this, kBitField3Offset); | |
4224 return Smi::cast(value)->value(); | |
4225 } | |
4226 | 4224 |
4227 | 4225 |
4228 void Map::ClearTransitions(Heap* heap, WriteBarrierMode mode) { | 4226 void Map::ClearTransitions(Heap* heap, WriteBarrierMode mode) { |
4229 Object* back_pointer = GetBackPointer(); | 4227 Object* back_pointer = GetBackPointer(); |
4230 | 4228 |
4231 if (Heap::ShouldZapGarbage() && HasTransitionArray()) { | 4229 if (Heap::ShouldZapGarbage() && HasTransitionArray()) { |
4232 ZapTransitions(); | 4230 ZapTransitions(); |
4233 } | 4231 } |
4234 | 4232 |
4235 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, back_pointer); | 4233 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, back_pointer); |
(...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6244 #undef WRITE_UINT32_FIELD | 6242 #undef WRITE_UINT32_FIELD |
6245 #undef READ_SHORT_FIELD | 6243 #undef READ_SHORT_FIELD |
6246 #undef WRITE_SHORT_FIELD | 6244 #undef WRITE_SHORT_FIELD |
6247 #undef READ_BYTE_FIELD | 6245 #undef READ_BYTE_FIELD |
6248 #undef WRITE_BYTE_FIELD | 6246 #undef WRITE_BYTE_FIELD |
6249 | 6247 |
6250 | 6248 |
6251 } } // namespace v8::internal | 6249 } } // namespace v8::internal |
6252 | 6250 |
6253 #endif // V8_OBJECTS_INL_H_ | 6251 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |