| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // d15: scratch register. | 278 // d15: scratch register. |
| 279 static const int kNumReservedRegisters = 2; | 279 static const int kNumReservedRegisters = 2; |
| 280 static const int kMaxNumAllocatableRegisters = kMaxNumRegisters - | 280 static const int kMaxNumAllocatableRegisters = kMaxNumRegisters - |
| 281 kNumReservedRegisters; | 281 kNumReservedRegisters; |
| 282 static const int kSizeInBytes = 8; | 282 static const int kSizeInBytes = 8; |
| 283 | 283 |
| 284 // Note: the number of registers can be different at snapshot and run-time. | 284 // Note: the number of registers can be different at snapshot and run-time. |
| 285 // Any code included in the snapshot must be able to run both with 16 or 32 | 285 // Any code included in the snapshot must be able to run both with 16 or 32 |
| 286 // registers. | 286 // registers. |
| 287 inline static int NumRegisters(); | 287 inline static int NumRegisters(); |
| 288 inline static int NumReservedRegisters(); |
| 288 inline static int NumAllocatableRegisters(); | 289 inline static int NumAllocatableRegisters(); |
| 289 | 290 |
| 290 inline static int ToAllocationIndex(DwVfpRegister reg); | 291 inline static int ToAllocationIndex(DwVfpRegister reg); |
| 291 static const char* AllocationIndexToString(int index); | 292 static const char* AllocationIndexToString(int index); |
| 292 inline static DwVfpRegister FromAllocationIndex(int index); | 293 inline static DwVfpRegister FromAllocationIndex(int index); |
| 293 | 294 |
| 294 static DwVfpRegister from_code(int code) { | 295 static DwVfpRegister from_code(int code) { |
| 295 DwVfpRegister r = { code }; | 296 DwVfpRegister r = { code }; |
| 296 return r; | 297 return r; |
| 297 } | 298 } |
| (...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1436 static bool IsMovT(Instr instr); | 1437 static bool IsMovT(Instr instr); |
| 1437 static bool IsMovW(Instr instr); | 1438 static bool IsMovW(Instr instr); |
| 1438 | 1439 |
| 1439 // Constants in pools are accessed via pc relative addressing, which can | 1440 // Constants in pools are accessed via pc relative addressing, which can |
| 1440 // reach +/-4KB for integer PC-relative loads and +/-1KB for floating-point | 1441 // reach +/-4KB for integer PC-relative loads and +/-1KB for floating-point |
| 1441 // PC-relative loads, thereby defining a maximum distance between the | 1442 // PC-relative loads, thereby defining a maximum distance between the |
| 1442 // instruction and the accessed constant. | 1443 // instruction and the accessed constant. |
| 1443 static const int kMaxDistToIntPool = 4*KB; | 1444 static const int kMaxDistToIntPool = 4*KB; |
| 1444 static const int kMaxDistToFPPool = 1*KB; | 1445 static const int kMaxDistToFPPool = 1*KB; |
| 1445 // All relocations could be integer, it therefore acts as the limit. | 1446 // All relocations could be integer, it therefore acts as the limit. |
| 1446 static const int kMaxNumPendingRelocInfo = kMaxDistToIntPool/kInstrSize; | 1447 static const int kMaxNumPending32RelocInfo = kMaxDistToIntPool/kInstrSize; |
| 1448 static const int kMaxNumPending64RelocInfo = kMaxDistToFPPool/kInstrSize; |
| 1447 | 1449 |
| 1448 // Postpone the generation of the constant pool for the specified number of | 1450 // Postpone the generation of the constant pool for the specified number of |
| 1449 // instructions. | 1451 // instructions. |
| 1450 void BlockConstPoolFor(int instructions); | 1452 void BlockConstPoolFor(int instructions); |
| 1451 | 1453 |
| 1452 // Check if is time to emit a constant pool. | 1454 // Check if is time to emit a constant pool. |
| 1453 void CheckConstPool(bool force_emit, bool require_jump); | 1455 void CheckConstPool(bool force_emit, bool require_jump); |
| 1454 | 1456 |
| 1455 protected: | 1457 protected: |
| 1456 // Relocation for a type-recording IC has the AST id added to it. This | 1458 // Relocation for a type-recording IC has the AST id added to it. This |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1474 // Prevent constant pool checks happening by setting the next check to | 1476 // Prevent constant pool checks happening by setting the next check to |
| 1475 // the biggest possible offset. | 1477 // the biggest possible offset. |
| 1476 next_buffer_check_ = kMaxInt; | 1478 next_buffer_check_ = kMaxInt; |
| 1477 } | 1479 } |
| 1478 } | 1480 } |
| 1479 | 1481 |
| 1480 // Resume constant pool emission. Need to be called as many time as | 1482 // Resume constant pool emission. Need to be called as many time as |
| 1481 // StartBlockConstPool to have an effect. | 1483 // StartBlockConstPool to have an effect. |
| 1482 void EndBlockConstPool() { | 1484 void EndBlockConstPool() { |
| 1483 if (--const_pool_blocked_nesting_ == 0) { | 1485 if (--const_pool_blocked_nesting_ == 0) { |
| 1486 #ifdef DEBUG |
| 1487 // Max pool start (if we need a jump and an alignment). |
| 1488 int start = pc_offset() + kInstrSize + 2 * kPointerSize; |
| 1484 // Check the constant pool hasn't been blocked for too long. | 1489 // Check the constant pool hasn't been blocked for too long. |
| 1485 ASSERT((num_pending_reloc_info_ == 0) || | 1490 ASSERT((num_pending_32_bit_reloc_info_ == 0) || |
| 1486 (pc_offset() < (first_const_pool_use_ + kMaxDistToIntPool))); | 1491 (start + num_pending_64_bit_reloc_info_ * kDoubleSize < |
| 1492 (first_const_pool_32_use_ + kMaxDistToIntPool))); |
| 1487 ASSERT((num_pending_64_bit_reloc_info_ == 0) || | 1493 ASSERT((num_pending_64_bit_reloc_info_ == 0) || |
| 1488 (pc_offset() < (first_const_pool_use_ + kMaxDistToFPPool))); | 1494 (start < (first_const_pool_64_use_ + kMaxDistToFPPool))); |
| 1495 #endif |
| 1489 // Two cases: | 1496 // Two cases: |
| 1490 // * no_const_pool_before_ >= next_buffer_check_ and the emission is | 1497 // * no_const_pool_before_ >= next_buffer_check_ and the emission is |
| 1491 // still blocked | 1498 // still blocked |
| 1492 // * no_const_pool_before_ < next_buffer_check_ and the next emit will | 1499 // * no_const_pool_before_ < next_buffer_check_ and the next emit will |
| 1493 // trigger a check. | 1500 // trigger a check. |
| 1494 next_buffer_check_ = no_const_pool_before_; | 1501 next_buffer_check_ = no_const_pool_before_; |
| 1495 } | 1502 } |
| 1496 } | 1503 } |
| 1497 | 1504 |
| 1498 bool is_const_pool_blocked() const { | 1505 bool is_const_pool_blocked() const { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1527 static const int kCheckPoolIntervalInst = 32; | 1534 static const int kCheckPoolIntervalInst = 32; |
| 1528 static const int kCheckPoolInterval = kCheckPoolIntervalInst * kInstrSize; | 1535 static const int kCheckPoolInterval = kCheckPoolIntervalInst * kInstrSize; |
| 1529 | 1536 |
| 1530 | 1537 |
| 1531 // Emission of the constant pool may be blocked in some code sequences. | 1538 // Emission of the constant pool may be blocked in some code sequences. |
| 1532 int const_pool_blocked_nesting_; // Block emission if this is not zero. | 1539 int const_pool_blocked_nesting_; // Block emission if this is not zero. |
| 1533 int no_const_pool_before_; // Block emission before this pc offset. | 1540 int no_const_pool_before_; // Block emission before this pc offset. |
| 1534 | 1541 |
| 1535 // Keep track of the first instruction requiring a constant pool entry | 1542 // Keep track of the first instruction requiring a constant pool entry |
| 1536 // since the previous constant pool was emitted. | 1543 // since the previous constant pool was emitted. |
| 1537 int first_const_pool_use_; | 1544 int first_const_pool_32_use_; |
| 1545 int first_const_pool_64_use_; |
| 1538 | 1546 |
| 1539 // Relocation info generation | 1547 // Relocation info generation |
| 1540 // Each relocation is encoded as a variable size value | 1548 // Each relocation is encoded as a variable size value |
| 1541 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize; | 1549 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize; |
| 1542 RelocInfoWriter reloc_info_writer; | 1550 RelocInfoWriter reloc_info_writer; |
| 1543 | 1551 |
| 1544 // Relocation info records are also used during code generation as temporary | 1552 // Relocation info records are also used during code generation as temporary |
| 1545 // containers for constants and code target addresses until they are emitted | 1553 // containers for constants and code target addresses until they are emitted |
| 1546 // to the constant pool. These pending relocation info records are temporarily | 1554 // to the constant pool. These pending relocation info records are temporarily |
| 1547 // stored in a separate buffer until a constant pool is emitted. | 1555 // stored in a separate buffer until a constant pool is emitted. |
| 1548 // If every instruction in a long sequence is accessing the pool, we need one | 1556 // If every instruction in a long sequence is accessing the pool, we need one |
| 1549 // pending relocation entry per instruction. | 1557 // pending relocation entry per instruction. |
| 1550 | 1558 |
| 1551 // the buffer of pending relocation info | 1559 // The buffers of pending relocation info. |
| 1552 RelocInfo pending_reloc_info_[kMaxNumPendingRelocInfo]; | 1560 RelocInfo pending_32_bit_reloc_info_[kMaxNumPending32RelocInfo]; |
| 1553 // number of pending reloc info entries in the buffer | 1561 RelocInfo pending_64_bit_reloc_info_[kMaxNumPending64RelocInfo]; |
| 1554 int num_pending_reloc_info_; | 1562 // Number of pending reloc info entries in the 32 bits buffer. |
| 1555 // Number of pending reloc info entries included above which also happen to | 1563 int num_pending_32_bit_reloc_info_; |
| 1556 // be 64-bit. | 1564 // Number of pending reloc info entries in the 64 bits buffer. |
| 1557 int num_pending_64_bit_reloc_info_; | 1565 int num_pending_64_bit_reloc_info_; |
| 1558 | 1566 |
| 1559 // The bound position, before this we cannot do instruction elimination. | 1567 // The bound position, before this we cannot do instruction elimination. |
| 1560 int last_bound_pos_; | 1568 int last_bound_pos_; |
| 1561 | 1569 |
| 1562 // Code emission | 1570 // Code emission |
| 1563 inline void CheckBuffer(); | 1571 inline void CheckBuffer(); |
| 1564 void GrowBuffer(); | 1572 void GrowBuffer(); |
| 1565 inline void emit(Instr x); | 1573 inline void emit(Instr x); |
| 1566 | 1574 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1607 public: | 1615 public: |
| 1608 explicit EnsureSpace(Assembler* assembler) { | 1616 explicit EnsureSpace(Assembler* assembler) { |
| 1609 assembler->CheckBuffer(); | 1617 assembler->CheckBuffer(); |
| 1610 } | 1618 } |
| 1611 }; | 1619 }; |
| 1612 | 1620 |
| 1613 | 1621 |
| 1614 } } // namespace v8::internal | 1622 } } // namespace v8::internal |
| 1615 | 1623 |
| 1616 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1624 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
| OLD | NEW |