| OLD | NEW |
| 1 //===- subzero/src/IceAssembler.cpp - Assembler base class ----------------===// | 1 //===- subzero/src/IceAssembler.cpp - Assembler base class ----------------===// |
| 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 // | 5 // |
| 6 // Modified by the Subzero authors. | 6 // Modified by the Subzero authors. |
| 7 // | 7 // |
| 8 // This is forked from Dart revision 39313. | 8 // This is forked from Dart revision 39313. |
| 9 // Please update the revision if we merge back changes from Dart. | 9 // Please update the revision if we merge back changes from Dart. |
| 10 // https://code.google.com/p/dart/wiki/GettingTheSource | 10 // https://code.google.com/p/dart/wiki/GettingTheSource |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 Limit = computeLimit(Contents, kInitialBufferCapacity); | 81 Limit = computeLimit(Contents, kInitialBufferCapacity); |
| 82 #ifndef NDEBUG | 82 #ifndef NDEBUG |
| 83 HasEnsuredCapacity = false; | 83 HasEnsuredCapacity = false; |
| 84 #endif // !NDEBUG | 84 #endif // !NDEBUG |
| 85 | 85 |
| 86 // Verify internal state. | 86 // Verify internal state. |
| 87 assert(capacity() == kInitialBufferCapacity); | 87 assert(capacity() == kInitialBufferCapacity); |
| 88 assert(size() == 0); | 88 assert(size() == 0); |
| 89 } | 89 } |
| 90 | 90 |
| 91 AssemblerBuffer::~AssemblerBuffer() {} | 91 AssemblerBuffer::~AssemblerBuffer() = default; |
| 92 | 92 |
| 93 void AssemblerBuffer::extendCapacity() { | 93 void AssemblerBuffer::extendCapacity() { |
| 94 intptr_t old_size = size(); | 94 intptr_t old_size = size(); |
| 95 intptr_t old_capacity = capacity(); | 95 intptr_t old_capacity = capacity(); |
| 96 const intptr_t OneMB = 1 << 20; | 96 const intptr_t OneMB = 1 << 20; |
| 97 intptr_t new_capacity = std::min(old_capacity * 2, old_capacity + OneMB); | 97 intptr_t new_capacity = std::min(old_capacity * 2, old_capacity + OneMB); |
| 98 if (new_capacity < old_capacity) { | 98 if (new_capacity < old_capacity) { |
| 99 llvm::report_fatal_error( | 99 llvm::report_fatal_error( |
| 100 "Unexpected overflow in AssemblerBuffer::ExtendCapacity"); | 100 "Unexpected overflow in AssemblerBuffer::ExtendCapacity"); |
| 101 } | 101 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 145 } |
| 146 // Handle any bytes that are not prefixed by a fixup. | 146 // Handle any bytes that are not prefixed by a fixup. |
| 147 for (intptr_t i = CurPosition; i < EndPosition; ++i) { | 147 for (intptr_t i = CurPosition; i < EndPosition; ++i) { |
| 148 Str << "\t.byte 0x"; | 148 Str << "\t.byte 0x"; |
| 149 Str.write_hex(Buffer.load<uint8_t>(i)); | 149 Str.write_hex(Buffer.load<uint8_t>(i)); |
| 150 Str << "\n"; | 150 Str << "\n"; |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // end of namespace Ice | 154 } // end of namespace Ice |
| OLD | NEW |