diff options
author | Vladimir Marko <vmarko@google.com> | 2016-04-20 14:39:47 +0100 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2016-04-20 14:39:47 +0100 |
commit | 9152fed693f5d823ef29c373d658adc67fa92fe7 (patch) | |
tree | ef0ec2b7332db9e0361d61dcb588518103636a5e /compiler/utils/assembler.cc | |
parent | ac6d660672c21a0ace14276e9c356906218b4412 (diff) |
Thumb2: Fix EmitJumpTables() to extend buffer only if needed.
Bug: 28256882
Change-Id: I15227535c0fcb73c04b0b05160852c4b1bebee49
Diffstat (limited to 'compiler/utils/assembler.cc')
-rw-r--r-- | compiler/utils/assembler.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/utils/assembler.cc b/compiler/utils/assembler.cc index c2aa574f76..e6c3a18d04 100644 --- a/compiler/utils/assembler.cc +++ b/compiler/utils/assembler.cc @@ -47,7 +47,7 @@ namespace art { AssemblerBuffer::AssemblerBuffer(ArenaAllocator* arena) : arena_(arena) { static const size_t kInitialBufferCapacity = 4 * KB; - contents_ = arena_->AllocArray<uint8_t>(kInitialBufferCapacity); + contents_ = arena_->AllocArray<uint8_t>(kInitialBufferCapacity, kArenaAllocAssembler); cursor_ = contents_; limit_ = ComputeLimit(contents_, kInitialBufferCapacity); fixup_ = nullptr; @@ -94,6 +94,7 @@ void AssemblerBuffer::FinalizeInstructions(const MemoryRegion& instructions) { void AssemblerBuffer::ExtendCapacity(size_t min_capacity) { size_t old_size = Size(); size_t old_capacity = Capacity(); + DCHECK_GT(min_capacity, old_capacity); size_t new_capacity = std::min(old_capacity * 2, old_capacity + 1 * MB); new_capacity = std::max(new_capacity, min_capacity); |