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