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 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 // an instruction or relocation information. | 1428 // an instruction or relocation information. |
1429 inline bool buffer_overflow() const { | 1429 inline bool buffer_overflow() const { |
1430 return pc_ >= reloc_info_writer.pos() - kGap; | 1430 return pc_ >= reloc_info_writer.pos() - kGap; |
1431 } | 1431 } |
1432 | 1432 |
1433 // Get the number of bytes available in the buffer. | 1433 // Get the number of bytes available in the buffer. |
1434 inline int available_space() const { return reloc_info_writer.pos() - pc_; } | 1434 inline int available_space() const { return reloc_info_writer.pos() - pc_; } |
1435 | 1435 |
1436 static bool IsNop(Address addr); | 1436 static bool IsNop(Address addr); |
1437 | 1437 |
1438 PositionsRecorder* positions_recorder() { return &positions_recorder_; } | 1438 AssemblerPositionsRecorder* positions_recorder() { |
| 1439 return &positions_recorder_; |
| 1440 } |
1439 | 1441 |
1440 int relocation_writer_size() { | 1442 int relocation_writer_size() { |
1441 return (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 1443 return (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
1442 } | 1444 } |
1443 | 1445 |
1444 // Avoid overflows for displacements etc. | 1446 // Avoid overflows for displacements etc. |
1445 static const int kMaximalBufferSize = 512*MB; | 1447 static const int kMaximalBufferSize = 512*MB; |
1446 | 1448 |
1447 byte byte_at(int pos) { return buffer_[pos]; } | 1449 byte byte_at(int pos) { return buffer_[pos]; } |
1448 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } | 1450 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 friend class EnsureSpace; | 1537 friend class EnsureSpace; |
1536 | 1538 |
1537 // Internal reference positions, required for (potential) patching in | 1539 // Internal reference positions, required for (potential) patching in |
1538 // GrowBuffer(); contains only those internal references whose labels | 1540 // GrowBuffer(); contains only those internal references whose labels |
1539 // are already bound. | 1541 // are already bound. |
1540 std::deque<int> internal_reference_positions_; | 1542 std::deque<int> internal_reference_positions_; |
1541 | 1543 |
1542 // code generation | 1544 // code generation |
1543 RelocInfoWriter reloc_info_writer; | 1545 RelocInfoWriter reloc_info_writer; |
1544 | 1546 |
1545 PositionsRecorder positions_recorder_; | 1547 AssemblerPositionsRecorder positions_recorder_; |
1546 friend class PositionsRecorder; | 1548 friend class AssemblerPositionsRecorder; |
1547 }; | 1549 }; |
1548 | 1550 |
1549 | 1551 |
1550 // Helper class that ensures that there is enough space for generating | 1552 // Helper class that ensures that there is enough space for generating |
1551 // instructions and relocation information. The constructor makes | 1553 // instructions and relocation information. The constructor makes |
1552 // sure that there is enough space and (in debug mode) the destructor | 1554 // sure that there is enough space and (in debug mode) the destructor |
1553 // checks that we did not generate too much. | 1555 // checks that we did not generate too much. |
1554 class EnsureSpace BASE_EMBEDDED { | 1556 class EnsureSpace BASE_EMBEDDED { |
1555 public: | 1557 public: |
1556 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) { | 1558 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) { |
(...skipping 14 matching lines...) Expand all Loading... |
1571 Assembler* assembler_; | 1573 Assembler* assembler_; |
1572 #ifdef DEBUG | 1574 #ifdef DEBUG |
1573 int space_before_; | 1575 int space_before_; |
1574 #endif | 1576 #endif |
1575 }; | 1577 }; |
1576 | 1578 |
1577 } // namespace internal | 1579 } // namespace internal |
1578 } // namespace v8 | 1580 } // namespace v8 |
1579 | 1581 |
1580 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 1582 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
OLD | NEW |