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 4909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4920 return instance_type() == JS_GLOBAL_OBJECT_TYPE; | 4920 return instance_type() == JS_GLOBAL_OBJECT_TYPE; |
4921 } | 4921 } |
4922 bool Map::IsJSTypedArrayMap() { return instance_type() == JS_TYPED_ARRAY_TYPE; } | 4922 bool Map::IsJSTypedArrayMap() { return instance_type() == JS_TYPED_ARRAY_TYPE; } |
4923 | 4923 |
4924 | 4924 |
4925 bool Map::CanOmitMapChecks() { | 4925 bool Map::CanOmitMapChecks() { |
4926 return is_stable() && FLAG_omit_map_checks_for_leaf_maps; | 4926 return is_stable() && FLAG_omit_map_checks_for_leaf_maps; |
4927 } | 4927 } |
4928 | 4928 |
4929 | 4929 |
4930 int DependentCode::number_of_entries(DependencyGroup group) { | 4930 DependentCode* DependentCode::next_link() { |
4931 if (length() == 0) return 0; | 4931 return DependentCode::cast(get(kNextLinkIndex)); |
4932 return Smi::cast(get(group))->value(); | |
4933 } | 4932 } |
4934 | 4933 |
4935 | 4934 |
4936 void DependentCode::set_number_of_entries(DependencyGroup group, int value) { | 4935 void DependentCode::set_next_link(DependentCode* next) { |
4937 set(group, Smi::FromInt(value)); | 4936 set(kNextLinkIndex, next); |
4938 } | 4937 } |
4939 | 4938 |
4940 | 4939 |
| 4940 int DependentCode::flags() { return Smi::cast(get(kFlagsIndex))->value(); } |
| 4941 |
| 4942 |
| 4943 void DependentCode::set_flags(int flags) { |
| 4944 set(kFlagsIndex, Smi::FromInt(flags)); |
| 4945 } |
| 4946 |
| 4947 |
| 4948 int DependentCode::count() { return CountField::decode(flags()); } |
| 4949 |
| 4950 void DependentCode::set_count(int value) { |
| 4951 set_flags(CountField::update(flags(), value)); |
| 4952 } |
| 4953 |
| 4954 |
| 4955 DependentCode::DependencyGroup DependentCode::group() { |
| 4956 return static_cast<DependencyGroup>(GroupField::decode(flags())); |
| 4957 } |
| 4958 |
| 4959 |
| 4960 void DependentCode::set_group(DependentCode::DependencyGroup group) { |
| 4961 set_flags(GroupField::update(flags(), static_cast<int>(group))); |
| 4962 } |
| 4963 |
| 4964 |
4941 void DependentCode::set_object_at(int i, Object* object) { | 4965 void DependentCode::set_object_at(int i, Object* object) { |
4942 set(kCodesStartIndex + i, object); | 4966 set(kCodesStartIndex + i, object); |
4943 } | 4967 } |
4944 | 4968 |
4945 | 4969 |
4946 Object* DependentCode::object_at(int i) { | 4970 Object* DependentCode::object_at(int i) { |
4947 return get(kCodesStartIndex + i); | 4971 return get(kCodesStartIndex + i); |
4948 } | 4972 } |
4949 | 4973 |
4950 | 4974 |
4951 void DependentCode::clear_at(int i) { | 4975 void DependentCode::clear_at(int i) { |
4952 set_undefined(kCodesStartIndex + i); | 4976 set_undefined(kCodesStartIndex + i); |
4953 } | 4977 } |
4954 | 4978 |
4955 | 4979 |
4956 void DependentCode::copy(int from, int to) { | 4980 void DependentCode::copy(int from, int to) { |
4957 set(kCodesStartIndex + to, get(kCodesStartIndex + from)); | 4981 set(kCodesStartIndex + to, get(kCodesStartIndex + from)); |
4958 } | 4982 } |
4959 | 4983 |
4960 | 4984 |
4961 void DependentCode::ExtendGroup(DependencyGroup group) { | |
4962 GroupStartIndexes starts(this); | |
4963 for (int g = kGroupCount - 1; g > group; g--) { | |
4964 if (starts.at(g) < starts.at(g + 1)) { | |
4965 copy(starts.at(g), starts.at(g + 1)); | |
4966 } | |
4967 } | |
4968 } | |
4969 | |
4970 | |
4971 void Code::set_flags(Code::Flags flags) { | 4985 void Code::set_flags(Code::Flags flags) { |
4972 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); | 4986 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); |
4973 WRITE_INT_FIELD(this, kFlagsOffset, flags); | 4987 WRITE_INT_FIELD(this, kFlagsOffset, flags); |
4974 } | 4988 } |
4975 | 4989 |
4976 | 4990 |
4977 Code::Kind Code::kind() { | 4991 Code::Kind Code::kind() { |
4978 return ExtractKindFromFlags(flags()); | 4992 return ExtractKindFromFlags(flags()); |
4979 } | 4993 } |
4980 | 4994 |
(...skipping 3170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8151 #undef WRITE_INT64_FIELD | 8165 #undef WRITE_INT64_FIELD |
8152 #undef READ_BYTE_FIELD | 8166 #undef READ_BYTE_FIELD |
8153 #undef WRITE_BYTE_FIELD | 8167 #undef WRITE_BYTE_FIELD |
8154 #undef NOBARRIER_READ_BYTE_FIELD | 8168 #undef NOBARRIER_READ_BYTE_FIELD |
8155 #undef NOBARRIER_WRITE_BYTE_FIELD | 8169 #undef NOBARRIER_WRITE_BYTE_FIELD |
8156 | 8170 |
8157 } // namespace internal | 8171 } // namespace internal |
8158 } // namespace v8 | 8172 } // namespace v8 |
8159 | 8173 |
8160 #endif // V8_OBJECTS_INL_H_ | 8174 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |