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

Unified Diff: src/compiler/js-native-context-specialization.cc

Issue 1424733002: [turbofan] Improve deferred code handling for polymorphic property access. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-native-context-specialization.cc
diff --git a/src/compiler/js-native-context-specialization.cc b/src/compiler/js-native-context-specialization.cc
index 38735e1dc7fea22737b15c85145837ad7522a41c..7b119c19b992a7486841df388d76b689094d1fe6 100644
--- a/src/compiler/js-native-context-specialization.cc
+++ b/src/compiler/js-native-context-specialization.cc
@@ -537,8 +537,8 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) {
Node* check =
graph()->NewNode(machine()->Uint32LessThan(), receiver_instance_type,
jsgraph()->Uint32Constant(FIRST_NONSTRING_TYPE));
- Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue),
- check, fallthrough_control);
+ Node* branch =
+ graph()->NewNode(common()->Branch(), check, fallthrough_control);
fallthrough_control = graph()->NewNode(common()->IfFalse(), branch);
this_control = graph()->NewNode(common()->IfTrue(), branch);
} else {
@@ -550,8 +550,8 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) {
Node* check =
graph()->NewNode(simplified()->ReferenceEqual(Type::Internal()),
receiver_map, jsgraph()->Constant(map));
- Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue),
- check, fallthrough_control);
+ Node* branch =
+ graph()->NewNode(common()->Branch(), check, fallthrough_control);
this_controls.push_back(graph()->NewNode(common()->IfTrue(), branch));
fallthrough_control = graph()->NewNode(common()->IfFalse(), branch);
}
@@ -613,6 +613,17 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) {
}
// Collect the fallthru control as final "exit" control.
+ if (fallthrough_control != control) {
+ // Mark the last fallthru branch as deferred.
+ Node* branch = NodeProperties::GetControlInput(fallthrough_control);
+ DCHECK_EQ(IrOpcode::kBranch, branch->opcode());
+ if (fallthrough_control->opcode() == IrOpcode::kIfTrue) {
+ NodeProperties::ChangeOp(branch, common()->Branch(BranchHint::kFalse));
+ } else {
+ DCHECK_EQ(IrOpcode::kIfFalse, fallthrough_control->opcode());
+ NodeProperties::ChangeOp(branch, common()->Branch(BranchHint::kTrue));
+ }
+ }
exit_controls.push_back(fallthrough_control);
// Generate the single "exit" point, where we get if either all map/instance
@@ -721,8 +732,8 @@ Reduction JSNativeContextSpecialization::ReduceJSStoreNamed(Node* node) {
Node* check =
graph()->NewNode(machine()->Uint32LessThan(), receiver_instance_type,
jsgraph()->Uint32Constant(FIRST_NONSTRING_TYPE));
- Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue),
- check, fallthrough_control);
+ Node* branch =
+ graph()->NewNode(common()->Branch(), check, fallthrough_control);
fallthrough_control = graph()->NewNode(common()->IfFalse(), branch);
this_control = graph()->NewNode(common()->IfTrue(), branch);
} else {
@@ -734,8 +745,8 @@ Reduction JSNativeContextSpecialization::ReduceJSStoreNamed(Node* node) {
Node* check =
graph()->NewNode(simplified()->ReferenceEqual(Type::Internal()),
receiver_map, jsgraph()->Constant(map));
- Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue),
- check, fallthrough_control);
+ Node* branch =
+ graph()->NewNode(common()->Branch(), check, fallthrough_control);
this_controls.push_back(graph()->NewNode(common()->IfTrue(), branch));
fallthrough_control = graph()->NewNode(common()->IfFalse(), branch);
}
@@ -830,6 +841,17 @@ Reduction JSNativeContextSpecialization::ReduceJSStoreNamed(Node* node) {
}
// Collect the fallthru control as final "exit" control.
Jarin 2015/10/26 21:14:50 Why the funny spelling of fallthru? (Also in other
Benedikt Meurer 2015/10/28 10:20:50 Done. Refactored the whole thing into a single nam
+ if (fallthrough_control != control) {
+ // Mark the last fallthru branch as deferred.
+ Node* branch = NodeProperties::GetControlInput(fallthrough_control);
+ DCHECK_EQ(IrOpcode::kBranch, branch->opcode());
+ if (fallthrough_control->opcode() == IrOpcode::kIfTrue) {
+ NodeProperties::ChangeOp(branch, common()->Branch(BranchHint::kFalse));
+ } else {
+ DCHECK_EQ(IrOpcode::kIfFalse, fallthrough_control->opcode());
+ NodeProperties::ChangeOp(branch, common()->Branch(BranchHint::kTrue));
+ }
+ }
exit_controls.push_back(fallthrough_control);
// Generate the single "exit" point, where we get if either all map/instance
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698