OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 5474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5485 { 4, 1 }, | 5485 { 4, 1 }, |
5486 }; | 5486 }; |
5487 | 5487 |
5488 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseBal); | 5488 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseBal); |
5489 for (size_t i = 0; i < nr_test_cases; ++i) { | 5489 for (size_t i = 0; i < nr_test_cases; ++i) { |
5490 CHECK_EQ(tc[i].expected_res, run_bal(tc[i].offset)); | 5490 CHECK_EQ(tc[i].expected_res, run_bal(tc[i].offset)); |
5491 } | 5491 } |
5492 } | 5492 } |
5493 | 5493 |
5494 | 5494 |
| 5495 TEST(Trampoline) { |
| 5496 if (kArchVariant == kMips64r6) { |
| 5497 // Private member of Assembler class. |
| 5498 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1; |
| 5499 |
| 5500 CcTest::InitializeVM(); |
| 5501 Isolate* isolate = CcTest::i_isolate(); |
| 5502 HandleScope scope(isolate); |
| 5503 |
| 5504 MacroAssembler assm(isolate, NULL, 0); |
| 5505 Label done; |
| 5506 size_t nr_calls = kMaxBranchOffset / (2 * Instruction::kInstrSize) + 2; |
| 5507 |
| 5508 __ stop("check."); |
| 5509 for (size_t i = 0; i < nr_calls; ++i) { |
| 5510 __ BranchShort(&done, eq, a0, Operand(a1)); |
| 5511 } |
| 5512 __ bind(&done); |
| 5513 __ Ret(USE_DELAY_SLOT); |
| 5514 __ mov(v0, zero_reg); |
| 5515 |
| 5516 CodeDesc desc; |
| 5517 assm.GetCode(&desc); |
| 5518 Handle<Code> code = isolate->factory()->NewCode( |
| 5519 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 5520 F2 f = FUNCTION_CAST<F2>(code->entry()); |
| 5521 |
| 5522 int64_t res = |
| 5523 reinterpret_cast<int64_t>(CALL_GENERATED_CODE(f, 5, 5, 0, 0, 0)); |
| 5524 CHECK_EQ(res, 0); |
| 5525 } |
| 5526 } |
| 5527 |
| 5528 |
5495 #undef __ | 5529 #undef __ |
OLD | NEW |