Reviewers: Sven Panne,
Description:
[turbofan] Make throwing expressions kill the environment.
This ensures that all expressions that throw actually mark the current
environment as dead in the AstGraphBuilder. This prevents live ranges
from being unnecessarily increased by paths that don't fall-through.
Note that we can do that because Runtime::kThrowFoo never returns.
[email protected]
Please review this at https://codereview.chromium.org/1049203002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+23, -10 lines):
M src/compiler/ast-graph-builder.h
M src/compiler/ast-graph-builder.cc
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc
b/src/compiler/ast-graph-builder.cc
index
e550f511288f0ee4236e2feeff3dfada551439d4..6633ce7057b8e8ad85fc2dd2439953fcc9098ddc
100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -2737,13 +2737,8 @@ Node*
AstGraphBuilder::BuildThrowIfStaticPrototype(Node* name,
Node* check = NewNode(javascript()->StrictEqual(), name,
prototype_string);
prototype_check.If(check);
prototype_check.Then();
- {
- const Operator* op =
- javascript()->CallRuntime(Runtime::kThrowStaticPrototypeError, 0);
- Node* call = NewNode(op);
- PrepareFrameState(call, bailout_id);
- environment()->Push(call);
- }
+ Node* error = BuildThrowStaticPrototypeError(bailout_id);
+ environment()->Push(error);
prototype_check.Else();
environment()->Push(name);
prototype_check.End();
@@ -3102,7 +3097,9 @@ Node* AstGraphBuilder::BuildThrowError(Node*
exception, BailoutId bailout_id) {
const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1);
Node* call = NewNode(op, exception);
PrepareFrameState(call, bailout_id);
- return call;
+ Node* control = NewNode(common()->Throw(), call);
+ UpdateControlDependencyToLeaveFunction(control);
+ return control;
}
@@ -3113,7 +3110,9 @@ Node*
AstGraphBuilder::BuildThrowReferenceError(Variable* variable,
javascript()->CallRuntime(Runtime::kThrowReferenceError, 1);
Node* call = NewNode(op, variable_name);
PrepareFrameState(call, bailout_id);
- return call;
+ Node* control = NewNode(common()->Throw(), call);
+ UpdateControlDependencyToLeaveFunction(control);
+ return control;
}
@@ -3122,7 +3121,20 @@ Node*
AstGraphBuilder::BuildThrowConstAssignError(BailoutId bailout_id) {
javascript()->CallRuntime(Runtime::kThrowConstAssignError, 0);
Node* call = NewNode(op);
PrepareFrameState(call, bailout_id);
- return call;
+ Node* control = NewNode(common()->Throw(), call);
+ UpdateControlDependencyToLeaveFunction(control);
+ return control;
+}
+
+
+Node* AstGraphBuilder::BuildThrowStaticPrototypeError(BailoutId
bailout_id) {
+ const Operator* op =
+ javascript()->CallRuntime(Runtime::kThrowStaticPrototypeError, 0);
+ Node* call = NewNode(op);
+ PrepareFrameState(call, bailout_id);
+ Node* control = NewNode(common()->Throw(), call);
+ UpdateControlDependencyToLeaveFunction(control);
+ return control;
}
Index: src/compiler/ast-graph-builder.h
diff --git a/src/compiler/ast-graph-builder.h
b/src/compiler/ast-graph-builder.h
index
f75207783fc6140280b39bbdb12f195d86840919..f851a3003665bb85f1f1e343e664352dbcb415d3
100644
--- a/src/compiler/ast-graph-builder.h
+++ b/src/compiler/ast-graph-builder.h
@@ -300,6 +300,7 @@ class AstGraphBuilder : public AstVisitor {
Node* BuildThrowError(Node* exception, BailoutId bailout_id);
Node* BuildThrowReferenceError(Variable* var, BailoutId bailout_id);
Node* BuildThrowConstAssignError(BailoutId bailout_id);
+ Node* BuildThrowStaticPrototypeError(BailoutId bailout_id);
// Builders for dynamic hole-checks at runtime.
Node* BuildHoleCheckSilent(Node* value, Node* for_hole, Node* not_hole);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.