Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: src/compiler/typer.cc

Issue 874983002: [turbofan] Handle cyclic dependencies in context typing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-451012.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/typer.cc
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc
index 4b3a8830a0fff9cbed6694b9588742225d262814..0694c9cba2f07f488d5163a79733dcbe6a279f1a 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -316,14 +316,7 @@ class Typer::Visitor : public Reducer {
return BoundsOrNone(operand_node);
}
- Bounds ContextOperand(Node* node) {
- Bounds result = BoundsOrNone(NodeProperties::GetContextInput(node));
- DCHECK(result.upper->Maybe(Type::Internal()));
- // TODO(rossberg): More precisely, instead of the above assertion, we should
- // back-propagate the constraint that it has to be a subtype of Internal.
- return result;
- }
-
+ Bounds WrapContextBoundsForInput(Node* node);
Type* Weaken(Type* current_type, Type* previous_type);
Zone* zone() { return typer_->zone(); }
@@ -1381,40 +1374,45 @@ Bounds Typer::Visitor::TypeJSStoreContext(Node* node) {
}
+Bounds Typer::Visitor::WrapContextBoundsForInput(Node* node) {
+ Bounds outer = BoundsOrNone(NodeProperties::GetContextInput(node));
+ if (outer.upper->Is(Type::None())) {
+ return Bounds(Type::None());
+ } else {
+ DCHECK(outer.upper->Maybe(Type::Internal()));
+ return Bounds(Type::Context(outer.upper, zone()));
+ }
+}
+
+
Bounds Typer::Visitor::TypeJSCreateFunctionContext(Node* node) {
- Bounds outer = ContextOperand(node);
- return Bounds(Type::Context(outer.upper, zone()));
+ return WrapContextBoundsForInput(node);
}
Bounds Typer::Visitor::TypeJSCreateCatchContext(Node* node) {
- Bounds outer = ContextOperand(node);
- return Bounds(Type::Context(outer.upper, zone()));
+ return WrapContextBoundsForInput(node);
}
Bounds Typer::Visitor::TypeJSCreateWithContext(Node* node) {
- Bounds outer = ContextOperand(node);
- return Bounds(Type::Context(outer.upper, zone()));
+ return WrapContextBoundsForInput(node);
}
Bounds Typer::Visitor::TypeJSCreateBlockContext(Node* node) {
- Bounds outer = ContextOperand(node);
- return Bounds(Type::Context(outer.upper, zone()));
+ return WrapContextBoundsForInput(node);
}
Bounds Typer::Visitor::TypeJSCreateModuleContext(Node* node) {
// TODO(rossberg): this is probably incorrect
- Bounds outer = ContextOperand(node);
- return Bounds(Type::Context(outer.upper, zone()));
+ return WrapContextBoundsForInput(node);
}
Bounds Typer::Visitor::TypeJSCreateScriptContext(Node* node) {
- Bounds outer = ContextOperand(node);
- return Bounds(Type::Context(outer.upper, zone()));
+ return WrapContextBoundsForInput(node);
}
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-451012.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698