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 3204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3215 HandleScope scope(isolate); | 3215 HandleScope scope(isolate); |
3216 Assembler assm(isolate, nullptr, 0); | 3216 Assembler assm(isolate, nullptr, 0); |
3217 | 3217 |
3218 const int kNumCases = 512; | 3218 const int kNumCases = 512; |
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 if ((assm.pc_offset() & 7) == 0) { | 3225 __ Align(8); |
3226 __ nop(); | |
3227 } | |
3228 | 3226 |
3229 Label done; | 3227 Label done; |
3230 { | 3228 { |
3231 __ BlockTrampolinePoolFor(kNumCases * 2 + 7); | 3229 __ BlockTrampolinePoolFor(kNumCases * 2 + 7); |
3232 PredictableCodeSizeScope predictable( | 3230 PredictableCodeSizeScope predictable( |
3233 &assm, (kNumCases * 2 + 7) * Assembler::kInstrSize); | 3231 &assm, (kNumCases * 2 + 7) * Assembler::kInstrSize); |
3234 Label here; | 3232 Label here; |
3235 | 3233 |
3236 __ bal(&here); | 3234 __ bal(&here); |
3237 __ nop(); | 3235 __ nop(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3297 __ nop(); | 3295 __ nop(); |
3298 | 3296 |
3299 for (int i = 0; i < kNumCases; ++i) { | 3297 for (int i = 0; i < kNumCases; ++i) { |
3300 __ bind(&labels[i]); | 3298 __ bind(&labels[i]); |
3301 __ lui(v0, (values[i] >> 16) & 0xffff); | 3299 __ lui(v0, (values[i] >> 16) & 0xffff); |
3302 __ ori(v0, v0, values[i] & 0xffff); | 3300 __ ori(v0, v0, values[i] & 0xffff); |
3303 __ b(&done); | 3301 __ b(&done); |
3304 __ nop(); | 3302 __ nop(); |
3305 } | 3303 } |
3306 | 3304 |
3307 if ((assm.pc_offset() & 7) == 0) { | 3305 __ Align(8); |
3308 __ nop(); | |
3309 } | |
3310 __ bind(&dispatch); | 3306 __ bind(&dispatch); |
3311 { | 3307 { |
3312 __ BlockTrampolinePoolFor(kNumCases * 2 + 7); | 3308 __ BlockTrampolinePoolFor(kNumCases * 2 + 7); |
3313 PredictableCodeSizeScope predictable( | 3309 PredictableCodeSizeScope predictable( |
3314 &assm, (kNumCases * 2 + 7) * Assembler::kInstrSize); | 3310 &assm, (kNumCases * 2 + 7) * Assembler::kInstrSize); |
3315 Label here; | 3311 Label here; |
3316 | 3312 |
3317 __ bal(&here); | 3313 __ bal(&here); |
3318 __ nop(); | 3314 __ nop(); |
3319 __ bind(&here); | 3315 __ bind(&here); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3365 } | 3361 } |
3366 Label labels[kNumCases]; | 3362 Label labels[kNumCases]; |
3367 Object* obj; | 3363 Object* obj; |
3368 int64_t imm64; | 3364 int64_t imm64; |
3369 | 3365 |
3370 __ daddiu(sp, sp, -8); | 3366 __ daddiu(sp, sp, -8); |
3371 __ sd(ra, MemOperand(sp)); | 3367 __ sd(ra, MemOperand(sp)); |
3372 | 3368 |
3373 Label done, dispatch; | 3369 Label done, dispatch; |
3374 __ b(&dispatch); | 3370 __ b(&dispatch); |
| 3371 __ nop(); |
3375 | 3372 |
3376 | 3373 |
3377 for (int i = 0; i < kNumCases; ++i) { | 3374 for (int i = 0; i < kNumCases; ++i) { |
3378 __ bind(&labels[i]); | 3375 __ bind(&labels[i]); |
3379 obj = *values[i]; | 3376 obj = *values[i]; |
3380 imm64 = reinterpret_cast<intptr_t>(obj); | 3377 imm64 = reinterpret_cast<intptr_t>(obj); |
3381 __ lui(v0, (imm64 >> 32) & kImm16Mask); | 3378 __ lui(v0, (imm64 >> 32) & kImm16Mask); |
3382 __ ori(v0, v0, (imm64 >> 16) & kImm16Mask); | 3379 __ ori(v0, v0, (imm64 >> 16) & kImm16Mask); |
3383 __ dsll(v0, v0, 16); | 3380 __ dsll(v0, v0, 16); |
3384 __ ori(v0, v0, imm64 & kImm16Mask); | 3381 __ ori(v0, v0, imm64 & kImm16Mask); |
3385 __ b(&done); | 3382 __ b(&done); |
3386 __ nop(); | 3383 __ nop(); |
3387 } | 3384 } |
3388 | 3385 |
3389 __ stop("chk"); | 3386 __ Align(8); |
3390 if ((assm.pc_offset() & 7) == 0) { | |
3391 __ nop(); | |
3392 } | |
3393 __ bind(&dispatch); | 3387 __ bind(&dispatch); |
3394 { | 3388 { |
3395 __ BlockTrampolinePoolFor(kNumCases * 2 + 7); | 3389 __ BlockTrampolinePoolFor(kNumCases * 2 + 7); |
3396 PredictableCodeSizeScope predictable( | 3390 PredictableCodeSizeScope predictable( |
3397 &assm, (kNumCases * 2 + 7) * Assembler::kInstrSize); | 3391 &assm, (kNumCases * 2 + 7) * Assembler::kInstrSize); |
3398 Label here; | 3392 Label here; |
3399 | 3393 |
3400 __ bal(&here); | 3394 __ bal(&here); |
3401 __ nop(); | 3395 __ nop(); |
3402 __ bind(&here); | 3396 __ bind(&here); |
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5540 HandleScope scope(isolate); | 5534 HandleScope scope(isolate); |
5541 | 5535 |
5542 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); | 5536 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); |
5543 | 5537 |
5544 Label continue_1, stop_execution; | 5538 Label continue_1, stop_execution; |
5545 __ push(ra); | 5539 __ push(ra); |
5546 __ li(v0, 0); | 5540 __ li(v0, 0); |
5547 __ li(t8, 0); | 5541 __ li(t8, 0); |
5548 __ li(t9, 2); // Condition for the stopping execution. | 5542 __ li(t9, 2); // Condition for the stopping execution. |
5549 | 5543 |
5550 uint32_t instruction_addiu = 0x24420001; // addiu v0, v0, 1 | |
5551 for (int32_t i = -100; i <= -11; ++i) { | 5544 for (int32_t i = -100; i <= -11; ++i) { |
5552 __ dd(instruction_addiu); | 5545 __ addiu(v0, v0, 1); |
5553 } | 5546 } |
5554 | 5547 |
5555 __ addiu(t8, t8, 1); // -10 | 5548 __ addiu(t8, t8, 1); // -10 |
5556 | 5549 |
5557 __ beq(t8, t9, &stop_execution); // -9 | 5550 __ beq(t8, t9, &stop_execution); // -9 |
5558 __ nop(); // -8 | 5551 __ nop(); // -8 |
5559 __ beq(t8, t8, &continue_1); // -7 | 5552 __ beq(t8, t8, &continue_1); // -7 |
5560 __ nop(); // -6 | 5553 __ nop(); // -6 |
5561 | 5554 |
5562 __ bind(&stop_execution); | 5555 __ bind(&stop_execution); |
5563 __ pop(ra); // -5, -4 | 5556 __ pop(ra); // -5, -4 |
5564 __ jr(ra); // -3 | 5557 __ jr(ra); // -3 |
5565 __ nop(); // -2 | 5558 __ nop(); // -2 |
5566 | 5559 |
5567 __ bind(&continue_1); | 5560 __ bind(&continue_1); |
5568 __ bc(offset); // -1 | 5561 __ bc(offset); // -1 |
5569 | 5562 |
5570 for (int32_t i = 0; i <= 99; ++i) { | 5563 for (int32_t i = 0; i <= 99; ++i) { |
5571 __ dd(instruction_addiu); | 5564 __ addiu(v0, v0, 1); |
5572 } | 5565 } |
5573 | 5566 |
5574 __ pop(ra); | 5567 __ pop(ra); |
5575 __ jr(ra); | 5568 __ jr(ra); |
5576 __ nop(); | 5569 __ nop(); |
5577 | 5570 |
5578 CodeDesc desc; | 5571 CodeDesc desc; |
5579 assm.GetCode(&desc); | 5572 assm.GetCode(&desc); |
5580 Handle<Code> code = isolate->factory()->NewCode( | 5573 Handle<Code> code = isolate->factory()->NewCode( |
5581 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 5574 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5823 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 5816 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
5824 F2 f = FUNCTION_CAST<F2>(code->entry()); | 5817 F2 f = FUNCTION_CAST<F2>(code->entry()); |
5825 | 5818 |
5826 int64_t res = reinterpret_cast<int64_t>( | 5819 int64_t res = reinterpret_cast<int64_t>( |
5827 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); | 5820 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); |
5828 CHECK_EQ(res, 0); | 5821 CHECK_EQ(res, 0); |
5829 } | 5822 } |
5830 | 5823 |
5831 | 5824 |
5832 #undef __ | 5825 #undef __ |
OLD | NEW |