Commit 6de4d566 authored by Jakob Gruber's avatar Jakob Gruber Committed by V8 LUCI CQ

[compiler] Dedupe and clarify enable_root_relative_access options

- Rename AssemblerOptions::enable_root_array_delta_access to
  enable_root_relative_access.
- Remove the identical but duplicated
  PipelineData::roots_relative_addressing_enabled.

Bug: v8:9594
Change-Id: I41c5ddc3c1ad9681dce8402640c50529f00141cf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3043956
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75852}
parent da5ad432
......@@ -57,7 +57,7 @@ AssemblerOptions AssemblerOptions::Default(Isolate* isolate) {
const bool generating_embedded_builtin =
isolate->IsGeneratingEmbeddedBuiltins();
options.record_reloc_info_for_serialization = serializer;
options.enable_root_array_delta_access =
options.enable_root_relative_access =
!serializer && !generating_embedded_builtin;
#ifdef USE_SIMULATOR
// Even though the simulator is enabled, we may still need to generate code
......
......@@ -157,9 +157,9 @@ struct V8_EXPORT_PRIVATE AssemblerOptions {
// assembler is used on existing code directly (e.g. JumpTableAssembler)
// without any buffer to hold reloc information.
bool disable_reloc_info_for_patching = false;
// Enables access to exrefs by computing a delta from the root array.
// Only valid if code will not survive the process.
bool enable_root_array_delta_access = false;
// Enables root-relative access to arbitrary untagged addresses (usually
// external references). Only valid if code will not survive the process.
bool enable_root_relative_access = false;
// Enables specific assembler sequences only used for the simulator.
bool enable_simulator_code = false;
// Enables use of isolate-independent constants, indirected through the
......
......@@ -195,7 +195,7 @@ void TurboAssembler::PushArray(Register array, Register size, Register scratch,
Operand TurboAssembler::ExternalReferenceAsOperand(ExternalReference reference,
Register scratch) {
// TODO(jgruber): Add support for enable_root_array_delta_access.
// TODO(jgruber): Add support for enable_root_relative_access.
if (root_array_available() && options().isolate_independent_code) {
if (IsAddressableThroughRootRegister(isolate(), reference)) {
// Some external references can be efficiently loaded as an offset from
......@@ -276,7 +276,7 @@ void TurboAssembler::LoadRootRelative(Register destination, int32_t offset) {
void TurboAssembler::LoadAddress(Register destination,
ExternalReference source) {
// TODO(jgruber): Add support for enable_root_array_delta_access.
// TODO(jgruber): Add support for enable_root_relative_access.
if (root_array_available() && options().isolate_independent_code) {
IndirectLoadExternalReference(destination, source);
return;
......
......@@ -46,7 +46,7 @@ Operand StackArgumentsAccessor::GetArgumentOperand(int index) const {
}
void MacroAssembler::Load(Register destination, ExternalReference source) {
if (root_array_available_ && options().enable_root_array_delta_access) {
if (root_array_available_ && options().enable_root_relative_access) {
intptr_t delta = RootRegisterOffsetForExternalReference(isolate(), source);
if (is_int32(delta)) {
movq(destination, Operand(kRootRegister, static_cast<int32_t>(delta)));
......@@ -62,7 +62,7 @@ void MacroAssembler::Load(Register destination, ExternalReference source) {
}
void MacroAssembler::Store(ExternalReference destination, Register source) {
if (root_array_available_ && options().enable_root_array_delta_access) {
if (root_array_available_ && options().enable_root_relative_access) {
intptr_t delta =
RootRegisterOffsetForExternalReference(isolate(), destination);
if (is_int32(delta)) {
......@@ -103,7 +103,7 @@ void TurboAssembler::LoadRootRelative(Register destination, int32_t offset) {
void TurboAssembler::LoadAddress(Register destination,
ExternalReference source) {
if (root_array_available_ && options().enable_root_array_delta_access) {
if (root_array_available_ && options().enable_root_relative_access) {
intptr_t delta = RootRegisterOffsetForExternalReference(isolate(), source);
if (is_int32(delta)) {
leaq(destination, Operand(kRootRegister, static_cast<int32_t>(delta)));
......@@ -123,7 +123,7 @@ void TurboAssembler::LoadAddress(Register destination,
Operand TurboAssembler::ExternalReferenceAsOperand(ExternalReference reference,
Register scratch) {
if (root_array_available_ && options().enable_root_array_delta_access) {
if (root_array_available_ && options().enable_root_relative_access) {
int64_t delta =
RootRegisterOffsetForExternalReference(isolate(), reference);
if (is_int32(delta)) {
......
......@@ -147,9 +147,6 @@ class PipelineData {
may_have_unverifiable_graph_(false),
zone_stats_(zone_stats),
pipeline_statistics_(pipeline_statistics),
roots_relative_addressing_enabled_(
!isolate->serializer_enabled() &&
!isolate->IsGeneratingEmbeddedBuiltins()),
graph_zone_scope_(zone_stats_, kGraphZoneName, kCompressGraphZone),
graph_zone_(graph_zone_scope_.zone()),
instruction_zone_scope_(zone_stats_, kInstructionZoneName),
......@@ -551,7 +548,7 @@ class PipelineData {
code_generator_ = new CodeGenerator(
codegen_zone(), frame(), linkage, sequence(), info(), isolate(),
osr_helper_, start_source_position_, jump_optimization_info_,
info()->GetPoisoningMitigationLevel(), assembler_options_,
info()->GetPoisoningMitigationLevel(), assembler_options(),
info_->builtin(), max_unoptimized_frame_height(),
max_pushed_argument_count(),
FLAG_trace_turbo_stack_accesses ? debug_name_.get() : nullptr);
......@@ -571,10 +568,6 @@ class PipelineData {
const char* debug_name() const { return debug_name_.get(); }
bool roots_relative_addressing_enabled() {
return roots_relative_addressing_enabled_;
}
const ProfileDataFromFile* profile_data() const { return profile_data_; }
void set_profile_data(const ProfileDataFromFile* profile_data) {
profile_data_ = profile_data;
......@@ -615,7 +608,6 @@ class PipelineData {
CodeGenerator* code_generator_ = nullptr;
Typer* typer_ = nullptr;
Typer::Flags typer_flags_ = Typer::kNoFlags;
bool roots_relative_addressing_enabled_ = false;
// All objects in the following group of fields are allocated in graph_zone_.
// They are all set to nullptr when the graph_zone_ is destroyed.
......@@ -2245,7 +2237,7 @@ struct InstructionSelectionPhase {
FLAG_turbo_instruction_scheduling
? InstructionSelector::kEnableScheduling
: InstructionSelector::kDisableScheduling,
data->roots_relative_addressing_enabled()
data->assembler_options().enable_root_relative_access
? InstructionSelector::kEnableRootsRelativeAddressing
: InstructionSelector::kDisableRootsRelativeAddressing,
data->info()->GetPoisoningMitigationLevel(),
......
......@@ -8193,7 +8193,7 @@ AssemblerOptions WasmAssemblerOptions() {
AssemblerOptions options;
// Relocation info required to serialize {WasmCode} for proper functions.
options.record_reloc_info_for_serialization = true;
options.enable_root_array_delta_access = false;
options.enable_root_relative_access = false;
return options;
}
......@@ -8201,7 +8201,7 @@ AssemblerOptions WasmStubAssemblerOptions() {
AssemblerOptions options;
// Relocation info not necessary because stubs are not serialized.
options.record_reloc_info_for_serialization = false;
options.enable_root_array_delta_access = false;
options.enable_root_relative_access = false;
return options;
}
......
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