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 3208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3219 int values[kNumCases]; | 3219 int values[kNumCases]; |
3220 isolate->random_number_generator()->NextBytes(values, sizeof(values)); | 3220 isolate->random_number_generator()->NextBytes(values, sizeof(values)); |
3221 Label labels[kNumCases]; | 3221 Label labels[kNumCases]; |
3222 | 3222 |
3223 __ daddiu(sp, sp, -8); | 3223 __ daddiu(sp, sp, -8); |
3224 __ sd(ra, MemOperand(sp)); | 3224 __ sd(ra, MemOperand(sp)); |
3225 __ Align(8); | 3225 __ Align(8); |
3226 | 3226 |
3227 Label done; | 3227 Label done; |
3228 { | 3228 { |
3229 __ BlockTrampolinePoolFor(kNumCases * 2 + 7); | 3229 __ BlockTrampolinePoolFor(kNumCases * 2 + 6); |
3230 PredictableCodeSizeScope predictable( | 3230 PredictableCodeSizeScope predictable( |
3231 &assm, (kNumCases * 2 + 7) * Assembler::kInstrSize); | 3231 &assm, (kNumCases * 2 + 6) * Assembler::kInstrSize); |
3232 Label here; | 3232 Label here; |
3233 | 3233 |
3234 __ bal(&here); | 3234 __ bal(&here); |
3235 __ nop(); | 3235 __ dsll(at, a0, 3); // In delay slot. |
3236 __ bind(&here); | 3236 __ bind(&here); |
3237 __ dsll(at, a0, 3); | |
3238 __ daddu(at, at, ra); | 3237 __ daddu(at, at, ra); |
3239 __ ld(at, MemOperand(at, 5 * Assembler::kInstrSize)); | 3238 __ ld(at, MemOperand(at, 4 * Assembler::kInstrSize)); |
3240 __ jr(at); | 3239 __ jr(at); |
3241 __ nop(); | 3240 __ nop(); |
3242 for (int i = 0; i < kNumCases; ++i) { | 3241 for (int i = 0; i < kNumCases; ++i) { |
3243 __ dd(&labels[i]); | 3242 __ dd(&labels[i]); |
3244 } | 3243 } |
3245 } | 3244 } |
3246 | 3245 |
3247 for (int i = 0; i < kNumCases; ++i) { | 3246 for (int i = 0; i < kNumCases; ++i) { |
3248 __ bind(&labels[i]); | 3247 __ bind(&labels[i]); |
3249 __ lui(v0, (values[i] >> 16) & 0xffff); | 3248 __ lui(v0, (values[i] >> 16) & 0xffff); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3298 __ bind(&labels[i]); | 3297 __ bind(&labels[i]); |
3299 __ lui(v0, (values[i] >> 16) & 0xffff); | 3298 __ lui(v0, (values[i] >> 16) & 0xffff); |
3300 __ ori(v0, v0, values[i] & 0xffff); | 3299 __ ori(v0, v0, values[i] & 0xffff); |
3301 __ b(&done); | 3300 __ b(&done); |
3302 __ nop(); | 3301 __ nop(); |
3303 } | 3302 } |
3304 | 3303 |
3305 __ Align(8); | 3304 __ Align(8); |
3306 __ bind(&dispatch); | 3305 __ bind(&dispatch); |
3307 { | 3306 { |
3308 __ BlockTrampolinePoolFor(kNumCases * 2 + 7); | 3307 __ BlockTrampolinePoolFor(kNumCases * 2 + 6); |
3309 PredictableCodeSizeScope predictable( | 3308 PredictableCodeSizeScope predictable( |
3310 &assm, (kNumCases * 2 + 7) * Assembler::kInstrSize); | 3309 &assm, (kNumCases * 2 + 6) * Assembler::kInstrSize); |
3311 Label here; | 3310 Label here; |
3312 | 3311 |
3313 __ bal(&here); | 3312 __ bal(&here); |
3314 __ nop(); | 3313 __ dsll(at, a0, 3); // In delay slot. |
3315 __ bind(&here); | 3314 __ bind(&here); |
3316 __ dsll(at, a0, 3); | |
3317 __ daddu(at, at, ra); | 3315 __ daddu(at, at, ra); |
3318 __ ld(at, MemOperand(at, 5 * Assembler::kInstrSize)); | 3316 __ ld(at, MemOperand(at, 4 * Assembler::kInstrSize)); |
3319 __ jr(at); | 3317 __ jr(at); |
3320 __ nop(); | 3318 __ nop(); |
3321 for (int i = 0; i < kNumCases; ++i) { | 3319 for (int i = 0; i < kNumCases; ++i) { |
3322 __ dd(&labels[i]); | 3320 __ dd(&labels[i]); |
3323 } | 3321 } |
3324 } | 3322 } |
3325 | 3323 |
3326 __ bind(&done); | 3324 __ bind(&done); |
3327 __ ld(ra, MemOperand(sp)); | 3325 __ ld(ra, MemOperand(sp)); |
3328 __ daddiu(sp, sp, 8); | 3326 __ daddiu(sp, sp, 8); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3379 __ ori(v0, v0, (imm64 >> 16) & kImm16Mask); | 3377 __ ori(v0, v0, (imm64 >> 16) & kImm16Mask); |
3380 __ dsll(v0, v0, 16); | 3378 __ dsll(v0, v0, 16); |
3381 __ ori(v0, v0, imm64 & kImm16Mask); | 3379 __ ori(v0, v0, imm64 & kImm16Mask); |
3382 __ b(&done); | 3380 __ b(&done); |
3383 __ nop(); | 3381 __ nop(); |
3384 } | 3382 } |
3385 | 3383 |
3386 __ Align(8); | 3384 __ Align(8); |
3387 __ bind(&dispatch); | 3385 __ bind(&dispatch); |
3388 { | 3386 { |
3389 __ BlockTrampolinePoolFor(kNumCases * 2 + 7); | 3387 __ BlockTrampolinePoolFor(kNumCases * 2 + 6); |
3390 PredictableCodeSizeScope predictable( | 3388 PredictableCodeSizeScope predictable( |
3391 &assm, (kNumCases * 2 + 7) * Assembler::kInstrSize); | 3389 &assm, (kNumCases * 2 + 6) * Assembler::kInstrSize); |
3392 Label here; | 3390 Label here; |
3393 | 3391 |
3394 __ bal(&here); | 3392 __ bal(&here); |
3395 __ nop(); | 3393 __ dsll(at, a0, 3); // In delay slot. |
3396 __ bind(&here); | 3394 __ bind(&here); |
3397 __ dsll(at, a0, 3); | |
3398 __ daddu(at, at, ra); | 3395 __ daddu(at, at, ra); |
3399 __ ld(at, MemOperand(at, 5 * Assembler::kInstrSize)); | 3396 __ ld(at, MemOperand(at, 4 * Assembler::kInstrSize)); |
3400 __ jr(at); | 3397 __ jr(at); |
3401 __ nop(); | 3398 __ nop(); |
3402 for (int i = 0; i < kNumCases; ++i) { | 3399 for (int i = 0; i < kNumCases; ++i) { |
3403 __ dd(&labels[i]); | 3400 __ dd(&labels[i]); |
3404 } | 3401 } |
3405 } | 3402 } |
3406 | 3403 |
3407 __ bind(&done); | 3404 __ bind(&done); |
3408 __ ld(ra, MemOperand(sp)); | 3405 __ ld(ra, MemOperand(sp)); |
3409 __ daddiu(sp, sp, 8); | 3406 __ daddiu(sp, sp, 8); |
(...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5816 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 5813 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
5817 F2 f = FUNCTION_CAST<F2>(code->entry()); | 5814 F2 f = FUNCTION_CAST<F2>(code->entry()); |
5818 | 5815 |
5819 int64_t res = reinterpret_cast<int64_t>( | 5816 int64_t res = reinterpret_cast<int64_t>( |
5820 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); | 5817 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); |
5821 CHECK_EQ(res, 0); | 5818 CHECK_EQ(res, 0); |
5822 } | 5819 } |
5823 | 5820 |
5824 | 5821 |
5825 #undef __ | 5822 #undef __ |
OLD | NEW |