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 2969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2980 const int kNumCases = 512; | 2980 const int kNumCases = 512; |
2981 int values[kNumCases]; | 2981 int values[kNumCases]; |
2982 isolate->random_number_generator()->NextBytes(values, sizeof(values)); | 2982 isolate->random_number_generator()->NextBytes(values, sizeof(values)); |
2983 Label labels[kNumCases]; | 2983 Label labels[kNumCases]; |
2984 | 2984 |
2985 __ addiu(sp, sp, -4); | 2985 __ addiu(sp, sp, -4); |
2986 __ sw(ra, MemOperand(sp)); | 2986 __ sw(ra, MemOperand(sp)); |
2987 | 2987 |
2988 Label done; | 2988 Label done; |
2989 { | 2989 { |
| 2990 __ BlockTrampolinePoolFor(kNumCases + 7); |
2990 PredictableCodeSizeScope predictable( | 2991 PredictableCodeSizeScope predictable( |
2991 &assm, (kNumCases + 7) * Assembler::kInstrSize); | 2992 &assm, (kNumCases + 7) * Assembler::kInstrSize); |
2992 Label here; | 2993 Label here; |
2993 | 2994 |
2994 __ bal(&here); | 2995 __ bal(&here); |
2995 __ nop(); | 2996 __ nop(); |
2996 __ bind(&here); | 2997 __ bind(&here); |
2997 __ sll(at, a0, 2); | 2998 __ sll(at, a0, 2); |
2998 __ addu(at, at, ra); | 2999 __ addu(at, at, ra); |
2999 __ lw(at, MemOperand(at, 5 * Assembler::kInstrSize)); | 3000 __ lw(at, MemOperand(at, 5 * Assembler::kInstrSize)); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3056 for (int i = 0; i < kNumCases; ++i) { | 3057 for (int i = 0; i < kNumCases; ++i) { |
3057 __ bind(&labels[i]); | 3058 __ bind(&labels[i]); |
3058 __ lui(v0, (values[i] >> 16) & 0xffff); | 3059 __ lui(v0, (values[i] >> 16) & 0xffff); |
3059 __ ori(v0, v0, values[i] & 0xffff); | 3060 __ ori(v0, v0, values[i] & 0xffff); |
3060 __ b(&done); | 3061 __ b(&done); |
3061 __ nop(); | 3062 __ nop(); |
3062 } | 3063 } |
3063 | 3064 |
3064 __ bind(&dispatch); | 3065 __ bind(&dispatch); |
3065 { | 3066 { |
| 3067 __ BlockTrampolinePoolFor(kNumCases + 7); |
3066 PredictableCodeSizeScope predictable( | 3068 PredictableCodeSizeScope predictable( |
3067 &assm, (kNumCases + 7) * Assembler::kInstrSize); | 3069 &assm, (kNumCases + 7) * Assembler::kInstrSize); |
3068 Label here; | 3070 Label here; |
3069 | 3071 |
3070 __ bal(&here); | 3072 __ bal(&here); |
3071 __ nop(); | 3073 __ nop(); |
3072 __ bind(&here); | 3074 __ bind(&here); |
3073 __ sll(at, a0, 2); | 3075 __ sll(at, a0, 2); |
3074 __ addu(at, at, ra); | 3076 __ addu(at, at, ra); |
3075 __ lw(at, MemOperand(at, 5 * Assembler::kInstrSize)); | 3077 __ lw(at, MemOperand(at, 5 * Assembler::kInstrSize)); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3131 obj = *values[i]; | 3133 obj = *values[i]; |
3132 imm32 = reinterpret_cast<intptr_t>(obj); | 3134 imm32 = reinterpret_cast<intptr_t>(obj); |
3133 __ lui(v0, (imm32 >> 16) & 0xffff); | 3135 __ lui(v0, (imm32 >> 16) & 0xffff); |
3134 __ ori(v0, v0, imm32 & 0xffff); | 3136 __ ori(v0, v0, imm32 & 0xffff); |
3135 __ b(&done); | 3137 __ b(&done); |
3136 __ nop(); | 3138 __ nop(); |
3137 } | 3139 } |
3138 | 3140 |
3139 __ bind(&dispatch); | 3141 __ bind(&dispatch); |
3140 { | 3142 { |
| 3143 __ BlockTrampolinePoolFor(kNumCases + 7); |
3141 PredictableCodeSizeScope predictable( | 3144 PredictableCodeSizeScope predictable( |
3142 &assm, (kNumCases + 7) * Assembler::kInstrSize); | 3145 &assm, (kNumCases + 7) * Assembler::kInstrSize); |
3143 Label here; | 3146 Label here; |
3144 | 3147 |
3145 __ bal(&here); | 3148 __ bal(&here); |
3146 __ nop(); | 3149 __ nop(); |
3147 __ bind(&here); | 3150 __ bind(&here); |
3148 __ sll(at, a0, 2); | 3151 __ sll(at, a0, 2); |
3149 __ addu(at, at, ra); | 3152 __ addu(at, at, ra); |
3150 __ lw(at, MemOperand(at, 5 * Assembler::kInstrSize)); | 3153 __ lw(at, MemOperand(at, 5 * Assembler::kInstrSize)); |
(...skipping 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5050 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseBalc); | 5053 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseBalc); |
5051 for (size_t i = 0; i < nr_test_cases; ++i) { | 5054 for (size_t i = 0; i < nr_test_cases; ++i) { |
5052 int32_t res = run_balc(tc[i].offset); | 5055 int32_t res = run_balc(tc[i].offset); |
5053 CHECK_EQ(tc[i].expected_res, res); | 5056 CHECK_EQ(tc[i].expected_res, res); |
5054 } | 5057 } |
5055 } | 5058 } |
5056 } | 5059 } |
5057 | 5060 |
5058 | 5061 |
5059 #undef __ | 5062 #undef __ |
OLD | NEW |