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 2188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2199 void FixedArray::set(int index, Smi* value) { | 2199 void FixedArray::set(int index, Smi* value) { |
2200 DCHECK(map() != GetHeap()->fixed_cow_array_map()); | 2200 DCHECK(map() != GetHeap()->fixed_cow_array_map()); |
2201 DCHECK(index >= 0 && index < this->length()); | 2201 DCHECK(index >= 0 && index < this->length()); |
2202 DCHECK(reinterpret_cast<Object*>(value)->IsSmi()); | 2202 DCHECK(reinterpret_cast<Object*>(value)->IsSmi()); |
2203 int offset = kHeaderSize + index * kPointerSize; | 2203 int offset = kHeaderSize + index * kPointerSize; |
2204 WRITE_FIELD(this, offset, value); | 2204 WRITE_FIELD(this, offset, value); |
2205 } | 2205 } |
2206 | 2206 |
2207 | 2207 |
2208 void FixedArray::set(int index, Object* value) { | 2208 void FixedArray::set(int index, Object* value) { |
2209 DCHECK(map() != GetHeap()->fixed_cow_array_map()); | 2209 DCHECK_NE(GetHeap()->fixed_cow_array_map(), map()); |
| 2210 DCHECK_EQ(FIXED_ARRAY_TYPE, map()->instance_type()); |
2210 DCHECK(index >= 0 && index < this->length()); | 2211 DCHECK(index >= 0 && index < this->length()); |
2211 int offset = kHeaderSize + index * kPointerSize; | 2212 int offset = kHeaderSize + index * kPointerSize; |
2212 WRITE_FIELD(this, offset, value); | 2213 WRITE_FIELD(this, offset, value); |
2213 WRITE_BARRIER(GetHeap(), this, offset, value); | 2214 WRITE_BARRIER(GetHeap(), this, offset, value); |
2214 } | 2215 } |
2215 | 2216 |
2216 | 2217 |
2217 inline bool FixedDoubleArray::is_the_hole_nan(double value) { | 2218 inline bool FixedDoubleArray::is_the_hole_nan(double value) { |
2218 return BitCast<uint64_t, double>(value) == kHoleNanInt64; | 2219 return BitCast<uint64_t, double>(value) == kHoleNanInt64; |
2219 } | 2220 } |
(...skipping 2233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4453 | 4454 |
4454 void Map::set_is_prototype_map(bool value) { | 4455 void Map::set_is_prototype_map(bool value) { |
4455 set_bit_field2(IsPrototypeMapBits::update(bit_field2(), value)); | 4456 set_bit_field2(IsPrototypeMapBits::update(bit_field2(), value)); |
4456 } | 4457 } |
4457 | 4458 |
4458 bool Map::is_prototype_map() { | 4459 bool Map::is_prototype_map() { |
4459 return IsPrototypeMapBits::decode(bit_field2()); | 4460 return IsPrototypeMapBits::decode(bit_field2()); |
4460 } | 4461 } |
4461 | 4462 |
4462 | 4463 |
4463 void Map::set_is_shared(bool value) { | |
4464 set_bit_field3(IsShared::update(bit_field3(), value)); | |
4465 } | |
4466 | |
4467 | |
4468 bool Map::is_shared() { | |
4469 return IsShared::decode(bit_field3()); } | |
4470 | |
4471 | |
4472 void Map::set_dictionary_map(bool value) { | 4464 void Map::set_dictionary_map(bool value) { |
4473 uint32_t new_bit_field3 = DictionaryMap::update(bit_field3(), value); | 4465 uint32_t new_bit_field3 = DictionaryMap::update(bit_field3(), value); |
4474 new_bit_field3 = IsUnstable::update(new_bit_field3, value); | 4466 new_bit_field3 = IsUnstable::update(new_bit_field3, value); |
4475 set_bit_field3(new_bit_field3); | 4467 set_bit_field3(new_bit_field3); |
4476 } | 4468 } |
4477 | 4469 |
4478 | 4470 |
4479 bool Map::is_dictionary_map() { | 4471 bool Map::is_dictionary_map() { |
4480 return DictionaryMap::decode(bit_field3()); | 4472 return DictionaryMap::decode(bit_field3()); |
4481 } | 4473 } |
4482 | 4474 |
4483 | 4475 |
4484 Code::Flags Code::flags() { | 4476 Code::Flags Code::flags() { |
4485 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset)); | 4477 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset)); |
4486 } | 4478 } |
4487 | 4479 |
4488 | 4480 |
4489 void Map::set_owns_descriptors(bool is_shared) { | 4481 void Map::set_owns_descriptors(bool owns_descriptors) { |
4490 set_bit_field3(OwnsDescriptors::update(bit_field3(), is_shared)); | 4482 set_bit_field3(OwnsDescriptors::update(bit_field3(), owns_descriptors)); |
4491 } | 4483 } |
4492 | 4484 |
4493 | 4485 |
4494 bool Map::owns_descriptors() { | 4486 bool Map::owns_descriptors() { |
4495 return OwnsDescriptors::decode(bit_field3()); | 4487 return OwnsDescriptors::decode(bit_field3()); |
4496 } | 4488 } |
4497 | 4489 |
4498 | 4490 |
4499 void Map::set_has_instance_call_handler() { | 4491 void Map::set_has_instance_call_handler() { |
4500 set_bit_field3(HasInstanceCallHandler::update(bit_field3(), true)); | 4492 set_bit_field3(HasInstanceCallHandler::update(bit_field3(), true)); |
(...skipping 2785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7286 #undef READ_SHORT_FIELD | 7278 #undef READ_SHORT_FIELD |
7287 #undef WRITE_SHORT_FIELD | 7279 #undef WRITE_SHORT_FIELD |
7288 #undef READ_BYTE_FIELD | 7280 #undef READ_BYTE_FIELD |
7289 #undef WRITE_BYTE_FIELD | 7281 #undef WRITE_BYTE_FIELD |
7290 #undef NOBARRIER_READ_BYTE_FIELD | 7282 #undef NOBARRIER_READ_BYTE_FIELD |
7291 #undef NOBARRIER_WRITE_BYTE_FIELD | 7283 #undef NOBARRIER_WRITE_BYTE_FIELD |
7292 | 7284 |
7293 } } // namespace v8::internal | 7285 } } // namespace v8::internal |
7294 | 7286 |
7295 #endif // V8_OBJECTS_INL_H_ | 7287 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |