Commit 2dec4372 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Finish control flow after throw if not inlined.

R=jkummerow@chromium.org
BUG=v8:2868

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16992 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7f1fd5e1
......@@ -1885,6 +1885,13 @@ LInstruction* LChunkBuilder::DoBoundsCheckBaseIndexInformation(
}
LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
// The control instruction marking the end of a block that completed
// abruptly (e.g., threw an exception). There is nothing specific to do.
return NULL;
}
LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
LOperand* value = UseFixed(instr->value(), r0);
return MarkAsCall(new(zone()) LThrow(value), instr);
......
......@@ -64,6 +64,7 @@ class LChunkBuilder;
#define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \
V(AbnormalExit) \
V(AccessArgumentsAt) \
V(Add) \
V(Allocate) \
......@@ -1457,6 +1458,16 @@ class HReturn V8_FINAL : public HTemplateControlInstruction<0, 3> {
};
class HAbnormalExit V8_FINAL : public HTemplateControlInstruction<0, 0> {
public:
virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
return Representation::None();
}
DECLARE_CONCRETE_INSTRUCTION(AbnormalExit)
};
class HUnaryOperation : public HTemplateInstruction<1> {
public:
HUnaryOperation(HValue* value, HType type = HType::Tagged())
......
......@@ -5491,6 +5491,14 @@ void HOptimizedGraphBuilder::VisitThrow(Throw* expr) {
HThrow* instr = Add<HThrow>(value);
instr->set_position(expr->position());
Add<HSimulate>(expr->id());
// If the throw definitely exits the function, we can finish with a dummy
// control flow at this point. This is not the case if the throw is inside
// an inlined function which may be replaced.
if (call_context() == NULL) {
current_block()->FinishExit(new(zone()) HAbnormalExit);
set_current_block(NULL);
}
}
......
......@@ -1883,6 +1883,13 @@ LInstruction* LChunkBuilder::DoBoundsCheckBaseIndexInformation(
}
LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
// The control instruction marking the end of a block that completed
// abruptly (e.g., threw an exception). There is nothing specific to do.
return NULL;
}
LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
LOperand* context = UseFixed(instr->context(), esi);
LOperand* value = UseFixed(instr->value(), eax);
......
......@@ -1786,6 +1786,13 @@ LInstruction* LChunkBuilder::DoBoundsCheckBaseIndexInformation(
}
LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
// The control instruction marking the end of a block that completed
// abruptly (e.g., threw an exception). There is nothing specific to do.
return NULL;
}
LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
LOperand* value = UseFixed(instr->value(), a0);
return MarkAsCall(new(zone()) LThrow(value), instr);
......
......@@ -1780,6 +1780,13 @@ LInstruction* LChunkBuilder::DoBoundsCheckBaseIndexInformation(
}
LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
// The control instruction marking the end of a block that completed
// abruptly (e.g., threw an exception). There is nothing specific to do.
return NULL;
}
LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
LOperand* value = UseFixed(instr->value(), rax);
return MarkAsCall(new(zone()) LThrow(value), instr);
......
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