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