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 int offset = kHeaderSize; | |
1758 for (int i = 0; i < old_length; ++i) { | |
1759 WRITE_DOUBLE_FIELD(this, offset, READ_DOUBLE_FIELD(from, offset)); | |
1760 offset += kDoubleSize; | |
1761 } | |
1762 } | |
1755 int offset = kHeaderSize + old_length * kDoubleSize; | 1763 int offset = kHeaderSize + old_length * kDoubleSize; |
1756 for (int current = from->length(); current < length(); ++current) { | 1764 for (int current = from->length(); current < length(); ++current) { |
1757 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double()); | 1765 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double()); |
danno
2011/09/06 13:22:13
just do set(current, from->get(current)) and don't
Jakob Kummerow
2011/09/06 13:31:03
Done.
| |
1758 offset += kDoubleSize; | 1766 offset += kDoubleSize; |
1759 } | 1767 } |
1760 } | 1768 } |
1761 | 1769 |
1762 | 1770 |
1763 void FixedDoubleArray::Initialize(FixedArray* from) { | 1771 void FixedDoubleArray::Initialize(FixedArray* from) { |
1764 int old_length = from->length(); | 1772 int old_length = from->length(); |
1765 ASSERT(old_length < length()); | 1773 ASSERT(old_length < length()); |
1766 for (int i = 0; i < old_length; i++) { | 1774 for (int i = 0; i < old_length; i++) { |
1767 Object* hole_or_object = from->get(i); | 1775 Object* hole_or_object = from->get(i); |
(...skipping 2911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4679 #undef WRITE_INT_FIELD | 4687 #undef WRITE_INT_FIELD |
4680 #undef READ_SHORT_FIELD | 4688 #undef READ_SHORT_FIELD |
4681 #undef WRITE_SHORT_FIELD | 4689 #undef WRITE_SHORT_FIELD |
4682 #undef READ_BYTE_FIELD | 4690 #undef READ_BYTE_FIELD |
4683 #undef WRITE_BYTE_FIELD | 4691 #undef WRITE_BYTE_FIELD |
4684 | 4692 |
4685 | 4693 |
4686 } } // namespace v8::internal | 4694 } } // namespace v8::internal |
4687 | 4695 |
4688 #endif // V8_OBJECTS_INL_H_ | 4696 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |