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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 bool Object::IsDeoptimizationInputData() const { | 710 bool Object::IsDeoptimizationInputData() const { |
711 // Must be a fixed array. | 711 // Must be a fixed array. |
712 if (!IsFixedArray()) return false; | 712 if (!IsFixedArray()) return false; |
713 | 713 |
714 // There's no sure way to detect the difference between a fixed array and | 714 // There's no sure way to detect the difference between a fixed array and |
715 // a deoptimization data array. Since this is used for asserts we can | 715 // a deoptimization data array. Since this is used for asserts we can |
716 // check that the length is zero or else the fixed size plus a multiple of | 716 // check that the length is zero or else the fixed size plus a multiple of |
717 // the entry size. | 717 // the entry size. |
718 int length = FixedArray::cast(this)->length(); | 718 int length = FixedArray::cast(this)->length(); |
719 if (length == 0) return true; | 719 if (length == 0) return true; |
720 if (length < DeoptimizationInputData::kFirstDeoptEntryIndex) return false; | |
721 | 720 |
722 FixedArray* self = FixedArray::cast(const_cast<Object*>(this)); | 721 length -= DeoptimizationInputData::kFirstDeoptEntryIndex; |
723 int deopt_count = | 722 return length >= 0 && length % DeoptimizationInputData::kDeoptEntrySize == 0; |
724 Smi::cast(self->get(DeoptimizationInputData::kDeoptEntryCountIndex)) | |
725 ->value(); | |
726 int patch_count = | |
727 Smi::cast( | |
728 self->get( | |
729 DeoptimizationInputData::kReturnAddressPatchEntryCountIndex)) | |
730 ->value(); | |
731 | |
732 return length == DeoptimizationInputData::LengthFor(deopt_count, patch_count); | |
733 } | 723 } |
734 | 724 |
735 | 725 |
736 bool Object::IsDeoptimizationOutputData() const { | 726 bool Object::IsDeoptimizationOutputData() const { |
737 if (!IsFixedArray()) return false; | 727 if (!IsFixedArray()) return false; |
738 // There's actually no way to see the difference between a fixed array and | 728 // There's actually no way to see the difference between a fixed array and |
739 // a deoptimization data array. Since this is used for asserts we can check | 729 // a deoptimization data array. Since this is used for asserts we can check |
740 // that the length is plausible though. | 730 // that the length is plausible though. |
741 if (FixedArray::cast(this)->length() % 2 != 0) return false; | 731 if (FixedArray::cast(this)->length() % 2 != 0) return false; |
742 return true; | 732 return true; |
(...skipping 6526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7269 #undef READ_SHORT_FIELD | 7259 #undef READ_SHORT_FIELD |
7270 #undef WRITE_SHORT_FIELD | 7260 #undef WRITE_SHORT_FIELD |
7271 #undef READ_BYTE_FIELD | 7261 #undef READ_BYTE_FIELD |
7272 #undef WRITE_BYTE_FIELD | 7262 #undef WRITE_BYTE_FIELD |
7273 #undef NOBARRIER_READ_BYTE_FIELD | 7263 #undef NOBARRIER_READ_BYTE_FIELD |
7274 #undef NOBARRIER_WRITE_BYTE_FIELD | 7264 #undef NOBARRIER_WRITE_BYTE_FIELD |
7275 | 7265 |
7276 } } // namespace v8::internal | 7266 } } // namespace v8::internal |
7277 | 7267 |
7278 #endif // V8_OBJECTS_INL_H_ | 7268 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |