[assembler] Remove unconditional code target reservation

Some code - especially WebAssembly - does not make use of the code
target vector. Unconditionally reserving 100 entries adds unnecessary
overhead e.g. to jump table patching (~10%). This CL just removes this
reservation.

R=mstarzinger@chromium.org

Bug: v8:8916
Change-Id: I671820f3eb413fa2d03cef4bbf06adfc7a585266
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1559868
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60772}
This commit is contained in:
Clemens Hammacher 2019-04-10 10:33:20 +02:00 committed by Commit Bot
parent 42b90afe69
commit 4a7563d3d1
5 changed files with 0 additions and 9 deletions

View File

@ -560,7 +560,6 @@ void Assembler::Reset() {
memset(buffer_start_, 0, pc_ - buffer_start_);
#endif
pc_ = buffer_start_;
ReserveCodeTargetSpace(64);
reloc_info_writer.Reposition(buffer_start_ + buffer_->size(), pc_);
constpool_.Clear();
next_constant_pool_check_ = 0;

View File

@ -273,10 +273,6 @@ void AssemblerBase::UpdateCodeTarget(intptr_t code_target_index,
code_targets_[code_target_index] = code;
}
void AssemblerBase::ReserveCodeTargetSpace(size_t num_of_code_targets) {
code_targets_.reserve(num_of_code_targets);
}
int Assembler::WriteCodeComments() {
if (!FLAG_code_comments || code_comments_writer_.entry_count() == 0) return 0;
int offset = pc_offset();

View File

@ -279,8 +279,6 @@ class V8_EXPORT_PRIVATE AssemblerBase : public Malloced {
Handle<Code> GetCodeTarget(intptr_t code_target_index) const;
// Update to the code target at {code_target_index} to {target}.
void UpdateCodeTarget(intptr_t code_target_index, Handle<Code> target);
// Reserves space in the code target vector.
void ReserveCodeTargetSpace(size_t num_of_code_targets);
// The buffer into which code and relocation info are generated.
std::unique_ptr<AssemblerBuffer> buffer_;

View File

@ -344,7 +344,6 @@ Assembler::Assembler(const AssemblerOptions& options,
std::unique_ptr<AssemblerBuffer> buffer)
: AssemblerBase(options, std::move(buffer)) {
reloc_info_writer.Reposition(buffer_start_ + buffer_->size(), pc_);
ReserveCodeTargetSpace(100);
last_bound_pos_ = 0;
relocations_.reserve(128);
}

View File

@ -428,7 +428,6 @@ bool Assembler::UseConstPoolFor(RelocInfo::Mode rmode) {
Assembler::Assembler(const AssemblerOptions& options,
std::unique_ptr<AssemblerBuffer> buffer)
: AssemblerBase(options, std::move(buffer)), constpool_(this) {
ReserveCodeTargetSpace(100);
reloc_info_writer.Reposition(buffer_start_ + buffer_->size(), pc_);
if (CpuFeatures::IsSupported(SSE4_1)) {
EnableCpuFeature(SSSE3);