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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 F1 f = FUNCTION_CAST<F1>(code->entry()); | 298 F1 f = FUNCTION_CAST<F1>(code->entry()); |
301 for (int i = 0; i < kNumCases; ++i) { | 299 for (int i = 0; i < kNumCases; ++i) { |
302 int64_t res = reinterpret_cast<int64_t>( | 300 int64_t res = reinterpret_cast<int64_t>( |
303 CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); | 301 CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); |
304 ::printf("f(%d) = %" PRId64 "\n", i, res); | 302 ::printf("f(%d) = %" PRId64 "\n", i, res); |
305 CHECK_EQ(values[i], res); | 303 CHECK_EQ(values[i], res); |
306 } | 304 } |
307 } | 305 } |
308 | 306 |
309 #undef __ | 307 #undef __ |
OLD | NEW |