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

Side by Side Diff: src/mips/builtins-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 | « no previous file | src/mips/codegen-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 5
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #if V8_TARGET_ARCH_MIPS 9 #if V8_TARGET_ARCH_MIPS
10 10
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 1017
1018 1018
1019 1019
1020 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { 1020 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) {
1021 // For now, we are relying on the fact that make_code_young doesn't do any 1021 // For now, we are relying on the fact that make_code_young doesn't do any
1022 // garbage collection which allows us to save/restore the registers without 1022 // garbage collection which allows us to save/restore the registers without
1023 // worrying about which of them contain pointers. We also don't build an 1023 // worrying about which of them contain pointers. We also don't build an
1024 // internal frame to make the code faster, since we shouldn't have to do stack 1024 // internal frame to make the code faster, since we shouldn't have to do stack
1025 // crawls in MakeCodeYoung. This seems a bit fragile. 1025 // crawls in MakeCodeYoung. This seems a bit fragile.
1026 1026
1027 // Set a0 to point to the head of the PlatformCodeAge sequence. 1027 // Set a0 to point to the head of the PlatformCodeAge sequence, using ret adr.
1028 __ mov(a0, ra);
1028 __ Subu(a0, a0, 1029 __ Subu(a0, a0,
1029 Operand(kNoCodeAgeSequenceLength - Assembler::kInstrSize)); 1030 Operand(kNoCodeAgeSequenceLength - Assembler::kInstrSize));
1031 // Restore the original return address of the function
1032 __ mov(ra, at);
1030 1033
1031 // The following registers must be saved and restored when calling through to 1034 // The following registers must be saved and restored when calling through to
1032 // the runtime: 1035 // the runtime:
1033 // a0 - contains return address (beginning of patch sequence) 1036 // a0 - contains return address (beginning of patch sequence)
1034 // a1 - isolate 1037 // a1 - isolate
1035 RegList saved_regs = 1038 RegList saved_regs =
1036 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit(); 1039 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit();
1037 FrameScope scope(masm, StackFrame::MANUAL); 1040 FrameScope scope(masm, StackFrame::MANUAL);
1038 __ MultiPush(saved_regs); 1041 __ MultiPush(saved_regs);
1039 __ PrepareCallCFunction(2, 0, a2); 1042 __ PrepareCallCFunction(2, 0, a2);
(...skipping 16 matching lines...) Expand all
1056 CODE_AGE_LIST(DEFINE_CODE_AGE_BUILTIN_GENERATOR) 1059 CODE_AGE_LIST(DEFINE_CODE_AGE_BUILTIN_GENERATOR)
1057 #undef DEFINE_CODE_AGE_BUILTIN_GENERATOR 1060 #undef DEFINE_CODE_AGE_BUILTIN_GENERATOR
1058 1061
1059 1062
1060 void Builtins::Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm) { 1063 void Builtins::Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm) {
1061 // For now, as in GenerateMakeCodeYoungAgainCommon, we are relying on the fact 1064 // For now, as in GenerateMakeCodeYoungAgainCommon, we are relying on the fact
1062 // that make_code_young doesn't do any garbage collection which allows us to 1065 // that make_code_young doesn't do any garbage collection which allows us to
1063 // save/restore the registers without worrying about which of them contain 1066 // save/restore the registers without worrying about which of them contain
1064 // pointers. 1067 // pointers.
1065 1068
1066 // Set a0 to point to the head of the PlatformCodeAge sequence. 1069 // Set a0 to point to the head of the PlatformCodeAge sequence, using ret adr.
1070 __ mov(a0, ra);
1067 __ Subu(a0, a0, 1071 __ Subu(a0, a0,
1068 Operand(kNoCodeAgeSequenceLength - Assembler::kInstrSize)); 1072 Operand(kNoCodeAgeSequenceLength - Assembler::kInstrSize));
1073 // Restore the original return address of the function
1074 __ mov(ra, at);
1069 1075
1070 // The following registers must be saved and restored when calling through to 1076 // The following registers must be saved and restored when calling through to
1071 // the runtime: 1077 // the runtime:
1072 // a0 - contains return address (beginning of patch sequence) 1078 // a0 - contains return address (beginning of patch sequence)
1073 // a1 - isolate 1079 // a1 - isolate
1074 RegList saved_regs = 1080 RegList saved_regs =
1075 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit(); 1081 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit();
1076 FrameScope scope(masm, StackFrame::MANUAL); 1082 FrameScope scope(masm, StackFrame::MANUAL);
1077 __ MultiPush(saved_regs); 1083 __ MultiPush(saved_regs);
1078 __ PrepareCallCFunction(2, 0, a2); 1084 __ PrepareCallCFunction(2, 0, a2);
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 } 1862 }
1857 } 1863 }
1858 1864
1859 1865
1860 #undef __ 1866 #undef __
1861 1867
1862 } // namespace internal 1868 } // namespace internal
1863 } // namespace v8 1869 } // namespace v8
1864 1870
1865 #endif // V8_TARGET_ARCH_MIPS 1871 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698