Index: src/arm/assembler-arm.cc |
diff --git a/src/arm/assembler-arm.cc b/src/arm/assembler-arm.cc |
index 633b5d12c076b46e04343c9f2612928b21e46fd8..24f757ac12919267e2010015fb7322ba313f71c3 100644 |
--- a/src/arm/assembler-arm.cc |
+++ b/src/arm/assembler-arm.cc |
@@ -448,6 +448,8 @@ const Instr kLdrStrInstrTypeMask = 0xffff0000; |
Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) |
: AssemblerBase(isolate, buffer, buffer_size), |
recorded_ast_id_(TypeFeedbackId::None()), |
+ pending_32_bit_constants_(&pending_32_bit_constants_buffer_[0]), |
+ pending_64_bit_constants_(&pending_64_bit_constants_buffer_[0]), |
constant_pool_builder_(kLdrMaxReachBits, kVldrMaxReachBits), |
positions_recorder_(this) { |
reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); |
@@ -465,6 +467,12 @@ Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) |
Assembler::~Assembler() { |
DCHECK(const_pool_blocked_nesting_ == 0); |
+ if (pending_32_bit_constants_ != &pending_32_bit_constants_buffer_[0]) { |
+ delete[] pending_32_bit_constants_; |
+ } |
+ if (pending_64_bit_constants_ != &pending_64_bit_constants_buffer_[0]) { |
+ delete[] pending_64_bit_constants_; |
+ } |
} |
@@ -3664,6 +3672,15 @@ ConstantPoolEntry::Access Assembler::ConstantPoolAddEntry(int position, |
DCHECK(num_pending_32_bit_constants_ < kMaxNumPending32Constants); |
if (num_pending_32_bit_constants_ == 0) { |
first_const_pool_32_use_ = position; |
+ } else if (num_pending_32_bit_constants_ == kMinNumPendingConstants && |
+ pending_32_bit_constants_ == |
+ &pending_32_bit_constants_buffer_[0]) { |
+ // Inline buffer is full, switch to dynamically allocated buffer. |
+ pending_32_bit_constants_ = |
+ new ConstantPoolEntry[kMaxNumPending32Constants]; |
+ std::copy(&pending_32_bit_constants_buffer_[0], |
+ &pending_32_bit_constants_buffer_[kMinNumPendingConstants], |
+ &pending_32_bit_constants_[0]); |
} |
ConstantPoolEntry entry(position, value, sharing_ok); |
pending_32_bit_constants_[num_pending_32_bit_constants_++] = entry; |
@@ -3684,6 +3701,15 @@ ConstantPoolEntry::Access Assembler::ConstantPoolAddEntry(int position, |
DCHECK(num_pending_64_bit_constants_ < kMaxNumPending64Constants); |
if (num_pending_64_bit_constants_ == 0) { |
first_const_pool_64_use_ = position; |
+ } else if (num_pending_64_bit_constants_ == kMinNumPendingConstants && |
+ pending_64_bit_constants_ == |
+ &pending_64_bit_constants_buffer_[0]) { |
+ // Inline buffer is full, switch to dynamically allocated buffer. |
+ pending_64_bit_constants_ = |
+ new ConstantPoolEntry[kMaxNumPending64Constants]; |
+ std::copy(&pending_64_bit_constants_buffer_[0], |
+ &pending_64_bit_constants_buffer_[kMinNumPendingConstants], |
+ &pending_64_bit_constants_[0]); |
} |
ConstantPoolEntry entry(position, value); |
pending_64_bit_constants_[num_pending_64_bit_constants_++] = entry; |