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

Side by Side Diff: src/arm/assembler-arm.h

Issue 11191029: Use VLDR instead of VMOVs from GPR when a 64-bit double can't be encoded as a VMOV immediate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update with ulan's comments. Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/arm/assembler-arm.cc » ('j') | src/arm/assembler-arm.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 *reinterpret_cast<Instr*>(buffer_ + pos) = instr; 1276 *reinterpret_cast<Instr*>(buffer_ + pos) = instr;
1277 } 1277 }
1278 static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); } 1278 static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); }
1279 static void instr_at_put(byte* pc, Instr instr) { 1279 static void instr_at_put(byte* pc, Instr instr) {
1280 *reinterpret_cast<Instr*>(pc) = instr; 1280 *reinterpret_cast<Instr*>(pc) = instr;
1281 } 1281 }
1282 static Condition GetCondition(Instr instr); 1282 static Condition GetCondition(Instr instr);
1283 static bool IsBranch(Instr instr); 1283 static bool IsBranch(Instr instr);
1284 static int GetBranchOffset(Instr instr); 1284 static int GetBranchOffset(Instr instr);
1285 static bool IsLdrRegisterImmediate(Instr instr); 1285 static bool IsLdrRegisterImmediate(Instr instr);
1286 static bool IsVldrDRegisterImmediate(Instr instr);
1286 static int GetLdrRegisterImmediateOffset(Instr instr); 1287 static int GetLdrRegisterImmediateOffset(Instr instr);
1288 static int GetVldrDRegisterImmediateOffset(Instr instr);
1287 static Instr SetLdrRegisterImmediateOffset(Instr instr, int offset); 1289 static Instr SetLdrRegisterImmediateOffset(Instr instr, int offset);
1290 static Instr SetVldrDRegisterImmediateOffset(Instr instr, int offset);
1288 static bool IsStrRegisterImmediate(Instr instr); 1291 static bool IsStrRegisterImmediate(Instr instr);
1289 static Instr SetStrRegisterImmediateOffset(Instr instr, int offset); 1292 static Instr SetStrRegisterImmediateOffset(Instr instr, int offset);
1290 static bool IsAddRegisterImmediate(Instr instr); 1293 static bool IsAddRegisterImmediate(Instr instr);
1291 static Instr SetAddRegisterImmediateOffset(Instr instr, int offset); 1294 static Instr SetAddRegisterImmediateOffset(Instr instr, int offset);
1292 static Register GetRd(Instr instr); 1295 static Register GetRd(Instr instr);
1293 static Register GetRn(Instr instr); 1296 static Register GetRn(Instr instr);
1294 static Register GetRm(Instr instr); 1297 static Register GetRm(Instr instr);
1295 static bool IsPush(Instr instr); 1298 static bool IsPush(Instr instr);
1296 static bool IsPop(Instr instr); 1299 static bool IsPop(Instr instr);
1297 static bool IsStrRegFpOffset(Instr instr); 1300 static bool IsStrRegFpOffset(Instr instr);
1298 static bool IsLdrRegFpOffset(Instr instr); 1301 static bool IsLdrRegFpOffset(Instr instr);
1299 static bool IsStrRegFpNegOffset(Instr instr); 1302 static bool IsStrRegFpNegOffset(Instr instr);
1300 static bool IsLdrRegFpNegOffset(Instr instr); 1303 static bool IsLdrRegFpNegOffset(Instr instr);
1301 static bool IsLdrPcImmediateOffset(Instr instr); 1304 static bool IsLdrPcImmediateOffset(Instr instr);
1305 static bool IsVldrDPcImmediateOffset(Instr instr);
1302 static bool IsTstImmediate(Instr instr); 1306 static bool IsTstImmediate(Instr instr);
1303 static bool IsCmpRegister(Instr instr); 1307 static bool IsCmpRegister(Instr instr);
1304 static bool IsCmpImmediate(Instr instr); 1308 static bool IsCmpImmediate(Instr instr);
1305 static Register GetCmpImmediateRegister(Instr instr); 1309 static Register GetCmpImmediateRegister(Instr instr);
1306 static int GetCmpImmediateRawImmediate(Instr instr); 1310 static int GetCmpImmediateRawImmediate(Instr instr);
1307 static bool IsNop(Instr instr, int type = NON_MARKING_NOP); 1311 static bool IsNop(Instr instr, int type = NON_MARKING_NOP);
1308 1312
1309 // Constants in pools are accessed via pc relative addressing, which can 1313 // Constants in pools are accessed via pc relative addressing, which can
1310 // reach +/-4KB thereby defining a maximum distance between the instruction 1314 // reach +/-4KB for integer PC-relative loads and +/-1KB for floating-point
1311 // and the accessed constant. 1315 // PC-relative loads, thereby defining a maximum distance between the
1312 static const int kMaxDistToPool = 4*KB; 1316 // instruction and the accessed constant.
1313 static const int kMaxNumPendingRelocInfo = kMaxDistToPool/kInstrSize; 1317 static const int kMaxDistToIntPool = 4*KB;
1318 static const int kMaxDistToFPPool = 1*KB;
1319 // All relocations could be integer, it therefore acts as the limit.
1320 static const int kMaxNumPendingRelocInfo = kMaxDistToIntPool/kInstrSize;
1314 1321
1315 // Postpone the generation of the constant pool for the specified number of 1322 // Postpone the generation of the constant pool for the specified number of
1316 // instructions. 1323 // instructions.
1317 void BlockConstPoolFor(int instructions); 1324 void BlockConstPoolFor(int instructions);
1318 1325
1319 // Check if is time to emit a constant pool. 1326 // Check if is time to emit a constant pool.
1320 void CheckConstPool(bool force_emit, bool require_jump); 1327 void CheckConstPool(bool force_emit, bool require_jump);
1321 1328
1322 protected: 1329 protected:
1323 // Relocation for a type-recording IC has the AST id added to it. This 1330 // Relocation for a type-recording IC has the AST id added to it. This
(...skipping 21 matching lines...) Expand all
1345 next_buffer_check_ = kMaxInt; 1352 next_buffer_check_ = kMaxInt;
1346 } 1353 }
1347 } 1354 }
1348 1355
1349 // Resume constant pool emission. Need to be called as many time as 1356 // Resume constant pool emission. Need to be called as many time as
1350 // StartBlockConstPool to have an effect. 1357 // StartBlockConstPool to have an effect.
1351 void EndBlockConstPool() { 1358 void EndBlockConstPool() {
1352 if (--const_pool_blocked_nesting_ == 0) { 1359 if (--const_pool_blocked_nesting_ == 0) {
1353 // Check the constant pool hasn't been blocked for too long. 1360 // Check the constant pool hasn't been blocked for too long.
1354 ASSERT((num_pending_reloc_info_ == 0) || 1361 ASSERT((num_pending_reloc_info_ == 0) ||
1355 (pc_offset() < (first_const_pool_use_ + kMaxDistToPool))); 1362 (pc_offset() < (first_const_pool_use_ + kMaxDistToIntPool)));
1363 ASSERT((num_pending_64_bit_reloc_info_ == 0) ||
1364 (pc_offset() < (first_const_pool_use_ + kMaxDistToFPPool)));
1356 // Two cases: 1365 // Two cases:
1357 // * no_const_pool_before_ >= next_buffer_check_ and the emission is 1366 // * no_const_pool_before_ >= next_buffer_check_ and the emission is
1358 // still blocked 1367 // still blocked
1359 // * no_const_pool_before_ < next_buffer_check_ and the next emit will 1368 // * no_const_pool_before_ < next_buffer_check_ and the next emit will
1360 // trigger a check. 1369 // trigger a check.
1361 next_buffer_check_ = no_const_pool_before_; 1370 next_buffer_check_ = no_const_pool_before_;
1362 } 1371 }
1363 } 1372 }
1364 1373
1365 bool is_const_pool_blocked() const { 1374 bool is_const_pool_blocked() const {
(...skipping 30 matching lines...) Expand all
1396 // if so, a relocation info entry is associated to the constant pool entry. 1405 // if so, a relocation info entry is associated to the constant pool entry.
1397 1406
1398 // Repeated checking whether the constant pool should be emitted is rather 1407 // Repeated checking whether the constant pool should be emitted is rather
1399 // expensive. By default we only check again once a number of instructions 1408 // expensive. By default we only check again once a number of instructions
1400 // has been generated. That also means that the sizing of the buffers is not 1409 // has been generated. That also means that the sizing of the buffers is not
1401 // an exact science, and that we rely on some slop to not overrun buffers. 1410 // an exact science, and that we rely on some slop to not overrun buffers.
1402 static const int kCheckPoolIntervalInst = 32; 1411 static const int kCheckPoolIntervalInst = 32;
1403 static const int kCheckPoolInterval = kCheckPoolIntervalInst * kInstrSize; 1412 static const int kCheckPoolInterval = kCheckPoolIntervalInst * kInstrSize;
1404 1413
1405 1414
1406 // Average distance beetween a constant pool and the first instruction
1407 // accessing the constant pool. Longer distance should result in less I-cache
1408 // pollution.
1409 // In practice the distance will be smaller since constant pool emission is
1410 // forced after function return and sometimes after unconditional branches.
1411 static const int kAvgDistToPool = kMaxDistToPool - kCheckPoolInterval;
1412
1413 // Emission of the constant pool may be blocked in some code sequences. 1415 // Emission of the constant pool may be blocked in some code sequences.
1414 int const_pool_blocked_nesting_; // Block emission if this is not zero. 1416 int const_pool_blocked_nesting_; // Block emission if this is not zero.
1415 int no_const_pool_before_; // Block emission before this pc offset. 1417 int no_const_pool_before_; // Block emission before this pc offset.
1416 1418
1417 // Keep track of the first instruction requiring a constant pool entry 1419 // Keep track of the first instruction requiring a constant pool entry
1418 // since the previous constant pool was emitted. 1420 // since the previous constant pool was emitted.
1419 int first_const_pool_use_; 1421 int first_const_pool_use_;
1420 1422
1421 // Relocation info generation 1423 // Relocation info generation
1422 // Each relocation is encoded as a variable size value 1424 // Each relocation is encoded as a variable size value
1423 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize; 1425 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize;
1424 RelocInfoWriter reloc_info_writer; 1426 RelocInfoWriter reloc_info_writer;
1425 1427
1426 // Relocation info records are also used during code generation as temporary 1428 // Relocation info records are also used during code generation as temporary
1427 // containers for constants and code target addresses until they are emitted 1429 // containers for constants and code target addresses until they are emitted
1428 // to the constant pool. These pending relocation info records are temporarily 1430 // to the constant pool. These pending relocation info records are temporarily
1429 // stored in a separate buffer until a constant pool is emitted. 1431 // stored in a separate buffer until a constant pool is emitted.
1430 // If every instruction in a long sequence is accessing the pool, we need one 1432 // If every instruction in a long sequence is accessing the pool, we need one
1431 // pending relocation entry per instruction. 1433 // pending relocation entry per instruction.
1432 1434
1433 // the buffer of pending relocation info 1435 // the buffer of pending relocation info
1434 RelocInfo pending_reloc_info_[kMaxNumPendingRelocInfo]; 1436 RelocInfo pending_reloc_info_[kMaxNumPendingRelocInfo];
1435 // number of pending reloc info entries in the buffer 1437 // number of pending reloc info entries in the buffer
1436 int num_pending_reloc_info_; 1438 int num_pending_reloc_info_;
1439 // Number of pending reloc info entries included above which also happen to
1440 // be 64-bit.
1441 int num_pending_64_bit_reloc_info_;
1437 1442
1438 // The bound position, before this we cannot do instruction elimination. 1443 // The bound position, before this we cannot do instruction elimination.
1439 int last_bound_pos_; 1444 int last_bound_pos_;
1440 1445
1441 // Code emission 1446 // Code emission
1442 inline void CheckBuffer(); 1447 inline void CheckBuffer();
1443 void GrowBuffer(); 1448 void GrowBuffer();
1444 inline void emit(Instr x); 1449 inline void emit(Instr x);
1445 1450
1446 // Instruction generation 1451 // Instruction generation
1447 void addrmod1(Instr instr, Register rn, Register rd, const Operand& x); 1452 void addrmod1(Instr instr, Register rn, Register rd, const Operand& x);
1448 void addrmod2(Instr instr, Register rd, const MemOperand& x); 1453 void addrmod2(Instr instr, Register rd, const MemOperand& x);
1449 void addrmod3(Instr instr, Register rd, const MemOperand& x); 1454 void addrmod3(Instr instr, Register rd, const MemOperand& x);
1450 void addrmod4(Instr instr, Register rn, RegList rl); 1455 void addrmod4(Instr instr, Register rn, RegList rl);
1451 void addrmod5(Instr instr, CRegister crd, const MemOperand& x); 1456 void addrmod5(Instr instr, CRegister crd, const MemOperand& x);
1452 1457
1453 // Labels 1458 // Labels
1454 void print(Label* L); 1459 void print(Label* L);
1455 void bind_to(Label* L, int pos); 1460 void bind_to(Label* L, int pos);
1456 void link_to(Label* L, Label* appendix); 1461 void link_to(Label* L, Label* appendix);
1457 void next(Label* L); 1462 void next(Label* L);
1458 1463
1459 // Record reloc info for current pc_ 1464 // Record reloc info for current pc_
1460 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); 1465 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0);
1466 void RecordRelocInfo(double data);
1467 void RecordRelocInfoConstantPoolEntryHelper(const RelocInfo& rinfo);
1461 1468
1462 friend class RegExpMacroAssemblerARM; 1469 friend class RegExpMacroAssemblerARM;
1463 friend class RelocInfo; 1470 friend class RelocInfo;
1464 friend class CodePatcher; 1471 friend class CodePatcher;
1465 friend class BlockConstPoolScope; 1472 friend class BlockConstPoolScope;
1466 1473
1467 PositionsRecorder positions_recorder_; 1474 PositionsRecorder positions_recorder_;
1468 1475
1469 bool emit_debug_code_; 1476 bool emit_debug_code_;
1470 bool predictable_code_size_; 1477 bool predictable_code_size_;
1471 1478
1472 friend class PositionsRecorder; 1479 friend class PositionsRecorder;
1473 friend class EnsureSpace; 1480 friend class EnsureSpace;
1474 }; 1481 };
1475 1482
1476 1483
1477 class EnsureSpace BASE_EMBEDDED { 1484 class EnsureSpace BASE_EMBEDDED {
1478 public: 1485 public:
1479 explicit EnsureSpace(Assembler* assembler) { 1486 explicit EnsureSpace(Assembler* assembler) {
1480 assembler->CheckBuffer(); 1487 assembler->CheckBuffer();
1481 } 1488 }
1482 }; 1489 };
1483 1490
1484 1491
1485 } } // namespace v8::internal 1492 } } // namespace v8::internal
1486 1493
1487 #endif // V8_ARM_ASSEMBLER_ARM_H_ 1494 #endif // V8_ARM_ASSEMBLER_ARM_H_
OLDNEW
« no previous file with comments | « no previous file | src/arm/assembler-arm.cc » ('j') | src/arm/assembler-arm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698