Commit 0cfbaff4 authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

Revert "[turbofan] disable indirect jumps in Turbofan generated switches"

This reverts commit 957ac364.

Reason for revert: Breaks roll (crbug.com/v8/7388)

Original change's description:
> [turbofan] disable indirect jumps in Turbofan generated switches
> 
> Bug: 
> Change-Id: I326bf518f895e7c030376210e7797f3dd4a9ae1f
> Reviewed-on: https://chromium-review.googlesource.com/873643
> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
> Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#50984}

TBR=jarin@chromium.org,tebbi@chromium.org

Change-Id: Id2546e722179e6d8f2f102ce02fb18d696a79764
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/894385Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50995}
parent 35ca0a01
...@@ -1980,7 +1980,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -1980,7 +1980,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); InstructionOperand value_operand = g.UseRegister(node->InputAt(0));
// Emit either ArchTableSwitch or ArchLookupSwitch. // Emit either ArchTableSwitch or ArchLookupSwitch.
if (!FLAG_turbo_disable_switch_jump_table) {
static const size_t kMaxTableSwitchValueRange = 2 << 16; static const size_t kMaxTableSwitchValueRange = 2 << 16;
size_t table_space_cost = 4 + sw.value_range; size_t table_space_cost = 4 + sw.value_range;
size_t table_time_cost = 3; size_t table_time_cost = 3;
...@@ -2000,7 +1999,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -2000,7 +1999,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
// Generate a table lookup. // Generate a table lookup.
return EmitTableSwitch(sw, index_operand); return EmitTableSwitch(sw, index_operand);
} }
}
// Generate a sequence of conditional jumps. // Generate a sequence of conditional jumps.
return EmitLookupSwitch(sw, value_operand); return EmitLookupSwitch(sw, value_operand);
......
...@@ -2361,7 +2361,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -2361,7 +2361,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); InstructionOperand value_operand = g.UseRegister(node->InputAt(0));
// Emit either ArchTableSwitch or ArchLookupSwitch. // Emit either ArchTableSwitch or ArchLookupSwitch.
if (!FLAG_turbo_disable_switch_jump_table) {
static const size_t kMaxTableSwitchValueRange = 2 << 16; static const size_t kMaxTableSwitchValueRange = 2 << 16;
size_t table_space_cost = 4 + sw.value_range; size_t table_space_cost = 4 + sw.value_range;
size_t table_time_cost = 3; size_t table_time_cost = 3;
...@@ -2381,7 +2380,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -2381,7 +2380,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
// Generate a table lookup. // Generate a table lookup.
return EmitTableSwitch(sw, index_operand); return EmitTableSwitch(sw, index_operand);
} }
}
// Generate a sequence of conditional jumps. // Generate a sequence of conditional jumps.
return EmitLookupSwitch(sw, value_operand); return EmitLookupSwitch(sw, value_operand);
......
...@@ -1431,7 +1431,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -1431,7 +1431,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); InstructionOperand value_operand = g.UseRegister(node->InputAt(0));
// Emit either ArchTableSwitch or ArchLookupSwitch. // Emit either ArchTableSwitch or ArchLookupSwitch.
if (!FLAG_turbo_disable_switch_jump_table) {
static const size_t kMaxTableSwitchValueRange = 2 << 16; static const size_t kMaxTableSwitchValueRange = 2 << 16;
size_t table_space_cost = 4 + sw.value_range; size_t table_space_cost = 4 + sw.value_range;
size_t table_time_cost = 3; size_t table_time_cost = 3;
...@@ -1451,7 +1450,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -1451,7 +1450,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
// Generate a table lookup. // Generate a table lookup.
return EmitTableSwitch(sw, index_operand); return EmitTableSwitch(sw, index_operand);
} }
}
// Generate a sequence of conditional jumps. // Generate a sequence of conditional jumps.
return EmitLookupSwitch(sw, value_operand); return EmitLookupSwitch(sw, value_operand);
......
...@@ -1608,7 +1608,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -1608,7 +1608,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); InstructionOperand value_operand = g.UseRegister(node->InputAt(0));
// Emit either ArchTableSwitch or ArchLookupSwitch. // Emit either ArchTableSwitch or ArchLookupSwitch.
if (!FLAG_turbo_disable_switch_jump_table) {
static const size_t kMaxTableSwitchValueRange = 2 << 16; static const size_t kMaxTableSwitchValueRange = 2 << 16;
size_t table_space_cost = 9 + sw.value_range; size_t table_space_cost = 9 + sw.value_range;
size_t table_time_cost = 3; size_t table_time_cost = 3;
...@@ -1628,7 +1627,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -1628,7 +1627,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
// Generate a table lookup. // Generate a table lookup.
return EmitTableSwitch(sw, index_operand); return EmitTableSwitch(sw, index_operand);
} }
}
// Generate a sequence of conditional jumps. // Generate a sequence of conditional jumps.
return EmitLookupSwitch(sw, value_operand); return EmitLookupSwitch(sw, value_operand);
......
...@@ -2216,7 +2216,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -2216,7 +2216,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); InstructionOperand value_operand = g.UseRegister(node->InputAt(0));
// Emit either ArchTableSwitch or ArchLookupSwitch. // Emit either ArchTableSwitch or ArchLookupSwitch.
if (!FLAG_turbo_disable_switch_jump_table) {
static const size_t kMaxTableSwitchValueRange = 2 << 16; static const size_t kMaxTableSwitchValueRange = 2 << 16;
size_t table_space_cost = 10 + 2 * sw.value_range; size_t table_space_cost = 10 + 2 * sw.value_range;
size_t table_time_cost = 3; size_t table_time_cost = 3;
...@@ -2236,7 +2235,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -2236,7 +2235,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
// Generate a table lookup. // Generate a table lookup.
return EmitTableSwitch(sw, index_operand); return EmitTableSwitch(sw, index_operand);
} }
}
// Generate a sequence of conditional jumps. // Generate a sequence of conditional jumps.
return EmitLookupSwitch(sw, value_operand); return EmitLookupSwitch(sw, value_operand);
......
...@@ -1762,7 +1762,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -1762,7 +1762,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); InstructionOperand value_operand = g.UseRegister(node->InputAt(0));
// Emit either ArchTableSwitch or ArchLookupSwitch. // Emit either ArchTableSwitch or ArchLookupSwitch.
if (!FLAG_turbo_disable_switch_jump_table) {
static const size_t kMaxTableSwitchValueRange = 2 << 16; static const size_t kMaxTableSwitchValueRange = 2 << 16;
size_t table_space_cost = 4 + sw.value_range; size_t table_space_cost = 4 + sw.value_range;
size_t table_time_cost = 3; size_t table_time_cost = 3;
...@@ -1782,7 +1781,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -1782,7 +1781,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
// Generate a table lookup. // Generate a table lookup.
return EmitTableSwitch(sw, index_operand); return EmitTableSwitch(sw, index_operand);
} }
}
// Generate a sequence of conditional jumps. // Generate a sequence of conditional jumps.
return EmitLookupSwitch(sw, value_operand); return EmitLookupSwitch(sw, value_operand);
......
...@@ -2138,7 +2138,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -2138,7 +2138,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); InstructionOperand value_operand = g.UseRegister(node->InputAt(0));
// Emit either ArchTableSwitch or ArchLookupSwitch. // Emit either ArchTableSwitch or ArchLookupSwitch.
if (!FLAG_turbo_disable_switch_jump_table) {
static const size_t kMaxTableSwitchValueRange = 2 << 16; static const size_t kMaxTableSwitchValueRange = 2 << 16;
size_t table_space_cost = 4 + sw.value_range; size_t table_space_cost = 4 + sw.value_range;
size_t table_time_cost = 3; size_t table_time_cost = 3;
...@@ -2163,7 +2162,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -2163,7 +2162,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
// Generate a table lookup. // Generate a table lookup.
return EmitTableSwitch(sw, index_operand); return EmitTableSwitch(sw, index_operand);
} }
}
// Generate a sequence of conditional jumps. // Generate a sequence of conditional jumps.
return EmitLookupSwitch(sw, value_operand); return EmitLookupSwitch(sw, value_operand);
......
...@@ -1959,7 +1959,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -1959,7 +1959,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); InstructionOperand value_operand = g.UseRegister(node->InputAt(0));
// Emit either ArchTableSwitch or ArchLookupSwitch. // Emit either ArchTableSwitch or ArchLookupSwitch.
if (!FLAG_turbo_disable_switch_jump_table) {
static const size_t kMaxTableSwitchValueRange = 2 << 16; static const size_t kMaxTableSwitchValueRange = 2 << 16;
size_t table_space_cost = 4 + sw.value_range; size_t table_space_cost = 4 + sw.value_range;
size_t table_time_cost = 3; size_t table_time_cost = 3;
...@@ -1972,8 +1971,7 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -1972,8 +1971,7 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
sw.value_range <= kMaxTableSwitchValueRange) { sw.value_range <= kMaxTableSwitchValueRange) {
InstructionOperand index_operand = g.TempRegister(); InstructionOperand index_operand = g.TempRegister();
if (sw.min_value) { if (sw.min_value) {
// The leal automatically zero extends, so result is a valid 64-bit // The leal automatically zero extends, so result is a valid 64-bit index.
// index.
Emit(kX64Lea32 | AddressingModeField::encode(kMode_MRI), index_operand, Emit(kX64Lea32 | AddressingModeField::encode(kMode_MRI), index_operand,
value_operand, g.TempImmediate(-sw.min_value)); value_operand, g.TempImmediate(-sw.min_value));
} else { } else {
...@@ -1983,7 +1981,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { ...@@ -1983,7 +1981,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
// Generate a table lookup. // Generate a table lookup.
return EmitTableSwitch(sw, index_operand); return EmitTableSwitch(sw, index_operand);
} }
}
// Generate a sequence of conditional jumps. // Generate a sequence of conditional jumps.
return EmitLookupSwitch(sw, value_operand); return EmitLookupSwitch(sw, value_operand);
......
...@@ -490,10 +490,6 @@ DEFINE_BOOL(untrusted_code_mitigations, V8_DEFAULT_UNTRUSTED_CODE_MITIGATIONS, ...@@ -490,10 +490,6 @@ DEFINE_BOOL(untrusted_code_mitigations, V8_DEFAULT_UNTRUSTED_CODE_MITIGATIONS,
"Enable mitigations for executing untrusted code") "Enable mitigations for executing untrusted code")
#undef V8_DEFAULT_UNTRUSTED_CODE_MITIGATIONS #undef V8_DEFAULT_UNTRUSTED_CODE_MITIGATIONS
DEFINE_BOOL(turbo_disable_switch_jump_table, false,
"do not emit jump-tables in Turbofan")
DEFINE_IMPLICATION(untrusted_code_mitigations, turbo_disable_switch_jump_table)
// Flags to help platform porters // Flags to help platform porters
DEFINE_BOOL(minimal, false, DEFINE_BOOL(minimal, false,
"simplifies execution model to make porting " "simplifies execution model to make porting "
......
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