| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 for (int i = 0; i < length; i++) { | 96 for (int i = 0; i < length; i++) { |
| 97 CHECK_EQ(from[i], to[i]); | 97 CHECK_EQ(from[i], to[i]); |
| 98 } | 98 } |
| 99 CHECK_EQ(0xFF, to[-1]); | 99 CHECK_EQ(0xFF, to[-1]); |
| 100 CHECK_EQ(0xFF, to[length]); | 100 CHECK_EQ(0xFF, to[length]); |
| 101 } | 101 } |
| 102 | 102 |
| 103 | 103 |
| 104 | 104 |
| 105 TEST(MemCopy) { | 105 TEST(MemCopy) { |
| 106 OS::Setup(); |
| 106 const int N = kMinComplexMemCopy + 128; | 107 const int N = kMinComplexMemCopy + 128; |
| 107 Vector<byte> buffer1 = Vector<byte>::New(N); | 108 Vector<byte> buffer1 = Vector<byte>::New(N); |
| 108 Vector<byte> buffer2 = Vector<byte>::New(N); | 109 Vector<byte> buffer2 = Vector<byte>::New(N); |
| 109 | 110 |
| 110 for (int i = 0; i < N; i++) { | 111 for (int i = 0; i < N; i++) { |
| 111 buffer1[i] = static_cast<byte>(i & 0x7F); | 112 buffer1[i] = static_cast<byte>(i & 0x7F); |
| 112 } | 113 } |
| 113 | 114 |
| 114 // Same alignment. | 115 // Same alignment. |
| 115 for (int i = 0; i < 32; i++) { | 116 for (int i = 0; i < 32; i++) { |
| 116 TestMemCopy(buffer1, buffer2, i, i, i * 2); | 117 TestMemCopy(buffer1, buffer2, i, i, i * 2); |
| 117 } | 118 } |
| 118 | 119 |
| 119 // Different alignment. | 120 // Different alignment. |
| 120 for (int i = 0; i < 32; i++) { | 121 for (int i = 0; i < 32; i++) { |
| 121 for (int j = 1; j < 32; j++) { | 122 for (int j = 1; j < 32; j++) { |
| 122 TestMemCopy(buffer1, buffer2, i, (i + j) & 0x1F , 0); | 123 TestMemCopy(buffer1, buffer2, i, (i + j) & 0x1F , 0); |
| 123 } | 124 } |
| 124 } | 125 } |
| 125 | 126 |
| 126 // Different lengths | 127 // Different lengths |
| 127 for (int i = 0; i < 32; i++) { | 128 for (int i = 0; i < 32; i++) { |
| 128 TestMemCopy(buffer1, buffer2, 3, 7, i); | 129 TestMemCopy(buffer1, buffer2, 3, 7, i); |
| 129 } | 130 } |
| 130 | 131 |
| 131 buffer2.Dispose(); | 132 buffer2.Dispose(); |
| 132 buffer1.Dispose(); | 133 buffer1.Dispose(); |
| 133 } | 134 } |
| OLD | NEW |