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

Side by Side Diff: src/mips/codegen-mips.cc

Issue 1218743010: MIPS: Avoid use of a0 as return address in jalr. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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/builtins-mips.cc ('k') | src/mips/macro-assembler-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 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 Code* stub = GetCodeAgeStub(isolate, age, parity); 1245 Code* stub = GetCodeAgeStub(isolate, age, parity);
1246 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); 1246 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize);
1247 // Mark this code sequence for FindPlatformCodeAgeSequence(). 1247 // Mark this code sequence for FindPlatformCodeAgeSequence().
1248 patcher.masm()->nop(Assembler::CODE_AGE_MARKER_NOP); 1248 patcher.masm()->nop(Assembler::CODE_AGE_MARKER_NOP);
1249 // Load the stub address to t9 and call it, 1249 // Load the stub address to t9 and call it,
1250 // GetCodeAgeAndParity() extracts the stub address from this instruction. 1250 // GetCodeAgeAndParity() extracts the stub address from this instruction.
1251 patcher.masm()->li( 1251 patcher.masm()->li(
1252 t9, 1252 t9,
1253 Operand(reinterpret_cast<uint32_t>(stub->instruction_start())), 1253 Operand(reinterpret_cast<uint32_t>(stub->instruction_start())),
1254 CONSTANT_SIZE); 1254 CONSTANT_SIZE);
1255 patcher.masm()->nop(); // Prevent jalr to jal optimization. 1255 // Save the function's original return address.
1256 patcher.masm()->jalr(t9, a0); 1256 patcher.masm()->mov(at, ra); // This also prevents jalr->jal optimization.
1257 patcher.masm()->jalr(t9);
1257 patcher.masm()->nop(); // Branch delay slot nop. 1258 patcher.masm()->nop(); // Branch delay slot nop.
1258 patcher.masm()->nop(); // Pad the empty space. 1259 patcher.masm()->nop(); // Pad the empty space.
1259 } 1260 }
1260 } 1261 }
1261 1262
1262 1263
1263 #undef __ 1264 #undef __
1264 1265
1265 } // namespace internal 1266 } // namespace internal
1266 } // namespace v8 1267 } // namespace v8
1267 1268
1268 #endif // V8_TARGET_ARCH_MIPS 1269 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/mips/macro-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698