Chromium Code Reviews| 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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 937 | 937 |
| 938 #define WRITE_INTPTR_FIELD(p, offset, value) \ | 938 #define WRITE_INTPTR_FIELD(p, offset, value) \ |
| 939 (*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset)) = value) | 939 (*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset)) = value) |
| 940 | 940 |
| 941 #define READ_UINT32_FIELD(p, offset) \ | 941 #define READ_UINT32_FIELD(p, offset) \ |
| 942 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset))) | 942 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset))) |
| 943 | 943 |
| 944 #define WRITE_UINT32_FIELD(p, offset, value) \ | 944 #define WRITE_UINT32_FIELD(p, offset, value) \ |
| 945 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)) = value) | 945 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)) = value) |
| 946 | 946 |
| 947 #define READ_INT64_FIELD(p, offset) \ | |
| 948 (*reinterpret_cast<int64_t*>(FIELD_ADDR(p, offset))) | |
| 949 | |
| 950 #define WRITE_INT64_FIELD(p, offset, value) \ | |
| 951 (*reinterpret_cast<int64_t*>(FIELD_ADDR(p, offset)) = value) | |
| 952 | |
| 947 #define READ_SHORT_FIELD(p, offset) \ | 953 #define READ_SHORT_FIELD(p, offset) \ |
| 948 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset))) | 954 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset))) |
| 949 | 955 |
| 950 #define WRITE_SHORT_FIELD(p, offset, value) \ | 956 #define WRITE_SHORT_FIELD(p, offset, value) \ |
| 951 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)) = value) | 957 (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)) = value) |
| 952 | 958 |
| 953 #define READ_BYTE_FIELD(p, offset) \ | 959 #define READ_BYTE_FIELD(p, offset) \ |
| 954 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset))) | 960 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset))) |
| 955 | 961 |
| 956 #define WRITE_BYTE_FIELD(p, offset, value) \ | 962 #define WRITE_BYTE_FIELD(p, offset, value) \ |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1694 | 1700 |
| 1695 double FixedDoubleArray::get_scalar(int index) { | 1701 double FixedDoubleArray::get_scalar(int index) { |
| 1696 ASSERT(map() != HEAP->fixed_cow_array_map() && | 1702 ASSERT(map() != HEAP->fixed_cow_array_map() && |
| 1697 map() != HEAP->fixed_array_map()); | 1703 map() != HEAP->fixed_array_map()); |
| 1698 ASSERT(index >= 0 && index < this->length()); | 1704 ASSERT(index >= 0 && index < this->length()); |
| 1699 double result = READ_DOUBLE_FIELD(this, kHeaderSize + index * kDoubleSize); | 1705 double result = READ_DOUBLE_FIELD(this, kHeaderSize + index * kDoubleSize); |
| 1700 ASSERT(!is_the_hole_nan(result)); | 1706 ASSERT(!is_the_hole_nan(result)); |
| 1701 return result; | 1707 return result; |
| 1702 } | 1708 } |
| 1703 | 1709 |
| 1710 int64_t FixedDoubleArray::get_representation(int index) { | |
| 1711 ASSERT(map() != HEAP->fixed_cow_array_map() && | |
| 1712 map() != HEAP->fixed_array_map()); | |
| 1713 ASSERT(index >= 0 && index < this->length()); | |
| 1714 int64_t result = READ_INT64_FIELD(this, kHeaderSize + index * kDoubleSize); | |
|
Sven Panne
2012/03/23 09:48:30
No need to name this explicitly...
| |
| 1715 return result; | |
| 1716 } | |
| 1704 | 1717 |
| 1705 MaybeObject* FixedDoubleArray::get(int index) { | 1718 MaybeObject* FixedDoubleArray::get(int index) { |
| 1706 if (is_the_hole(index)) { | 1719 if (is_the_hole(index)) { |
| 1707 return GetHeap()->the_hole_value(); | 1720 return GetHeap()->the_hole_value(); |
| 1708 } else { | 1721 } else { |
| 1709 return GetHeap()->NumberFromDouble(get_scalar(index)); | 1722 return GetHeap()->NumberFromDouble(get_scalar(index)); |
| 1710 } | 1723 } |
| 1711 } | 1724 } |
| 1712 | 1725 |
| 1713 | 1726 |
| (...skipping 3201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4915 #undef WRITE_UINT32_FIELD | 4928 #undef WRITE_UINT32_FIELD |
| 4916 #undef READ_SHORT_FIELD | 4929 #undef READ_SHORT_FIELD |
| 4917 #undef WRITE_SHORT_FIELD | 4930 #undef WRITE_SHORT_FIELD |
| 4918 #undef READ_BYTE_FIELD | 4931 #undef READ_BYTE_FIELD |
| 4919 #undef WRITE_BYTE_FIELD | 4932 #undef WRITE_BYTE_FIELD |
| 4920 | 4933 |
| 4921 | 4934 |
| 4922 } } // namespace v8::internal | 4935 } } // namespace v8::internal |
| 4923 | 4936 |
| 4924 #endif // V8_OBJECTS_INL_H_ | 4937 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |