Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: test/cctest/test-assembler-mips64.cc

Issue 1573953002: MIPS: Fix dd() implementations for compact branches. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 3354 matching lines...) Expand 10 before | Expand all | Expand 10 after
3365 } 3365 }
3366 Label labels[kNumCases]; 3366 Label labels[kNumCases];
3367 Object* obj; 3367 Object* obj;
3368 int64_t imm64; 3368 int64_t imm64;
3369 3369
3370 __ daddiu(sp, sp, -8); 3370 __ daddiu(sp, sp, -8);
3371 __ sd(ra, MemOperand(sp)); 3371 __ sd(ra, MemOperand(sp));
3372 3372
3373 Label done, dispatch; 3373 Label done, dispatch;
3374 __ b(&dispatch); 3374 __ b(&dispatch);
3375 __ nop();
3375 3376
3376 3377
3377 for (int i = 0; i < kNumCases; ++i) { 3378 for (int i = 0; i < kNumCases; ++i) {
3378 __ bind(&labels[i]); 3379 __ bind(&labels[i]);
3379 obj = *values[i]; 3380 obj = *values[i];
3380 imm64 = reinterpret_cast<intptr_t>(obj); 3381 imm64 = reinterpret_cast<intptr_t>(obj);
3381 __ lui(v0, (imm64 >> 32) & kImm16Mask); 3382 __ lui(v0, (imm64 >> 32) & kImm16Mask);
3382 __ ori(v0, v0, (imm64 >> 16) & kImm16Mask); 3383 __ ori(v0, v0, (imm64 >> 16) & kImm16Mask);
3383 __ dsll(v0, v0, 16); 3384 __ dsll(v0, v0, 16);
3384 __ ori(v0, v0, imm64 & kImm16Mask); 3385 __ ori(v0, v0, imm64 & kImm16Mask);
3385 __ b(&done); 3386 __ b(&done);
3386 __ nop(); 3387 __ nop();
3387 } 3388 }
3388 3389
3389 __ stop("chk");
3390 if ((assm.pc_offset() & 7) == 0) { 3390 if ((assm.pc_offset() & 7) == 0) {
3391 __ nop(); 3391 __ nop();
ivica.bogosavljevic 2016/01/12 15:14:29 This should probably be __ Align(8), right?
balazs.kilvady 2016/01/12 17:49:48 Done.
3392 } 3392 }
3393 __ bind(&dispatch); 3393 __ bind(&dispatch);
3394 { 3394 {
3395 __ BlockTrampolinePoolFor(kNumCases * 2 + 7); 3395 __ BlockTrampolinePoolFor(kNumCases * 2 + 7);
3396 PredictableCodeSizeScope predictable( 3396 PredictableCodeSizeScope predictable(
3397 &assm, (kNumCases * 2 + 7) * Assembler::kInstrSize); 3397 &assm, (kNumCases * 2 + 7) * Assembler::kInstrSize);
3398 Label here; 3398 Label here;
3399 3399
3400 __ bal(&here); 3400 __ bal(&here);
3401 __ nop(); 3401 __ nop();
(...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after
5540 HandleScope scope(isolate); 5540 HandleScope scope(isolate);
5541 5541
5542 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); 5542 MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes);
5543 5543
5544 Label continue_1, stop_execution; 5544 Label continue_1, stop_execution;
5545 __ push(ra); 5545 __ push(ra);
5546 __ li(v0, 0); 5546 __ li(v0, 0);
5547 __ li(t8, 0); 5547 __ li(t8, 0);
5548 __ li(t9, 2); // Condition for the stopping execution. 5548 __ li(t9, 2); // Condition for the stopping execution.
5549 5549
5550 uint32_t instruction_addiu = 0x24420001; // addiu v0, v0, 1
5551 for (int32_t i = -100; i <= -11; ++i) { 5550 for (int32_t i = -100; i <= -11; ++i) {
5552 __ dd(instruction_addiu); 5551 __ addiu(v0, v0, 1);
5553 } 5552 }
5554 5553
5555 __ addiu(t8, t8, 1); // -10 5554 __ addiu(t8, t8, 1); // -10
5556 5555
5557 __ beq(t8, t9, &stop_execution); // -9 5556 __ beq(t8, t9, &stop_execution); // -9
5558 __ nop(); // -8 5557 __ nop(); // -8
5559 __ beq(t8, t8, &continue_1); // -7 5558 __ beq(t8, t8, &continue_1); // -7
5560 __ nop(); // -6 5559 __ nop(); // -6
5561 5560
5562 __ bind(&stop_execution); 5561 __ bind(&stop_execution);
5563 __ pop(ra); // -5, -4 5562 __ pop(ra); // -5, -4
5564 __ jr(ra); // -3 5563 __ jr(ra); // -3
5565 __ nop(); // -2 5564 __ nop(); // -2
5566 5565
5567 __ bind(&continue_1); 5566 __ bind(&continue_1);
5568 __ bc(offset); // -1 5567 __ bc(offset); // -1
5569 5568
5570 for (int32_t i = 0; i <= 99; ++i) { 5569 for (int32_t i = 0; i <= 99; ++i) {
5571 __ dd(instruction_addiu); 5570 __ addiu(v0, v0, 1);
5572 } 5571 }
5573 5572
5574 __ pop(ra); 5573 __ pop(ra);
5575 __ jr(ra); 5574 __ jr(ra);
5576 __ nop(); 5575 __ nop();
5577 5576
5578 CodeDesc desc; 5577 CodeDesc desc;
5579 assm.GetCode(&desc); 5578 assm.GetCode(&desc);
5580 Handle<Code> code = isolate->factory()->NewCode( 5579 Handle<Code> code = isolate->factory()->NewCode(
5581 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 5580 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
5823 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 5822 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
5824 F2 f = FUNCTION_CAST<F2>(code->entry()); 5823 F2 f = FUNCTION_CAST<F2>(code->entry());
5825 5824
5826 int64_t res = reinterpret_cast<int64_t>( 5825 int64_t res = reinterpret_cast<int64_t>(
5827 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0)); 5826 CALL_GENERATED_CODE(isolate, f, 42, 42, 0, 0, 0));
5828 CHECK_EQ(res, 0); 5827 CHECK_EQ(res, 0);
5829 } 5828 }
5830 5829
5831 5830
5832 #undef __ 5831 #undef __
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698