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 5002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5013 WRITE_FIELD(this, kBitField3Offset, Smi::FromInt(value >> 1)); | 5013 WRITE_FIELD(this, kBitField3Offset, Smi::FromInt(value >> 1)); |
5014 } | 5014 } |
5015 | 5015 |
5016 | 5016 |
5017 uint32_t Map::bit_field3() { | 5017 uint32_t Map::bit_field3() { |
5018 Object* value = READ_FIELD(this, kBitField3Offset); | 5018 Object* value = READ_FIELD(this, kBitField3Offset); |
5019 return Smi::cast(value)->value(); | 5019 return Smi::cast(value)->value(); |
5020 } | 5020 } |
5021 | 5021 |
5022 | 5022 |
5023 void Map::ClearTransitions(Heap* heap, WriteBarrierMode mode) { | |
5024 Object* back_pointer = GetBackPointer(); | |
5025 | |
5026 if (Heap::ShouldZapGarbage() && HasTransitionArray()) { | |
5027 ZapTransitions(); | |
5028 } | |
5029 | |
5030 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, back_pointer); | |
5031 CONDITIONAL_WRITE_BARRIER( | |
5032 heap, this, kTransitionsOrBackPointerOffset, back_pointer, mode); | |
5033 } | |
5034 | |
5035 | |
5036 void Map::AppendDescriptor(Descriptor* desc) { | 5023 void Map::AppendDescriptor(Descriptor* desc) { |
5037 DescriptorArray* descriptors = instance_descriptors(); | 5024 DescriptorArray* descriptors = instance_descriptors(); |
5038 int number_of_own_descriptors = NumberOfOwnDescriptors(); | 5025 int number_of_own_descriptors = NumberOfOwnDescriptors(); |
5039 ASSERT(descriptors->number_of_descriptors() == number_of_own_descriptors); | 5026 ASSERT(descriptors->number_of_descriptors() == number_of_own_descriptors); |
5040 descriptors->Append(desc); | 5027 descriptors->Append(desc); |
5041 SetNumberOfOwnDescriptors(number_of_own_descriptors + 1); | 5028 SetNumberOfOwnDescriptors(number_of_own_descriptors + 1); |
5042 } | 5029 } |
5043 | 5030 |
5044 | 5031 |
5045 Object* Map::GetBackPointer() { | 5032 Object* Map::GetBackPointer() { |
(...skipping 25 matching lines...) Expand all Loading... |
5071 | 5058 |
5072 | 5059 |
5073 bool Map::CanHaveMoreTransitions() { | 5060 bool Map::CanHaveMoreTransitions() { |
5074 if (!HasTransitionArray()) return true; | 5061 if (!HasTransitionArray()) return true; |
5075 return FixedArray::SizeFor(transitions()->length() + | 5062 return FixedArray::SizeFor(transitions()->length() + |
5076 TransitionArray::kTransitionSize) | 5063 TransitionArray::kTransitionSize) |
5077 <= Page::kMaxRegularHeapObjectSize; | 5064 <= Page::kMaxRegularHeapObjectSize; |
5078 } | 5065 } |
5079 | 5066 |
5080 | 5067 |
5081 void Map::SetTransition(int transition_index, Map* target) { | |
5082 transitions()->SetTarget(transition_index, target); | |
5083 } | |
5084 | |
5085 | |
5086 Map* Map::GetTransition(int transition_index) { | 5068 Map* Map::GetTransition(int transition_index) { |
5087 return transitions()->GetTarget(transition_index); | 5069 return transitions()->GetTarget(transition_index); |
5088 } | 5070 } |
5089 | 5071 |
5090 | 5072 |
5091 int Map::SearchTransition(Name* name) { | 5073 int Map::SearchTransition(Name* name) { |
5092 if (HasTransitionArray()) return transitions()->Search(name); | 5074 if (HasTransitionArray()) return transitions()->Search(name); |
5093 return TransitionArray::kNotFound; | 5075 return TransitionArray::kNotFound; |
5094 } | 5076 } |
5095 | 5077 |
(...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7101 #undef READ_SHORT_FIELD | 7083 #undef READ_SHORT_FIELD |
7102 #undef WRITE_SHORT_FIELD | 7084 #undef WRITE_SHORT_FIELD |
7103 #undef READ_BYTE_FIELD | 7085 #undef READ_BYTE_FIELD |
7104 #undef WRITE_BYTE_FIELD | 7086 #undef WRITE_BYTE_FIELD |
7105 #undef NOBARRIER_READ_BYTE_FIELD | 7087 #undef NOBARRIER_READ_BYTE_FIELD |
7106 #undef NOBARRIER_WRITE_BYTE_FIELD | 7088 #undef NOBARRIER_WRITE_BYTE_FIELD |
7107 | 7089 |
7108 } } // namespace v8::internal | 7090 } } // namespace v8::internal |
7109 | 7091 |
7110 #endif // V8_OBJECTS_INL_H_ | 7092 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |