diff options
Diffstat (limited to 'deps/v8/src/arm/assembler-arm.cc')
-rw-r--r-- | deps/v8/src/arm/assembler-arm.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/deps/v8/src/arm/assembler-arm.cc b/deps/v8/src/arm/assembler-arm.cc index 633b5d12c0..50c707d2a0 100644 --- a/deps/v8/src/arm/assembler-arm.cc +++ b/deps/v8/src/arm/assembler-arm.cc @@ -34,6 +34,8 @@ // modified significantly by Google Inc. // Copyright 2012 the V8 project authors. All rights reserved. +#include "src/arm/assembler-arm.h" + #if V8_TARGET_ARCH_ARM #include "src/arm/assembler-arm-inl.h" @@ -300,6 +302,13 @@ MemOperand::MemOperand(Register rn, int32_t offset, AddrMode am) { rm_ = no_reg; offset_ = offset; am_ = am; + + // Accesses below the stack pointer are not safe, and are prohibited by the + // ABI. We can check obvious violations here. + if (rn.is(sp)) { + if (am == Offset) DCHECK_LE(0, offset); + if (am == NegOffset) DCHECK_GE(0, offset); + } } @@ -448,6 +457,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 +476,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 +3681,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 +3710,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; |