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 are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // 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 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 // an instruction or relocation information. | 1458 // an instruction or relocation information. |
1459 inline bool buffer_overflow() const { | 1459 inline bool buffer_overflow() const { |
1460 return pc_ >= reloc_info_writer.pos() - kGap; | 1460 return pc_ >= reloc_info_writer.pos() - kGap; |
1461 } | 1461 } |
1462 | 1462 |
1463 // Get the number of bytes available in the buffer. | 1463 // Get the number of bytes available in the buffer. |
1464 inline int available_space() const { return reloc_info_writer.pos() - pc_; } | 1464 inline int available_space() const { return reloc_info_writer.pos() - pc_; } |
1465 | 1465 |
1466 static bool IsNop(Address addr); | 1466 static bool IsNop(Address addr); |
1467 | 1467 |
1468 AssemblerPositionsRecorder* positions_recorder() { | |
1469 return &positions_recorder_; | |
1470 } | |
1471 | |
1472 int relocation_writer_size() { | 1468 int relocation_writer_size() { |
1473 return (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 1469 return (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
1474 } | 1470 } |
1475 | 1471 |
1476 // Avoid overflows for displacements etc. | 1472 // Avoid overflows for displacements etc. |
1477 static const int kMaximalBufferSize = 512*MB; | 1473 static const int kMaximalBufferSize = 512*MB; |
1478 | 1474 |
1479 byte byte_at(int pos) { return buffer_[pos]; } | 1475 byte byte_at(int pos) { return buffer_[pos]; } |
1480 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } | 1476 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } |
1481 | 1477 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 friend class CodePatcher; | 1563 friend class CodePatcher; |
1568 friend class EnsureSpace; | 1564 friend class EnsureSpace; |
1569 | 1565 |
1570 // Internal reference positions, required for (potential) patching in | 1566 // Internal reference positions, required for (potential) patching in |
1571 // GrowBuffer(); contains only those internal references whose labels | 1567 // GrowBuffer(); contains only those internal references whose labels |
1572 // are already bound. | 1568 // are already bound. |
1573 std::deque<int> internal_reference_positions_; | 1569 std::deque<int> internal_reference_positions_; |
1574 | 1570 |
1575 // code generation | 1571 // code generation |
1576 RelocInfoWriter reloc_info_writer; | 1572 RelocInfoWriter reloc_info_writer; |
1577 | |
1578 AssemblerPositionsRecorder positions_recorder_; | |
1579 friend class AssemblerPositionsRecorder; | |
1580 }; | 1573 }; |
1581 | 1574 |
1582 | 1575 |
1583 // Helper class that ensures that there is enough space for generating | 1576 // Helper class that ensures that there is enough space for generating |
1584 // instructions and relocation information. The constructor makes | 1577 // instructions and relocation information. The constructor makes |
1585 // sure that there is enough space and (in debug mode) the destructor | 1578 // sure that there is enough space and (in debug mode) the destructor |
1586 // checks that we did not generate too much. | 1579 // checks that we did not generate too much. |
1587 class EnsureSpace BASE_EMBEDDED { | 1580 class EnsureSpace BASE_EMBEDDED { |
1588 public: | 1581 public: |
1589 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) { | 1582 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) { |
(...skipping 14 matching lines...) Expand all Loading... |
1604 Assembler* assembler_; | 1597 Assembler* assembler_; |
1605 #ifdef DEBUG | 1598 #ifdef DEBUG |
1606 int space_before_; | 1599 int space_before_; |
1607 #endif | 1600 #endif |
1608 }; | 1601 }; |
1609 | 1602 |
1610 } // namespace internal | 1603 } // namespace internal |
1611 } // namespace v8 | 1604 } // namespace v8 |
1612 | 1605 |
1613 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 1606 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
OLD | NEW |