| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 10221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10232 CHECK_EQUAL_64(54, x27); | 10232 CHECK_EQUAL_64(54, x27); |
| 10233 // 3=3, 4=40, 5=500 | 10233 // 3=3, 4=40, 5=500 |
| 10234 CHECK_EQUAL_64(17, x28); | 10234 CHECK_EQUAL_64(17, x28); |
| 10235 // w3: 4294967295, s1: 1.234000, x5: 18446744073709551615, d3: 3.456000 | 10235 // w3: 4294967295, s1: 1.234000, x5: 18446744073709551615, d3: 3.456000 |
| 10236 CHECK_EQUAL_64(69, x29); | 10236 CHECK_EQUAL_64(69, x29); |
| 10237 | 10237 |
| 10238 TEARDOWN(); | 10238 TEARDOWN(); |
| 10239 } | 10239 } |
| 10240 | 10240 |
| 10241 | 10241 |
| 10242 // This is a V8-specific test. | |
| 10243 static void CopyFieldsHelper(CPURegList temps) { | |
| 10244 static const uint64_t kLiteralBase = 0x0100001000100101UL; | |
| 10245 static const uint64_t src[] = {kLiteralBase * 1, | |
| 10246 kLiteralBase * 2, | |
| 10247 kLiteralBase * 3, | |
| 10248 kLiteralBase * 4, | |
| 10249 kLiteralBase * 5, | |
| 10250 kLiteralBase * 6, | |
| 10251 kLiteralBase * 7, | |
| 10252 kLiteralBase * 8, | |
| 10253 kLiteralBase * 9, | |
| 10254 kLiteralBase * 10, | |
| 10255 kLiteralBase * 11}; | |
| 10256 static const uint64_t src_tagged = | |
| 10257 reinterpret_cast<uint64_t>(src) + kHeapObjectTag; | |
| 10258 | |
| 10259 static const unsigned kTestCount = sizeof(src) / sizeof(src[0]) + 1; | |
| 10260 uint64_t* dst[kTestCount]; | |
| 10261 uint64_t dst_tagged[kTestCount]; | |
| 10262 | |
| 10263 // The first test will be to copy 0 fields. The destination (and source) | |
| 10264 // should not be accessed in any way. | |
| 10265 dst[0] = NULL; | |
| 10266 dst_tagged[0] = kHeapObjectTag; | |
| 10267 | |
| 10268 // Allocate memory for each other test. Each test <n> will have <n> fields. | |
| 10269 // This is intended to exercise as many paths in CopyFields as possible. | |
| 10270 for (unsigned i = 1; i < kTestCount; i++) { | |
| 10271 dst[i] = new uint64_t[i]; | |
| 10272 memset(dst[i], 0, i * sizeof(kLiteralBase)); | |
| 10273 dst_tagged[i] = reinterpret_cast<uint64_t>(dst[i]) + kHeapObjectTag; | |
| 10274 } | |
| 10275 | |
| 10276 SETUP(); | |
| 10277 START(); | |
| 10278 | |
| 10279 __ Mov(x0, dst_tagged[0]); | |
| 10280 __ Mov(x1, 0); | |
| 10281 __ CopyFields(x0, x1, temps, 0); | |
| 10282 for (unsigned i = 1; i < kTestCount; i++) { | |
| 10283 __ Mov(x0, dst_tagged[i]); | |
| 10284 __ Mov(x1, src_tagged); | |
| 10285 __ CopyFields(x0, x1, temps, i); | |
| 10286 } | |
| 10287 | |
| 10288 END(); | |
| 10289 RUN(); | |
| 10290 TEARDOWN(); | |
| 10291 | |
| 10292 for (unsigned i = 1; i < kTestCount; i++) { | |
| 10293 for (unsigned j = 0; j < i; j++) { | |
| 10294 CHECK(src[j] == dst[i][j]); | |
| 10295 } | |
| 10296 delete [] dst[i]; | |
| 10297 } | |
| 10298 } | |
| 10299 | |
| 10300 | |
| 10301 // This is a V8-specific test. | |
| 10302 TEST(copyfields) { | |
| 10303 INIT_V8(); | |
| 10304 CopyFieldsHelper(CPURegList(x10)); | |
| 10305 CopyFieldsHelper(CPURegList(x10, x11)); | |
| 10306 CopyFieldsHelper(CPURegList(x10, x11, x12)); | |
| 10307 CopyFieldsHelper(CPURegList(x10, x11, x12, x13)); | |
| 10308 } | |
| 10309 | |
| 10310 | |
| 10311 TEST(blr_lr) { | 10242 TEST(blr_lr) { |
| 10312 // A simple test to check that the simulator correcty handle "blr lr". | 10243 // A simple test to check that the simulator correcty handle "blr lr". |
| 10313 INIT_V8(); | 10244 INIT_V8(); |
| 10314 SETUP(); | 10245 SETUP(); |
| 10315 | 10246 |
| 10316 START(); | 10247 START(); |
| 10317 Label target; | 10248 Label target; |
| 10318 Label end; | 10249 Label end; |
| 10319 | 10250 |
| 10320 __ Mov(x0, 0x0); | 10251 __ Mov(x0, 0x0); |
| (...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11335 __ Mov(x0, 1); | 11266 __ Mov(x0, 1); |
| 11336 | 11267 |
| 11337 END(); | 11268 END(); |
| 11338 | 11269 |
| 11339 RUN(); | 11270 RUN(); |
| 11340 | 11271 |
| 11341 CHECK_EQUAL_64(0x1, x0); | 11272 CHECK_EQUAL_64(0x1, x0); |
| 11342 | 11273 |
| 11343 TEARDOWN(); | 11274 TEARDOWN(); |
| 11344 } | 11275 } |
| OLD | NEW |