OLD | NEW |
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/mips64/codegen-mips64.h" | 5 #include "src/mips64/codegen-mips64.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
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 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 #endif | 1184 #endif |
1185 | 1185 |
1186 | 1186 |
1187 CodeAgingHelper::CodeAgingHelper(Isolate* isolate) { | 1187 CodeAgingHelper::CodeAgingHelper(Isolate* isolate) { |
1188 USE(isolate); | 1188 USE(isolate); |
1189 DCHECK(young_sequence_.length() == kNoCodeAgeSequenceLength); | 1189 DCHECK(young_sequence_.length() == kNoCodeAgeSequenceLength); |
1190 // Since patcher is a large object, allocate it dynamically when needed, | 1190 // Since patcher is a large object, allocate it dynamically when needed, |
1191 // to avoid overloading the stack in stress conditions. | 1191 // to avoid overloading the stack in stress conditions. |
1192 // DONT_FLUSH is used because the CodeAgingHelper is initialized early in | 1192 // DONT_FLUSH is used because the CodeAgingHelper is initialized early in |
1193 // the process, before MIPS simulator ICache is setup. | 1193 // the process, before MIPS simulator ICache is setup. |
1194 base::SmartPointer<CodePatcher> patcher(new CodePatcher( | 1194 base::SmartPointer<CodePatcher> patcher( |
1195 young_sequence_.start(), young_sequence_.length() / Assembler::kInstrSize, | 1195 new CodePatcher(isolate, young_sequence_.start(), |
1196 CodePatcher::DONT_FLUSH)); | 1196 young_sequence_.length() / Assembler::kInstrSize, |
| 1197 CodePatcher::DONT_FLUSH)); |
1197 PredictableCodeSizeScope scope(patcher->masm(), young_sequence_.length()); | 1198 PredictableCodeSizeScope scope(patcher->masm(), young_sequence_.length()); |
1198 patcher->masm()->Push(ra, fp, cp, a1); | 1199 patcher->masm()->Push(ra, fp, cp, a1); |
1199 patcher->masm()->nop(Assembler::CODE_AGE_SEQUENCE_NOP); | 1200 patcher->masm()->nop(Assembler::CODE_AGE_SEQUENCE_NOP); |
1200 patcher->masm()->nop(Assembler::CODE_AGE_SEQUENCE_NOP); | 1201 patcher->masm()->nop(Assembler::CODE_AGE_SEQUENCE_NOP); |
1201 patcher->masm()->nop(Assembler::CODE_AGE_SEQUENCE_NOP); | 1202 patcher->masm()->nop(Assembler::CODE_AGE_SEQUENCE_NOP); |
1202 patcher->masm()->Daddu( | 1203 patcher->masm()->Daddu( |
1203 fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 1204 fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
1204 } | 1205 } |
1205 | 1206 |
1206 | 1207 |
(...skipping 28 matching lines...) Expand all Loading... |
1235 void Code::PatchPlatformCodeAge(Isolate* isolate, | 1236 void Code::PatchPlatformCodeAge(Isolate* isolate, |
1236 byte* sequence, | 1237 byte* sequence, |
1237 Code::Age age, | 1238 Code::Age age, |
1238 MarkingParity parity) { | 1239 MarkingParity parity) { |
1239 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); | 1240 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); |
1240 if (age == kNoAgeCodeAge) { | 1241 if (age == kNoAgeCodeAge) { |
1241 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); | 1242 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); |
1242 Assembler::FlushICache(isolate, sequence, young_length); | 1243 Assembler::FlushICache(isolate, sequence, young_length); |
1243 } else { | 1244 } else { |
1244 Code* stub = GetCodeAgeStub(isolate, age, parity); | 1245 Code* stub = GetCodeAgeStub(isolate, age, parity); |
1245 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); | 1246 CodePatcher patcher(isolate, sequence, |
| 1247 young_length / Assembler::kInstrSize); |
1246 // Mark this code sequence for FindPlatformCodeAgeSequence(). | 1248 // Mark this code sequence for FindPlatformCodeAgeSequence(). |
1247 patcher.masm()->nop(Assembler::CODE_AGE_MARKER_NOP); | 1249 patcher.masm()->nop(Assembler::CODE_AGE_MARKER_NOP); |
1248 // Load the stub address to t9 and call it, | 1250 // Load the stub address to t9 and call it, |
1249 // GetCodeAgeAndParity() extracts the stub address from this instruction. | 1251 // GetCodeAgeAndParity() extracts the stub address from this instruction. |
1250 patcher.masm()->li( | 1252 patcher.masm()->li( |
1251 t9, | 1253 t9, |
1252 Operand(reinterpret_cast<uint64_t>(stub->instruction_start())), | 1254 Operand(reinterpret_cast<uint64_t>(stub->instruction_start())), |
1253 ADDRESS_LOAD); | 1255 ADDRESS_LOAD); |
1254 patcher.masm()->nop(); // Prevent jalr to jal optimization. | 1256 patcher.masm()->nop(); // Prevent jalr to jal optimization. |
1255 patcher.masm()->jalr(t9, a0); | 1257 patcher.masm()->jalr(t9, a0); |
1256 patcher.masm()->nop(); // Branch delay slot nop. | 1258 patcher.masm()->nop(); // Branch delay slot nop. |
1257 patcher.masm()->nop(); // Pad the empty space. | 1259 patcher.masm()->nop(); // Pad the empty space. |
1258 } | 1260 } |
1259 } | 1261 } |
1260 | 1262 |
1261 | 1263 |
1262 #undef __ | 1264 #undef __ |
1263 | 1265 |
1264 } // namespace internal | 1266 } // namespace internal |
1265 } // namespace v8 | 1267 } // namespace v8 |
1266 | 1268 |
1267 #endif // V8_TARGET_ARCH_MIPS64 | 1269 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |