Reviewers: Jakob,
Message:
PTAL
Description:
[arm] Decrease the size of the assembler class by allocating buffers of
pending
constants on the heap.
BUG=chromium:521828
LOG=N
Please review this at https://codereview.chromium.org/1309903009/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+33, -2 lines):
M src/arm/assembler-arm.h
M src/arm/assembler-arm.cc
M src/ic/access-compiler.h
Index: src/arm/assembler-arm.cc
diff --git a/src/arm/assembler-arm.cc b/src/arm/assembler-arm.cc
index
633b5d12c076b46e04343c9f2612928b21e46fd8..ca53ca3c0c54a52380816eb7ced5b1febbee6121
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 over, 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 over, 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;
Index: src/arm/assembler-arm.h
diff --git a/src/arm/assembler-arm.h b/src/arm/assembler-arm.h
index
d0fcac206e0b7916995c3c9cf09482769273ea91..c54e51df78cb57c146f1f9f815214ca899057e49
100644
--- a/src/arm/assembler-arm.h
+++ b/src/arm/assembler-arm.h
@@ -1465,6 +1465,7 @@ class Assembler : public AssemblerBase {
static const int kMaxDistToIntPool = 4*KB;
static const int kMaxDistToFPPool = 1*KB;
// All relocations could be integer, it therefore acts as the limit.
+ static const int kMinNumPendingConstants = 4;
static const int kMaxNumPending32Constants = kMaxDistToIntPool /
kInstrSize;
static const int kMaxNumPending64Constants = kMaxDistToFPPool /
kInstrSize;
@@ -1598,8 +1599,10 @@ class Assembler : public AssemblerBase {
// pending relocation entry per instruction.
// The buffers of pending constant pool entries.
- ConstantPoolEntry pending_32_bit_constants_[kMaxNumPending32Constants];
- ConstantPoolEntry pending_64_bit_constants_[kMaxNumPending64Constants];
+ ConstantPoolEntry
pending_32_bit_constants_buffer_[kMinNumPendingConstants];
+ ConstantPoolEntry
pending_64_bit_constants_buffer_[kMinNumPendingConstants];
+ ConstantPoolEntry* pending_32_bit_constants_;
+ ConstantPoolEntry* pending_64_bit_constants_;
// Number of pending constant pool entries in the 32 bits buffer.
int num_pending_32_bit_constants_;
// Number of pending constant pool entries in the 64 bits buffer.
Index: src/ic/access-compiler.h
diff --git a/src/ic/access-compiler.h b/src/ic/access-compiler.h
index
61567a2224b14132e57a1bdd90f143a595d01f17..75503c090acbe4a0e5d4f1b8ca7352605744bbea
100644
--- a/src/ic/access-compiler.h
+++ b/src/ic/access-compiler.h
@@ -81,6 +81,8 @@ class PropertyAccessCompiler BASE_EMBEDDED {
Isolate* isolate_;
MacroAssembler masm_;
+ // Ensure that MacroAssembler is reasonably big.
+ STATIC_ASSERT(sizeof(MacroAssembler) < KB / 2);
};
}
} // namespace v8::internal
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.