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