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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 __ addiu(sp, sp, -4); | 282 __ addiu(sp, sp, -4); |
283 __ sw(ra, MemOperand(sp)); | 283 __ sw(ra, MemOperand(sp)); |
284 | 284 |
285 { | 285 { |
286 __ BlockTrampolinePoolFor(kNumCases * 2 + 7 + 1); | 286 __ BlockTrampolinePoolFor(kNumCases * 2 + 7 + 1); |
287 PredictableCodeSizeScope predictable( | 287 PredictableCodeSizeScope predictable( |
288 masm, kNumCases * kPointerSize + ((7 + 1) * Assembler::kInstrSize)); | 288 masm, kNumCases * kPointerSize + ((7 + 1) * Assembler::kInstrSize)); |
289 Label here; | 289 Label here; |
290 | 290 |
291 __ bal(&here); | 291 __ bal(&here); |
292 __ sll(at, a0, 3); // In delay slot. | 292 __ sll(at, a0, 2); // In delay slot. |
293 __ bind(&here); | 293 __ bind(&here); |
294 __ addu(at, at, ra); | 294 __ addu(at, at, ra); |
295 __ lw(at, MemOperand(at, 6 * Assembler::kInstrSize)); | 295 __ lw(at, MemOperand(at, 6 * Assembler::kInstrSize)); |
296 __ jalr(at); | 296 __ jalr(at); |
297 __ nop(); // Branch delay slot nop. | 297 __ nop(); // Branch delay slot nop. |
298 __ bc(&done); | 298 __ bc(&done); |
299 for (int i = 0; i < kNumCases; ++i) { | 299 for (int i = 0; i < kNumCases; ++i) { |
300 __ dd(&labels[i]); | 300 __ dd(&labels[i]); |
301 } | 301 } |
302 } | 302 } |
(...skipping 14 matching lines...) Expand all Loading... |
317 | 317 |
318 CodeDesc desc; | 318 CodeDesc desc; |
319 masm->GetCode(&desc); | 319 masm->GetCode(&desc); |
320 Handle<Code> code = isolate->factory()->NewCode( | 320 Handle<Code> code = isolate->factory()->NewCode( |
321 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 321 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
322 #ifdef OBJECT_PRINT | 322 #ifdef OBJECT_PRINT |
323 code->Print(std::cout); | 323 code->Print(std::cout); |
324 #endif | 324 #endif |
325 F1 f = FUNCTION_CAST<F1>(code->entry()); | 325 F1 f = FUNCTION_CAST<F1>(code->entry()); |
326 for (int i = 0; i < kNumCases; ++i) { | 326 for (int i = 0; i < kNumCases; ++i) { |
327 int64_t res = reinterpret_cast<int64_t>( | 327 int32_t res = reinterpret_cast<int32_t>( |
328 CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); | 328 CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); |
329 ::printf("f(%d) = %" PRId64 "\n", i, res); | 329 ::printf("f(%d) = %d\n", i, res); |
330 CHECK_EQ(values[i], res); | 330 CHECK_EQ(values[i], res); |
331 } | 331 } |
332 } | 332 } |
333 | 333 |
334 | 334 |
335 static uint32_t run_lsa(uint32_t rt, uint32_t rs, int8_t sa) { | 335 static uint32_t run_lsa(uint32_t rt, uint32_t rs, int8_t sa) { |
336 Isolate* isolate = CcTest::i_isolate(); | 336 Isolate* isolate = CcTest::i_isolate(); |
337 HandleScope scope(isolate); | 337 HandleScope scope(isolate); |
338 MacroAssembler assembler(isolate, nullptr, 0, | 338 MacroAssembler assembler(isolate, nullptr, 0, |
339 v8::internal::CodeObjectRequired::kYes); | 339 v8::internal::CodeObjectRequired::kYes); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseLsa); | 407 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseLsa); |
408 for (size_t i = 0; i < nr_test_cases; ++i) { | 408 for (size_t i = 0; i < nr_test_cases; ++i) { |
409 uint32_t res = run_lsa(tc[i].rt, tc[i].rs, tc[i].sa); | 409 uint32_t res = run_lsa(tc[i].rt, tc[i].rs, tc[i].sa); |
410 PrintF("0x%x =? 0x%x == lsa(v0, %x, %x, %hhu)\n", tc[i].expected_res, res, | 410 PrintF("0x%x =? 0x%x == lsa(v0, %x, %x, %hhu)\n", tc[i].expected_res, res, |
411 tc[i].rt, tc[i].rs, tc[i].sa); | 411 tc[i].rt, tc[i].rs, tc[i].sa); |
412 CHECK_EQ(tc[i].expected_res, res); | 412 CHECK_EQ(tc[i].expected_res, res); |
413 } | 413 } |
414 } | 414 } |
415 | 415 |
416 #undef __ | 416 #undef __ |
OLD | NEW |