OLD | NEW |
---|---|
1 //===- subzero/src/assembler.cpp - Assembler base class -------------------===// | 1 //===- subzero/src/assembler.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 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // The Subzero Code Generator | 10 // The Subzero Code Generator |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 fixups_processed_ = false; | 67 fixups_processed_ = false; |
68 #endif // !NDEBUG | 68 #endif // !NDEBUG |
69 | 69 |
70 // Verify internal state. | 70 // Verify internal state. |
71 assert(Capacity() == kInitialBufferCapacity); | 71 assert(Capacity() == kInitialBufferCapacity); |
72 assert(Size() == 0); | 72 assert(Size() == 0); |
73 } | 73 } |
74 | 74 |
75 AssemblerBuffer::~AssemblerBuffer() {} | 75 AssemblerBuffer::~AssemblerBuffer() {} |
76 | 76 |
77 AssemblerFixup *AssemblerBuffer::GetLatestFixup() const { | 77 // Returns the latest fixup at or after the given position, or NULL if |
78 if (fixups_.empty()) | 78 // there is none. Assumes were added in increasing order. |
jvoung (off chromium)
2014/11/03 17:18:55
"Assumes fixups were added in..."
Jim Stichnoth
2014/11/03 19:35:49
Done.
| |
79 return NULL; | 79 AssemblerFixup *AssemblerBuffer::GetLatestFixup(intptr_t position) const { |
80 return fixups_.back(); | 80 AssemblerFixup *latest_fixup = NULL; |
81 for (auto I = fixups_.rbegin(), E = fixups_.rend(); I != E; ++I) { | |
82 if ((*I)->position() < position) | |
83 return latest_fixup; | |
84 latest_fixup = *I; | |
85 } | |
86 return latest_fixup; | |
81 } | 87 } |
82 | 88 |
83 void AssemblerBuffer::ProcessFixups(const MemoryRegion ®ion) { | 89 void AssemblerBuffer::ProcessFixups(const MemoryRegion ®ion) { |
84 for (SizeT I = 0; I < fixups_.size(); ++I) { | 90 for (SizeT I = 0; I < fixups_.size(); ++I) { |
85 AssemblerFixup *fixup = fixups_[I]; | 91 AssemblerFixup *fixup = fixups_[I]; |
86 fixup->Process(region, fixup->position()); | 92 fixup->Process(region, fixup->position()); |
87 } | 93 } |
88 } | 94 } |
89 | 95 |
90 void AssemblerBuffer::FinalizeInstructions(const MemoryRegion &instructions) { | 96 void AssemblerBuffer::FinalizeInstructions(const MemoryRegion &instructions) { |
(...skipping 30 matching lines...) Expand all Loading... | |
121 // Update the cursor and recompute the limit. | 127 // Update the cursor and recompute the limit. |
122 cursor_ += delta; | 128 cursor_ += delta; |
123 limit_ = ComputeLimit(new_contents, new_capacity); | 129 limit_ = ComputeLimit(new_contents, new_capacity); |
124 | 130 |
125 // Verify internal state. | 131 // Verify internal state. |
126 assert(Capacity() == new_capacity); | 132 assert(Capacity() == new_capacity); |
127 assert(Size() == old_size); | 133 assert(Size() == old_size); |
128 } | 134 } |
129 | 135 |
130 } // end of namespace Ice | 136 } // end of namespace Ice |
OLD | NEW |