Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: src/arm/assembler-arm.cc

Issue 1309903009: [arm] Decrease the size of the assembler class by allocating buffers of pending constants on the he… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/ic/access-compiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/ic/access-compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698