Index: src/arm/assembler-arm.cc |
diff --git a/src/arm/assembler-arm.cc b/src/arm/assembler-arm.cc |
index 8768e8a124f1b61b6f5b129f6ff601bf88610030..b5910d05be5de63c9092aedecdec05ec9e487239 100644 |
--- a/src/arm/assembler-arm.cc |
+++ b/src/arm/assembler-arm.cc |
@@ -450,6 +450,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_); |
@@ -467,6 +469,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_; |
+ } |
} |
@@ -3666,6 +3674,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; |
@@ -3686,6 +3703,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; |