OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1742 | 1742 |
1743 bool FixedDoubleArray::is_the_hole(int index) { | 1743 bool FixedDoubleArray::is_the_hole(int index) { |
1744 int offset = kHeaderSize + index * kDoubleSize; | 1744 int offset = kHeaderSize + index * kDoubleSize; |
1745 return is_the_hole_nan(READ_DOUBLE_FIELD(this, offset)); | 1745 return is_the_hole_nan(READ_DOUBLE_FIELD(this, offset)); |
1746 } | 1746 } |
1747 | 1747 |
1748 | 1748 |
1749 void FixedDoubleArray::Initialize(FixedDoubleArray* from) { | 1749 void FixedDoubleArray::Initialize(FixedDoubleArray* from) { |
1750 int old_length = from->length(); | 1750 int old_length = from->length(); |
1751 ASSERT(old_length < length()); | 1751 ASSERT(old_length < length()); |
1752 OS::MemCopy(FIELD_ADDR(this, kHeaderSize), | 1752 if (old_length * kDoubleSize >= OS::kMinComplexMemCopy) { |
1753 FIELD_ADDR(from, kHeaderSize), | 1753 OS::MemCopy(FIELD_ADDR(this, kHeaderSize), |
1754 old_length * kDoubleSize); | 1754 FIELD_ADDR(from, kHeaderSize), |
| 1755 old_length * kDoubleSize); |
| 1756 } else { |
| 1757 for (int i = 0; i < old_length; ++i) { |
| 1758 set(i, from->get_scalar(i)); |
| 1759 } |
| 1760 } |
1755 int offset = kHeaderSize + old_length * kDoubleSize; | 1761 int offset = kHeaderSize + old_length * kDoubleSize; |
1756 for (int current = from->length(); current < length(); ++current) { | 1762 for (int current = from->length(); current < length(); ++current) { |
1757 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double()); | 1763 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double()); |
1758 offset += kDoubleSize; | 1764 offset += kDoubleSize; |
1759 } | 1765 } |
1760 } | 1766 } |
1761 | 1767 |
1762 | 1768 |
1763 void FixedDoubleArray::Initialize(FixedArray* from) { | 1769 void FixedDoubleArray::Initialize(FixedArray* from) { |
1764 int old_length = from->length(); | 1770 int old_length = from->length(); |
(...skipping 2914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4679 #undef WRITE_INT_FIELD | 4685 #undef WRITE_INT_FIELD |
4680 #undef READ_SHORT_FIELD | 4686 #undef READ_SHORT_FIELD |
4681 #undef WRITE_SHORT_FIELD | 4687 #undef WRITE_SHORT_FIELD |
4682 #undef READ_BYTE_FIELD | 4688 #undef READ_BYTE_FIELD |
4683 #undef WRITE_BYTE_FIELD | 4689 #undef WRITE_BYTE_FIELD |
4684 | 4690 |
4685 | 4691 |
4686 } } // namespace v8::internal | 4692 } } // namespace v8::internal |
4687 | 4693 |
4688 #endif // V8_OBJECTS_INL_H_ | 4694 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |