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 4979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4990 | 4990 |
4991 nr_test_cases = sizeof(dahi_tc) / sizeof(TestCaseAui); | 4991 nr_test_cases = sizeof(dahi_tc) / sizeof(TestCaseAui); |
4992 for (size_t i = 0; i < nr_test_cases; ++i) { | 4992 for (size_t i = 0; i < nr_test_cases; ++i) { |
4993 uint64_t res = run_dahi(dahi_tc[i].rs, dahi_tc[i].offset); | 4993 uint64_t res = run_dahi(dahi_tc[i].rs, dahi_tc[i].offset); |
4994 CHECK_EQ(dahi_tc[i].ref_res, res); | 4994 CHECK_EQ(dahi_tc[i].ref_res, res); |
4995 } | 4995 } |
4996 } | 4996 } |
4997 } | 4997 } |
4998 | 4998 |
4999 | 4999 |
| 5000 uint64_t run_li_macro(uint64_t rs, LiFlags mode) { |
| 5001 Isolate* isolate = CcTest::i_isolate(); |
| 5002 HandleScope scope(isolate); |
| 5003 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
| 5004 |
| 5005 __ li(a0, rs, mode); |
| 5006 __ mov(v0, a0); |
| 5007 __ jr(ra); |
| 5008 __ nop(); |
| 5009 |
| 5010 CodeDesc desc; |
| 5011 assm.GetCode(&desc); |
| 5012 Handle<Code> code = isolate->factory()->NewCode( |
| 5013 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 5014 |
| 5015 F2 f = FUNCTION_CAST<F2>(code->entry()); |
| 5016 |
| 5017 uint64_t res = reinterpret_cast<uint64_t>( |
| 5018 CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); |
| 5019 |
| 5020 return res; |
| 5021 } |
| 5022 |
| 5023 |
| 5024 TEST(li_macro) { |
| 5025 CcTest::InitializeVM(); |
| 5026 |
| 5027 uint64_t inputs[] = { |
| 5028 0x0000000000000000, 0x000000000000ffff, 0x00000000ffffffff, |
| 5029 0x0000ffffffffffff, 0xffffffffffffffff, 0xffff000000000000, |
| 5030 0xffffffff00000000, 0xffffffffffff0000, 0xffff0000ffff0000, |
| 5031 0x0000ffffffff0000, 0x0000ffff0000ffff, |
| 5032 }; |
| 5033 |
| 5034 size_t nr_test_cases = sizeof(inputs) / sizeof(inputs[0]); |
| 5035 for (size_t i = 0; i < nr_test_cases; ++i) { |
| 5036 uint64_t res = run_li_macro(inputs[i], OPTIMIZE_SIZE); |
| 5037 CHECK_EQ(inputs[i], res); |
| 5038 res = run_li_macro(inputs[i], CONSTANT_SIZE); |
| 5039 CHECK_EQ(inputs[i], res); |
| 5040 if (is_int48(inputs[i])) { |
| 5041 res = run_li_macro(inputs[i], ADDRESS_LOAD); |
| 5042 CHECK_EQ(inputs[i], res); |
| 5043 } |
| 5044 } |
| 5045 } |
| 5046 |
| 5047 |
5000 uint64_t run_lwpc(int offset) { | 5048 uint64_t run_lwpc(int offset) { |
5001 Isolate* isolate = CcTest::i_isolate(); | 5049 Isolate* isolate = CcTest::i_isolate(); |
5002 HandleScope scope(isolate); | 5050 HandleScope scope(isolate); |
5003 | 5051 |
5004 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); | 5052 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
5005 | 5053 |
5006 // 256k instructions; 2^8k | 5054 // 256k instructions; 2^8k |
5007 // addiu t3, a4, 0xffff; (0x250fffff) | 5055 // addiu t3, a4, 0xffff; (0x250fffff) |
5008 // ... | 5056 // ... |
5009 // addiu t0, a4, 0x0000; (0x250c0000) | 5057 // addiu t0, a4, 0x0000; (0x250c0000) |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5813 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 5861 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
5814 F2 f = FUNCTION_CAST<F2>(code->entry()); | 5862 F2 f = FUNCTION_CAST<F2>(code->entry()); |
5815 | 5863 |
5816 int64_t res = reinterpret_cast<int64_t>( | 5864 int64_t res = reinterpret_cast<int64_t>( |
5817 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); | 5865 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); |
5818 CHECK_EQ(res, 0); | 5866 CHECK_EQ(res, 0); |
5819 } | 5867 } |
5820 | 5868 |
5821 | 5869 |
5822 #undef __ | 5870 #undef __ |
OLD | NEW |