Commit f71260b2 authored by tebbi's avatar tebbi Committed by Commit bot

[turbofan] Make escape analysis fail silently for cyclic object states

R=bmeurer@chromium.org
BUG=v8:5634

Review-Url: https://codereview.chromium.org/2500143003
Cr-Commit-Position: refs/heads/master@{#40995}
parent 7ae7e843
......@@ -61,6 +61,8 @@ namespace internal {
V(kEliminatedBoundsCheckFailed, "Eliminated bounds check failed") \
V(kEmitLoadRegisterUnsupportedDoubleImmediate, \
"EmitLoadRegister: Unsupported double immediate") \
V(kCyclicObjectStateDetectedInEscapeAnalysis, \
"Cyclic object state detected by escape analysis") \
V(kEval, "eval") \
V(kExpectedAllocationSite, "Expected allocation site") \
V(kExpectedBooleanValue, "Expected boolean value") \
......
......@@ -327,7 +327,8 @@ Node* EscapeAnalysisReducer::ReduceStateValueInput(Node* node, int node_index,
if (escape_analysis()->IsCyclicObjectState(effect, input)) {
// TODO(mstarzinger): Represent cyclic object states differently to
// ensure the scheduler can properly handle such object states.
FATAL("Cyclic object state detected by escape analysis.");
compilation_failed_ = true;
return nullptr;
}
if (Node* object_state =
escape_analysis()->GetOrCreateObjectState(effect, input)) {
......
......@@ -30,6 +30,8 @@ class V8_EXPORT_PRIVATE EscapeAnalysisReducer final
// after this reducer has been applied. Has no effect in release mode.
void VerifyReplacement() const;
bool compilation_failed() const { return compilation_failed_; }
private:
Reduction ReduceLoad(Node* node);
Reduction ReduceStore(Node* node);
......@@ -55,6 +57,7 @@ class V8_EXPORT_PRIVATE EscapeAnalysisReducer final
// and nodes that do not need a visit from ReduceDeoptState etc.
BitVector fully_reduced_;
bool exists_virtual_allocate_;
bool compilation_failed_ = false;
DISALLOW_COPY_AND_ASSIGN(EscapeAnalysisReducer);
};
......
......@@ -936,6 +936,10 @@ struct EscapeAnalysisPhase {
&escape_analysis, temp_zone);
AddReducer(data, &graph_reducer, &escape_reducer);
graph_reducer.ReduceGraph();
if (escape_reducer.compilation_failed()) {
data->set_compilation_failed();
return;
}
escape_reducer.VerifyReplacement();
}
};
......@@ -1550,6 +1554,11 @@ bool PipelineImpl::CreateGraph() {
if (FLAG_turbo_escape) {
Run<EscapeAnalysisPhase>();
if (data->compilation_failed()) {
info()->AbortOptimization(kCyclicObjectStateDetectedInEscapeAnalysis);
data->EndPhaseKind();
return false;
}
RunPrintAndVerify("Escape Analysed");
}
}
......
......@@ -22,7 +22,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrue), U8(53),
B(LdaSmi), U8(76),
B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
......@@ -133,7 +133,7 @@ bytecodes: [
B(LdaSmi), U8(1),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrueConstant), U8(0),
B(LdaSmi), U8(76),
B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
......@@ -285,7 +285,7 @@ bytecodes: [
B(LdaSmi), U8(1),
B(TestEqualStrict), R(4), U8(0),
B(JumpIfTrueConstant), U8(3),
B(LdaSmi), U8(76),
B(LdaSmi), U8(77),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kAbort), R(5), U8(1),
B(LdaSmi), U8(-2),
......@@ -353,7 +353,7 @@ bytecodes: [
B(LdaSmi), U8(1),
B(TestEqualStrict), R(4), U8(0),
B(JumpIfTrueConstant), U8(8),
B(LdaSmi), U8(76),
B(LdaSmi), U8(77),
B(Star), R(12),
B(CallRuntime), U16(Runtime::kAbort), R(12), U8(1),
/* 27 S> */ B(LdaContextSlot), R(1), U8(7), U8(0),
......
......@@ -22,7 +22,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrue), U8(63),
B(LdaSmi), U8(76),
B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
......@@ -92,7 +92,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrue), U8(63),
B(LdaSmi), U8(76),
B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
......@@ -164,7 +164,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(2), U8(0),
B(JumpIfTrue), U8(63),
B(LdaSmi), U8(76),
B(LdaSmi), U8(77),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1),
B(LdaSmi), U8(-2),
......@@ -268,7 +268,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(2), U8(0),
B(JumpIfTrue), U8(63),
B(LdaSmi), U8(76),
B(LdaSmi), U8(77),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1),
B(LdaSmi), U8(-2),
......@@ -357,7 +357,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(2), U8(0),
B(JumpIfTrue), U8(67),
B(LdaSmi), U8(76),
B(LdaSmi), U8(77),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1),
B(LdaSmi), U8(-2),
......@@ -448,7 +448,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(2), U8(0),
B(JumpIfTrue), U8(67),
B(LdaSmi), U8(76),
B(LdaSmi), U8(77),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1),
B(LdaSmi), U8(-2),
......@@ -537,7 +537,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrue), U8(67),
B(LdaSmi), U8(76),
B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
......@@ -612,7 +612,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrue), U8(67),
B(LdaSmi), U8(76),
B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
......@@ -702,7 +702,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrue), U8(63),
B(LdaSmi), U8(76),
B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
......@@ -772,7 +772,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrue), U8(63),
B(LdaSmi), U8(76),
B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
......@@ -843,7 +843,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrue), U8(73),
B(LdaSmi), U8(76),
B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
......
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