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

Unified Diff: src/compiler/js-typed-lowering.cc

Issue 776243002: [turbofan] Reduce context accesses during typed lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 | « src/compiler/js-typed-lowering.h ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
index 00155044d4c1016636bf77d6f753a86c3117879d..b898386172d517a8c2a1f55363f9fe55bc8bda16 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -802,6 +802,47 @@ Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) {
}
+Reduction JSTypedLowering::ReduceJSLoadContext(Node* node) {
+ DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode());
+ ContextAccess const& access = ContextAccessOf(node->op());
+ Node* const effect = NodeProperties::GetEffectInput(node);
+ Node* const control = graph()->start();
+ for (size_t i = 0; i < access.depth(); ++i) {
+ node->ReplaceInput(
+ 0, graph()->NewNode(
+ simplified()->LoadField(
+ AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)),
+ NodeProperties::GetValueInput(node, 0), effect, control));
+ }
+ node->set_op(
+ simplified()->LoadField(AccessBuilder::ForContextSlot(access.index())));
+ node->ReplaceInput(1, effect);
+ node->ReplaceInput(2, control);
+ DCHECK_EQ(3, node->InputCount());
+ return Changed(node);
+}
+
+
+Reduction JSTypedLowering::ReduceJSStoreContext(Node* node) {
+ DCHECK_EQ(IrOpcode::kJSStoreContext, node->opcode());
+ ContextAccess const& access = ContextAccessOf(node->op());
+ Node* const effect = NodeProperties::GetEffectInput(node);
+ Node* const control = graph()->start();
+ for (size_t i = 0; i < access.depth(); ++i) {
+ node->ReplaceInput(
+ 0, graph()->NewNode(
+ simplified()->LoadField(
+ AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)),
+ NodeProperties::GetValueInput(node, 0), effect, control));
+ }
+ node->set_op(
+ simplified()->StoreField(AccessBuilder::ForContextSlot(access.index())));
+ node->RemoveInput(2);
+ DCHECK_EQ(4, node->InputCount());
+ return Changed(node);
+}
+
+
static Reduction ReplaceWithReduction(Node* node, Reduction reduction) {
if (reduction.Changed()) {
NodeProperties::ReplaceWithValue(node, reduction.replacement());
@@ -888,6 +929,10 @@ Reduction JSTypedLowering::Reduce(Node* node) {
return ReduceJSLoadProperty(node);
case IrOpcode::kJSStoreProperty:
return ReduceJSStoreProperty(node);
+ case IrOpcode::kJSLoadContext:
+ return ReduceJSLoadContext(node);
+ case IrOpcode::kJSStoreContext:
+ return ReduceJSStoreContext(node);
case IrOpcode::kJSCallFunction:
return JSBuiltinReducer(jsgraph()).Reduce(node);
default:
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698