| OLD | NEW |
| 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
| 2 // All Rights Reserved. | 2 // All Rights Reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
| 6 // are met: | 6 // are met: |
| 7 // | 7 // |
| 8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
| 9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
| 10 // | 10 // |
| (...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1152 private: | 1152 private: |
| 1153 Assembler* assem_; | 1153 Assembler* assem_; |
| 1154 | 1154 |
| 1155 DISALLOW_IMPLICIT_CONSTRUCTORS(BlockConstPoolScope); | 1155 DISALLOW_IMPLICIT_CONSTRUCTORS(BlockConstPoolScope); |
| 1156 }; | 1156 }; |
| 1157 | 1157 |
| 1158 // Postpone the generation of the constant pool for the specified number of | 1158 // Postpone the generation of the constant pool for the specified number of |
| 1159 // instructions. | 1159 // instructions. |
| 1160 void BlockConstPoolFor(int instructions); | 1160 void BlockConstPoolFor(int instructions); |
| 1161 | 1161 |
| 1162 // This class is used to reduce the amount of code generated at deoptimization |
| 1163 // check sites in the optimized code. |
| 1164 // When the LCodeGen generates a deoptimization check (with |
| 1165 // LCodeGen::DeoptimizeIf()), a DeoptJumpEntry is stored in a buffer until a |
| 1166 // deoptimization jump table is emitted. |
| 1167 // |
| 1168 // deoptimization jump tables are emitted along with constant pools. (See |
| 1169 // Assembler::CheckConstPool().) |
| 1170 // When generating a deoptimization jump table, code will be generated for |
| 1171 // each registered DeoptJumpEntry to jump to the code handling the |
| 1172 // deoptimization. |
| 1173 // |
| 1174 // deopt check k: bcond offset_to_table_check_k // Almost never taken. |
| 1175 // [... more code ...] |
| 1176 // |
| 1177 // [ Constant pool |
| 1178 // [ Deoptimization jump table |
| 1179 // deopt jump table + 0x0: ldr pc, relocated_entry_for_check_0 |
| 1180 // deopt jump table + 0x4: ldr pc, relocated_entry_for_check_1 |
| 1181 // [...] ldr pc, ... |
| 1182 // deopt jump table + n * 0x4: ldr pc, relocated_entry_for_check_n |
| 1183 // ] |
| 1184 // [ Constant pool entries |
| 1185 // [... standard constant pool entries ...] |
| 1186 // [... additional constant pool entries for the deopt jump table ...] |
| 1187 // ] |
| 1188 // ] |
| 1189 |
| 1190 class DeoptJumpEntry BASE_EMBEDDED { |
| 1191 public: |
| 1192 DeoptJumpEntry() {} |
| 1193 DeoptJumpEntry(int pc_offset, Condition cond, Address entry) |
| 1194 : pc_offset_(pc_offset), cond_(cond), entry_(entry) { |
| 1195 } |
| 1196 |
| 1197 int pc_offset() { return pc_offset_; } |
| 1198 Condition cond() { return cond_; } |
| 1199 Address entry() { return entry_; } |
| 1200 |
| 1201 // The size of the code generated for each DeoptJumpEntry in the |
| 1202 // deoptimization jump table. |
| 1203 static const int kJumpCodeSize = kInstrSize; |
| 1204 static const int kAdditionalRelocInfoSize = kPointerSize; |
| 1205 static const int kTotalSize = kJumpCodeSize + kAdditionalRelocInfoSize; |
| 1206 |
| 1207 private: |
| 1208 int pc_offset_; // Offset from the start of the buffer. |
| 1209 Condition cond_; |
| 1210 Address entry_; // The address to jump to to deoptimize. |
| 1211 }; |
| 1212 |
| 1213 // Record deoptimization entry for current pc_. |
| 1214 void RecordDeoptJumpEntry(Address entry, Condition cond); |
| 1215 |
| 1162 // Debugging | 1216 // Debugging |
| 1163 | 1217 |
| 1164 // Mark address of the ExitJSFrame code. | 1218 // Mark address of the ExitJSFrame code. |
| 1165 void RecordJSReturn(); | 1219 void RecordJSReturn(); |
| 1166 | 1220 |
| 1167 // Mark address of a debug break slot. | 1221 // Mark address of a debug break slot. |
| 1168 void RecordDebugBreakSlot(); | 1222 void RecordDebugBreakSlot(); |
| 1169 | 1223 |
| 1170 // Record the AST id of the CallIC being compiled, so that it can be placed | 1224 // Record the AST id of the CallIC being compiled, so that it can be placed |
| 1171 // in the relocation information. | 1225 // in the relocation information. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1210 static bool IsLdrRegFpOffset(Instr instr); | 1264 static bool IsLdrRegFpOffset(Instr instr); |
| 1211 static bool IsStrRegFpNegOffset(Instr instr); | 1265 static bool IsStrRegFpNegOffset(Instr instr); |
| 1212 static bool IsLdrRegFpNegOffset(Instr instr); | 1266 static bool IsLdrRegFpNegOffset(Instr instr); |
| 1213 static bool IsLdrPcImmediateOffset(Instr instr); | 1267 static bool IsLdrPcImmediateOffset(Instr instr); |
| 1214 static bool IsTstImmediate(Instr instr); | 1268 static bool IsTstImmediate(Instr instr); |
| 1215 static bool IsCmpRegister(Instr instr); | 1269 static bool IsCmpRegister(Instr instr); |
| 1216 static bool IsCmpImmediate(Instr instr); | 1270 static bool IsCmpImmediate(Instr instr); |
| 1217 static Register GetCmpImmediateRegister(Instr instr); | 1271 static Register GetCmpImmediateRegister(Instr instr); |
| 1218 static int GetCmpImmediateRawImmediate(Instr instr); | 1272 static int GetCmpImmediateRawImmediate(Instr instr); |
| 1219 static bool IsNop(Instr instr, int type = NON_MARKING_NOP); | 1273 static bool IsNop(Instr instr, int type = NON_MARKING_NOP); |
| 1274 static bool IsBkpt(Instr instr, int code); |
| 1220 | 1275 |
| 1221 // Check if is time to emit a constant pool for pending reloc info entries | 1276 // Check if it is time to emit a constant pool for pending reloc info entries. |
| 1277 // This will also emit the deoptimization jump table if necessary. |
| 1222 void CheckConstPool(bool force_emit, bool require_jump); | 1278 void CheckConstPool(bool force_emit, bool require_jump); |
| 1223 | 1279 |
| 1224 protected: | 1280 protected: |
| 1225 // Relocation for a type-recording IC has the AST id added to it. This | 1281 // Relocation for a type-recording IC has the AST id added to it. This |
| 1226 // member variable is a way to pass the information from the call site to | 1282 // member variable is a way to pass the information from the call site to |
| 1227 // the relocation info. | 1283 // the relocation info. |
| 1228 unsigned ast_id_for_reloc_info_; | 1284 unsigned ast_id_for_reloc_info_; |
| 1229 | 1285 |
| 1230 bool emit_debug_code() const { return emit_debug_code_; } | 1286 bool emit_debug_code() const { return emit_debug_code_; } |
| 1231 | 1287 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1315 // Relocation info generation | 1371 // Relocation info generation |
| 1316 // Each relocation is encoded as a variable size value | 1372 // Each relocation is encoded as a variable size value |
| 1317 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize; | 1373 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize; |
| 1318 RelocInfoWriter reloc_info_writer; | 1374 RelocInfoWriter reloc_info_writer; |
| 1319 // Relocation info records are also used during code generation as temporary | 1375 // Relocation info records are also used during code generation as temporary |
| 1320 // containers for constants and code target addresses until they are emitted | 1376 // containers for constants and code target addresses until they are emitted |
| 1321 // to the constant pool. These pending relocation info records are temporarily | 1377 // to the constant pool. These pending relocation info records are temporarily |
| 1322 // stored in a separate buffer until a constant pool is emitted. | 1378 // stored in a separate buffer until a constant pool is emitted. |
| 1323 // If every instruction in a long sequence is accessing the pool, we need one | 1379 // If every instruction in a long sequence is accessing the pool, we need one |
| 1324 // pending relocation entry per instruction. | 1380 // pending relocation entry per instruction. |
| 1325 static const int kMaxNumPRInfo = kMaxDistBetweenPools/kInstrSize; | 1381 static const int kMaxNumPRInfo = kMaxDistBetweenPools / kInstrSize; |
| 1326 RelocInfo prinfo_[kMaxNumPRInfo]; // the buffer of pending relocation info | 1382 RelocInfo prinfo_[kMaxNumPRInfo]; // the buffer of pending relocation info |
| 1327 int num_prinfo_; // number of pending reloc info entries in the buffer | 1383 int num_prinfo_; // number of pending reloc info entries in the buffer |
| 1328 | 1384 |
| 1385 // See comments about class DeoptJumpEntry. |
| 1386 static const int kMaxNumDeoptJumpEntries = |
| 1387 kMaxDistBetweenPools / DeoptJumpEntry::kTotalSize; |
| 1388 // The buffer of pending deoptimization jump entries. |
| 1389 DeoptJumpEntry deopt_jump_entries_[kMaxNumDeoptJumpEntries]; |
| 1390 // Number of pending deoptimization jump entries. |
| 1391 int num_deopt_jump_entries_; |
| 1392 |
| 1329 // The bound position, before this we cannot do instruction elimination. | 1393 // The bound position, before this we cannot do instruction elimination. |
| 1330 int last_bound_pos_; | 1394 int last_bound_pos_; |
| 1331 | 1395 |
| 1332 // Code emission | 1396 // Code emission |
| 1333 inline void CheckBuffer(); | 1397 inline void CheckBuffer(); |
| 1334 void GrowBuffer(); | 1398 void GrowBuffer(); |
| 1335 inline void emit(Instr x); | 1399 inline void emit(Instr x); |
| 1336 | 1400 |
| 1337 // Instruction generation | 1401 // Instruction generation |
| 1338 void addrmod1(Instr instr, Register rn, Register rd, const Operand& x); | 1402 void addrmod1(Instr instr, Register rn, Register rd, const Operand& x); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1366 public: | 1430 public: |
| 1367 explicit EnsureSpace(Assembler* assembler) { | 1431 explicit EnsureSpace(Assembler* assembler) { |
| 1368 assembler->CheckBuffer(); | 1432 assembler->CheckBuffer(); |
| 1369 } | 1433 } |
| 1370 }; | 1434 }; |
| 1371 | 1435 |
| 1372 | 1436 |
| 1373 } } // namespace v8::internal | 1437 } } // namespace v8::internal |
| 1374 | 1438 |
| 1375 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1439 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
| OLD | NEW |