Commit 8420d575 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[interpreter] Fix re-throw to not have frame-state.

The runtime call to Runtime::kReThrow does not need a frame-state node
attached, the frame-state input count is zero. This restructures the
graph builder to not instantiate a FrameStateBeforeAndAfter for it.

R=jarin@chromium.org
TEST=cctest/test-run-bytecode-graph-builder
BUG=v8:4674
LOG=n

Review URL: https://codereview.chromium.org/1654833002

Cr-Commit-Position: refs/heads/master@{#33641}
parent 9f5dca8f
...@@ -1238,24 +1238,24 @@ void BytecodeGraphBuilder::VisitNew() { BuildCallConstruct(); } ...@@ -1238,24 +1238,24 @@ void BytecodeGraphBuilder::VisitNew() { BuildCallConstruct(); }
void BytecodeGraphBuilder::VisitNewWide() { BuildCallConstruct(); } void BytecodeGraphBuilder::VisitNewWide() { BuildCallConstruct(); }
void BytecodeGraphBuilder::BuildThrowOp(const Operator* call_op) { void BytecodeGraphBuilder::BuildThrow() {
FrameStateBeforeAndAfter states(this); FrameStateBeforeAndAfter states(this);
Node* value = environment()->LookupAccumulator(); Node* value = environment()->LookupAccumulator();
Node* call = NewNode(call_op, value); Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value);
environment()->RecordAfterState(call, &states); environment()->BindAccumulator(call, &states);
} }
void BytecodeGraphBuilder::VisitThrow() { void BytecodeGraphBuilder::VisitThrow() {
BuildThrowOp(javascript()->CallRuntime(Runtime::kThrow)); BuildThrow();
Node* control = Node* call = environment()->LookupAccumulator();
NewNode(common()->Throw(), environment()->LookupAccumulator()); Node* control = NewNode(common()->Throw(), call);
MergeControlToLeaveFunction(control); MergeControlToLeaveFunction(control);
} }
void BytecodeGraphBuilder::VisitReThrow() { void BytecodeGraphBuilder::VisitReThrow() {
BuildThrowOp(javascript()->CallRuntime(Runtime::kReThrow)); Node* value = environment()->LookupAccumulator();
Node* control = Node* call = NewNode(javascript()->CallRuntime(Runtime::kReThrow), value);
NewNode(common()->Throw(), environment()->LookupAccumulator()); Node* control = NewNode(common()->Throw(), call);
MergeControlToLeaveFunction(control); MergeControlToLeaveFunction(control);
} }
......
...@@ -136,7 +136,7 @@ class BytecodeGraphBuilder { ...@@ -136,7 +136,7 @@ class BytecodeGraphBuilder {
void BuildCallRuntime(); void BuildCallRuntime();
void BuildCallRuntimeForPair(); void BuildCallRuntimeForPair();
void BuildCallConstruct(); void BuildCallConstruct();
void BuildThrowOp(const Operator* op); void BuildThrow();
void BuildBinaryOp(const Operator* op); void BuildBinaryOp(const Operator* op);
void BuildCompareOp(const Operator* op); void BuildCompareOp(const Operator* op);
void BuildDelete(); void BuildDelete();
......
...@@ -1462,11 +1462,10 @@ TEST(BytecodeGraphBuilderTryFinally1) { ...@@ -1462,11 +1462,10 @@ TEST(BytecodeGraphBuilderTryFinally1) {
" try { a = 2; continue; } finally { a = 3; }" " try { a = 2; continue; } finally { a = 3; }"
"} return a + i;", "} return a + i;",
{handle(Smi::FromInt(23), isolate)}}, {handle(Smi::FromInt(23), isolate)}},
// TODO(mstarzinger): Investigate failure! {"var a = 1; try { a = 2;"
// {"var a = 1; try { a = 2;" " try { a = 3; throw 23; } finally { a = 4; }"
// " try { a = 3; throw 23; } finally { a = 4; }" "} catch(e) { a = a + e; } return a;",
// "} catch(e) { a = a + e; } return a;", {handle(Smi::FromInt(27), isolate)}},
// {handle(Smi::FromInt(27), isolate)}},
}; };
size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]);
......
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