Commit 4a7563d3 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[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/+/1559868Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60772}
parent 42b90afe
......@@ -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;
......
......@@ -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();
......
......@@ -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_;
......
......@@ -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);
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment