| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 MacroAssembler* masm = &assembler; | 233 MacroAssembler* masm = &assembler; |
| 234 | 234 |
| 235 const int kNumCases = 512; | 235 const int kNumCases = 512; |
| 236 int values[kNumCases]; | 236 int values[kNumCases]; |
| 237 isolate->random_number_generator()->NextBytes(values, sizeof(values)); | 237 isolate->random_number_generator()->NextBytes(values, sizeof(values)); |
| 238 Label labels[kNumCases]; | 238 Label labels[kNumCases]; |
| 239 Label near_start, end; | 239 Label near_start, end; |
| 240 | 240 |
| 241 __ daddiu(sp, sp, -8); | 241 __ daddiu(sp, sp, -8); |
| 242 __ sd(ra, MemOperand(sp)); | 242 __ sd(ra, MemOperand(sp)); |
| 243 if ((masm->pc_offset() & 7) == 0) { | |
| 244 __ nop(); | |
| 245 } | |
| 246 | 243 |
| 247 __ mov(v0, zero_reg); | 244 __ mov(v0, zero_reg); |
| 248 | 245 |
| 249 __ Branch(&end); | 246 __ Branch(&end); |
| 250 __ bind(&near_start); | 247 __ bind(&near_start); |
| 251 | 248 |
| 252 // Generate slightly less than 32K instructions, which will soon require | 249 // Generate slightly less than 32K instructions, which will soon require |
| 253 // trampoline for branch distance fixup. | 250 // trampoline for branch distance fixup. |
| 254 for (int i = 0; i < 32768 - 256; ++i) { | 251 for (int i = 0; i < 32768 - 256; ++i) { |
| 255 __ addiu(v0, v0, 1); | 252 __ addiu(v0, v0, 1); |
| 256 } | 253 } |
| 257 | 254 |
| 255 __ Align(8); |
| 258 Label done; | 256 Label done; |
| 259 { | 257 { |
| 260 __ BlockTrampolinePoolFor(kNumCases * 2 + 6); | 258 __ BlockTrampolinePoolFor(kNumCases * 2 + 6); |
| 261 PredictableCodeSizeScope predictable( | 259 PredictableCodeSizeScope predictable( |
| 262 masm, (kNumCases * 2 + 6) * Assembler::kInstrSize); | 260 masm, (kNumCases * 2 + 6) * Assembler::kInstrSize); |
| 263 Label here; | 261 Label here; |
| 264 | 262 |
| 265 __ bal(&here); | 263 __ bal(&here); |
| 266 __ dsll(at, a0, 3); // In delay slot. | 264 __ dsll(at, a0, 3); // In delay slot. |
| 267 __ bind(&here); | 265 __ bind(&here); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 for (size_t i = 0; i < nr_test_cases; ++i) { | 463 for (size_t i = 0; i < nr_test_cases; ++i) { |
| 466 uint64_t res = run_dlsa(tc[i].rt, tc[i].rs, tc[i].sa); | 464 uint64_t res = run_dlsa(tc[i].rt, tc[i].rs, tc[i].sa); |
| 467 PrintF("0x%" PRIx64 " =? 0x%" PRIx64 " == Dlsa(v0, %" PRIx64 ", %" PRIx64 | 465 PrintF("0x%" PRIx64 " =? 0x%" PRIx64 " == Dlsa(v0, %" PRIx64 ", %" PRIx64 |
| 468 ", %hhu)\n", | 466 ", %hhu)\n", |
| 469 tc[i].expected_res, res, tc[i].rt, tc[i].rs, tc[i].sa); | 467 tc[i].expected_res, res, tc[i].rt, tc[i].rs, tc[i].sa); |
| 470 CHECK_EQ(tc[i].expected_res, res); | 468 CHECK_EQ(tc[i].expected_res, res); |
| 471 } | 469 } |
| 472 } | 470 } |
| 473 | 471 |
| 474 #undef __ | 472 #undef __ |
| OLD | NEW |