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

Side by Side Diff: src/mips/macro-assembler-mips.cc

Issue 7890001: MIPS: pre-crankshaft updates to code-stubs and stub-cache (3/3) (Closed)
Patch Set: Added code-patching, cache-flushing related to InstanceofStub and other review comments. Created 9 years, 3 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
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 for (int16_t i = kNumRegisters; i > 0; i--) { 807 for (int16_t i = kNumRegisters; i > 0; i--) {
808 if ((regs & (1 << i)) != 0) { 808 if ((regs & (1 << i)) != 0) {
809 ldc1(FPURegister::from_code(i), MemOperand(sp, stack_offset)); 809 ldc1(FPURegister::from_code(i), MemOperand(sp, stack_offset));
810 stack_offset += kDoubleSize; 810 stack_offset += kDoubleSize;
811 } 811 }
812 } 812 }
813 addiu(sp, sp, stack_offset); 813 addiu(sp, sp, stack_offset);
814 } 814 }
815 815
816 816
817 void MacroAssembler::FlushICache(Register address, unsigned instructions) {
818 RegList saved_regs = kJSCallerSaved | ra.bit();
819 MultiPush(saved_regs);
820
821 // Save to a0 in case address == t0.
822 Move(a0, address);
823 PrepareCallCFunction(2, t0);
824
825 li(a1, instructions * kInstrSize);
826 CallCFunction(ExternalReference::flush_icache_function(isolate()), 2);
827 MultiPop(saved_regs);
828 }
829
830
817 void MacroAssembler::Ext(Register rt, 831 void MacroAssembler::Ext(Register rt,
818 Register rs, 832 Register rs,
819 uint16_t pos, 833 uint16_t pos,
820 uint16_t size) { 834 uint16_t size) {
821 ASSERT(pos < 32); 835 ASSERT(pos < 32);
822 ASSERT(pos + size < 33); 836 ASSERT(pos + size < 33);
823 837
824 if (mips32r2) { 838 if (mips32r2) {
825 ext_(rt, rs, pos, size); 839 ext_(rt, rs, pos, size);
826 } else { 840 } else {
(...skipping 3508 matching lines...) Expand 10 before | Expand all | Expand 10 after
4335 lw(sp, MemOperand(sp, stack_passed_arguments * kPointerSize)); 4349 lw(sp, MemOperand(sp, stack_passed_arguments * kPointerSize));
4336 } else { 4350 } else {
4337 Addu(sp, sp, Operand(stack_passed_arguments * sizeof(kPointerSize))); 4351 Addu(sp, sp, Operand(stack_passed_arguments * sizeof(kPointerSize)));
4338 } 4352 }
4339 } 4353 }
4340 4354
4341 4355
4342 #undef BRANCH_ARGS_CHECK 4356 #undef BRANCH_ARGS_CHECK
4343 4357
4344 4358
4359 void MacroAssembler::PatchRelocatedValue(Register li_location,
4360 Register scratch,
4361 Register new_value) {
4362 lw(scratch, MemOperand(li_location));
4363 // At this point scratch is a lui(at, ...) instruction.
4364 if (emit_debug_code()) {
4365 And(scratch, scratch, kOpcodeMask);
4366 Check(eq, "The instruction to patch should be a lui.",
4367 scratch, Operand(LUI));
4368 lw(scratch, MemOperand(li_location));
4369 }
4370 srl(t9, new_value, kImm16Bits);
4371 Ins(scratch, t9, 0, kImm16Bits);
4372 sw(scratch, MemOperand(li_location));
4373
4374 lw(scratch, MemOperand(li_location, kInstrSize));
4375 // scratch is now ori(at, ...).
4376 if (emit_debug_code()) {
4377 And(scratch, scratch, kOpcodeMask);
4378 Check(eq, "The instruction to patch should be an ori.",
4379 scratch, Operand(ORI));
4380 lw(scratch, MemOperand(li_location, kInstrSize));
4381 }
4382 Ins(scratch, new_value, 0, kImm16Bits);
4383 sw(scratch, MemOperand(li_location, kInstrSize));
4384
4385 // Update the I-cache so the new lui and ori can be executed.
4386 FlushICache(li_location, 2);
4387 }
4388
4389
4345 void MacroAssembler::LoadInstanceDescriptors(Register map, 4390 void MacroAssembler::LoadInstanceDescriptors(Register map,
4346 Register descriptors) { 4391 Register descriptors) {
4347 lw(descriptors, 4392 lw(descriptors,
4348 FieldMemOperand(map, Map::kInstanceDescriptorsOrBitField3Offset)); 4393 FieldMemOperand(map, Map::kInstanceDescriptorsOrBitField3Offset));
4349 Label not_smi; 4394 Label not_smi;
4350 JumpIfNotSmi(descriptors, &not_smi); 4395 JumpIfNotSmi(descriptors, &not_smi);
4351 li(descriptors, Operand(FACTORY->empty_descriptor_array())); 4396 li(descriptors, Operand(FACTORY->empty_descriptor_array()));
4352 bind(&not_smi); 4397 bind(&not_smi);
4353 } 4398 }
4354 4399
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
4403 opcode == BGTZL); 4448 opcode == BGTZL);
4404 opcode = (cond == eq) ? BEQ : BNE; 4449 opcode = (cond == eq) ? BEQ : BNE;
4405 instr = (instr & ~kOpcodeMask) | opcode; 4450 instr = (instr & ~kOpcodeMask) | opcode;
4406 masm_.emit(instr); 4451 masm_.emit(instr);
4407 } 4452 }
4408 4453
4409 4454
4410 } } // namespace v8::internal 4455 } } // namespace v8::internal
4411 4456
4412 #endif // V8_TARGET_ARCH_MIPS 4457 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698