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

Side by Side Diff: src/full-codegen/mips64/full-codegen-mips64.cc

Issue 1830133002: MIPS64: Replace JR/JALR with JIC/JIALC for r6. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | src/mips64/assembler-mips64.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 4044 matching lines...) Expand 10 before | Expand all | Expand 10 after
4055 } 4055 }
4056 4056
4057 #undef __ 4057 #undef __
4058 4058
4059 4059
4060 void BackEdgeTable::PatchAt(Code* unoptimized_code, 4060 void BackEdgeTable::PatchAt(Code* unoptimized_code,
4061 Address pc, 4061 Address pc,
4062 BackEdgeState target_state, 4062 BackEdgeState target_state,
4063 Code* replacement_code) { 4063 Code* replacement_code) {
4064 static const int kInstrSize = Assembler::kInstrSize; 4064 static const int kInstrSize = Assembler::kInstrSize;
4065 Address branch_address = pc - 8 * kInstrSize; 4065 Address branch_address;
4066 if (kArchVariant == kMips64r6) {
4067 branch_address = pc - 7 * kInstrSize;
4068 } else {
4069 branch_address = pc - 8 * kInstrSize;
4070 }
balazs.kilvady 2016/03/24 17:03:10 Could you use the same constant-based solution her
miran.karic 2016/03/25 09:30:09 Yes, I was planing to do that the same way as for
4066 Isolate* isolate = unoptimized_code->GetIsolate(); 4071 Isolate* isolate = unoptimized_code->GetIsolate();
4067 CodePatcher patcher(isolate, branch_address, 1); 4072 CodePatcher patcher(isolate, branch_address, 1);
4068 4073
4069 switch (target_state) { 4074 switch (target_state) {
4070 case INTERRUPT: 4075 case INTERRUPT:
4071 // slt at, a3, zero_reg (in case of count based interrupts) 4076 // slt at, a3, zero_reg (in case of count based interrupts)
4072 // beq at, zero_reg, ok 4077 // beq at, zero_reg, ok
4073 // lui t9, <interrupt stub address> upper 4078 // lui t9, <interrupt stub address> upper
4074 // ori t9, <interrupt stub address> u-middle 4079 // ori t9, <interrupt stub address> u-middle
4075 // dsll t9, t9, 16 4080 // dsll t9, t9, 16
4076 // ori t9, <interrupt stub address> lower 4081 // ori t9, <interrupt stub address> lower
4077 // jalr t9 4082 // jalr t9
4078 // nop 4083 // nop
4079 // ok-label ----- pc_after points here 4084 // ok-label ----- pc_after points here
4080 patcher.masm()->slt(at, a3, zero_reg); 4085 patcher.masm()->slt(at, a3, zero_reg);
4081 break; 4086 break;
4082 case ON_STACK_REPLACEMENT: 4087 case ON_STACK_REPLACEMENT:
4083 // addiu at, zero_reg, 1 4088 // addiu at, zero_reg, 1
4084 // beq at, zero_reg, ok ;; Not changed 4089 // beq at, zero_reg, ok ;; Not changed
4085 // lui t9, <on-stack replacement address> upper 4090 // lui t9, <on-stack replacement address> upper
4086 // ori t9, <on-stack replacement address> middle 4091 // ori t9, <on-stack replacement address> middle
4087 // dsll t9, t9, 16 4092 // dsll t9, t9, 16
4088 // ori t9, <on-stack replacement address> lower 4093 // ori t9, <on-stack replacement address> lower
4089 // jalr t9 ;; Not changed 4094 // jalr t9 ;; Not changed
4090 // nop ;; Not changed 4095 // nop ;; Not changed
4091 // ok-label ----- pc_after points here 4096 // ok-label ----- pc_after points here
4092 patcher.masm()->daddiu(at, zero_reg, 1); 4097 patcher.masm()->daddiu(at, zero_reg, 1);
4093 break; 4098 break;
4094 } 4099 }
4095 Address pc_immediate_load_address = pc - 6 * kInstrSize; 4100 Address pc_immediate_load_address;
4101 if (kArchVariant == kMips64r6) {
4102 pc_immediate_load_address = pc - 5 * kInstrSize;
4103 } else {
4104 pc_immediate_load_address = pc - 6 * kInstrSize;
4105 }
4096 // Replace the stack check address in the load-immediate (6-instr sequence) 4106 // Replace the stack check address in the load-immediate (6-instr sequence)
4097 // with the entry address of the replacement code. 4107 // with the entry address of the replacement code.
4098 Assembler::set_target_address_at(isolate, pc_immediate_load_address, 4108 Assembler::set_target_address_at(isolate, pc_immediate_load_address,
4099 replacement_code->entry()); 4109 replacement_code->entry());
4100 4110
4101 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( 4111 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch(
4102 unoptimized_code, pc_immediate_load_address, replacement_code); 4112 unoptimized_code, pc_immediate_load_address, replacement_code);
4103 } 4113 }
4104 4114
4105 4115
4106 BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState( 4116 BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState(
4107 Isolate* isolate, 4117 Isolate* isolate,
4108 Code* unoptimized_code, 4118 Code* unoptimized_code,
4109 Address pc) { 4119 Address pc) {
4110 static const int kInstrSize = Assembler::kInstrSize; 4120 static const int kInstrSize = Assembler::kInstrSize;
4111 Address branch_address = pc - 8 * kInstrSize; 4121 Address branch_address;
4112 #ifdef DEBUG 4122 #ifdef DEBUG
4113 Address pc_immediate_load_address = pc - 6 * kInstrSize; 4123 Address pc_immediate_load_address;
4114 #endif 4124 #endif
4125 if (kArchVariant == kMips64r6) {
4126 branch_address = pc - 7 * kInstrSize;
4127 #ifdef DEBUG
4128 pc_immediate_load_address = pc - 5 * kInstrSize;
4129 #endif
4130 DCHECK(Assembler::IsBeq(Assembler::instr_at(pc - 6 * kInstrSize)));
4131 } else {
4132 branch_address = pc - 8 * kInstrSize;
4133 #ifdef DEBUG
4134 pc_immediate_load_address = pc - 6 * kInstrSize;
4135 #endif
4136 DCHECK(Assembler::IsBeq(Assembler::instr_at(pc - 7 * kInstrSize)));
4137 }
4115 4138
4116 DCHECK(Assembler::IsBeq(Assembler::instr_at(pc - 7 * kInstrSize)));
4117 if (!Assembler::IsAddImmediate(Assembler::instr_at(branch_address))) { 4139 if (!Assembler::IsAddImmediate(Assembler::instr_at(branch_address))) {
4118 DCHECK(reinterpret_cast<uint64_t>( 4140 DCHECK(reinterpret_cast<uint64_t>(
4119 Assembler::target_address_at(pc_immediate_load_address)) == 4141 Assembler::target_address_at(pc_immediate_load_address)) ==
4120 reinterpret_cast<uint64_t>( 4142 reinterpret_cast<uint64_t>(
4121 isolate->builtins()->InterruptCheck()->entry())); 4143 isolate->builtins()->InterruptCheck()->entry()));
4122 return INTERRUPT; 4144 return INTERRUPT;
4123 } 4145 }
4124 4146
4125 DCHECK(Assembler::IsAddImmediate(Assembler::instr_at(branch_address))); 4147 DCHECK(Assembler::IsAddImmediate(Assembler::instr_at(branch_address)));
4126 4148
4127 DCHECK(reinterpret_cast<uint64_t>( 4149 DCHECK(reinterpret_cast<uint64_t>(
4128 Assembler::target_address_at(pc_immediate_load_address)) == 4150 Assembler::target_address_at(pc_immediate_load_address)) ==
4129 reinterpret_cast<uint64_t>( 4151 reinterpret_cast<uint64_t>(
4130 isolate->builtins()->OnStackReplacement()->entry())); 4152 isolate->builtins()->OnStackReplacement()->entry()));
4131 return ON_STACK_REPLACEMENT; 4153 return ON_STACK_REPLACEMENT;
4132 } 4154 }
4133 4155
4134 4156
4135 } // namespace internal 4157 } // namespace internal
4136 } // namespace v8 4158 } // namespace v8
4137 4159
4138 #endif // V8_TARGET_ARCH_MIPS64 4160 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « no previous file | src/mips64/assembler-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698