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

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 1479793003: [turbofan] Properly wire effects for JSLoadContext and JSStoreContext. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix unittests. Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/compilation-dependencies.h" 6 #include "src/compilation-dependencies.h"
7 #include "src/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 } 1212 }
1213 } 1213 }
1214 1214
1215 return NoChange(); 1215 return NoChange();
1216 } 1216 }
1217 1217
1218 1218
1219 Reduction JSTypedLowering::ReduceJSLoadContext(Node* node) { 1219 Reduction JSTypedLowering::ReduceJSLoadContext(Node* node) {
1220 DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode()); 1220 DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode());
1221 ContextAccess const& access = ContextAccessOf(node->op()); 1221 ContextAccess const& access = ContextAccessOf(node->op());
1222 Node* const effect = NodeProperties::GetEffectInput(node); 1222 Node* effect = NodeProperties::GetEffectInput(node);
1223 Node* const control = graph()->start(); 1223 Node* control = graph()->start();
1224 for (size_t i = 0; i < access.depth(); ++i) { 1224 for (size_t i = 0; i < access.depth(); ++i) {
1225 node->ReplaceInput( 1225 Node* previous = effect = graph()->NewNode(
1226 0, graph()->NewNode( 1226 simplified()->LoadField(
1227 simplified()->LoadField( 1227 AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)),
1228 AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)), 1228 NodeProperties::GetValueInput(node, 0), effect, control);
1229 NodeProperties::GetValueInput(node, 0), effect, control)); 1229 node->ReplaceInput(0, previous);
1230 } 1230 }
1231 node->ReplaceInput(1, effect); 1231 node->ReplaceInput(1, effect);
1232 node->ReplaceInput(2, control); 1232 node->ReplaceInput(2, control);
1233 NodeProperties::ChangeOp( 1233 NodeProperties::ChangeOp(
1234 node, 1234 node,
1235 simplified()->LoadField(AccessBuilder::ForContextSlot(access.index()))); 1235 simplified()->LoadField(AccessBuilder::ForContextSlot(access.index())));
1236 return Changed(node); 1236 return Changed(node);
1237 } 1237 }
1238 1238
1239 1239
1240 Reduction JSTypedLowering::ReduceJSStoreContext(Node* node) { 1240 Reduction JSTypedLowering::ReduceJSStoreContext(Node* node) {
1241 DCHECK_EQ(IrOpcode::kJSStoreContext, node->opcode()); 1241 DCHECK_EQ(IrOpcode::kJSStoreContext, node->opcode());
1242 ContextAccess const& access = ContextAccessOf(node->op()); 1242 ContextAccess const& access = ContextAccessOf(node->op());
1243 Node* const effect = NodeProperties::GetEffectInput(node); 1243 Node* effect = NodeProperties::GetEffectInput(node);
1244 Node* const control = graph()->start(); 1244 Node* control = graph()->start();
1245 for (size_t i = 0; i < access.depth(); ++i) { 1245 for (size_t i = 0; i < access.depth(); ++i) {
1246 node->ReplaceInput( 1246 Node* previous = effect = graph()->NewNode(
1247 0, graph()->NewNode( 1247 simplified()->LoadField(
1248 simplified()->LoadField( 1248 AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)),
1249 AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)), 1249 NodeProperties::GetValueInput(node, 0), effect, control);
1250 NodeProperties::GetValueInput(node, 0), effect, control)); 1250 node->ReplaceInput(0, previous);
1251 } 1251 }
1252 node->RemoveInput(2); 1252 node->RemoveInput(2);
1253 node->ReplaceInput(2, effect);
1253 NodeProperties::ChangeOp( 1254 NodeProperties::ChangeOp(
1254 node, 1255 node,
1255 simplified()->StoreField(AccessBuilder::ForContextSlot(access.index()))); 1256 simplified()->StoreField(AccessBuilder::ForContextSlot(access.index())));
1256 return Changed(node); 1257 return Changed(node);
1257 } 1258 }
1258 1259
1259 1260
1260 Reduction JSTypedLowering::ReduceJSLoadNativeContext(Node* node) { 1261 Reduction JSTypedLowering::ReduceJSLoadNativeContext(Node* node) {
1261 DCHECK_EQ(IrOpcode::kJSLoadNativeContext, node->opcode()); 1262 DCHECK_EQ(IrOpcode::kJSLoadNativeContext, node->opcode());
1262 Node* const effect = NodeProperties::GetEffectInput(node); 1263 Node* const effect = NodeProperties::GetEffectInput(node);
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
2598 } 2599 }
2599 2600
2600 2601
2601 CompilationDependencies* JSTypedLowering::dependencies() const { 2602 CompilationDependencies* JSTypedLowering::dependencies() const {
2602 return dependencies_; 2603 return dependencies_;
2603 } 2604 }
2604 2605
2605 } // namespace compiler 2606 } // namespace compiler
2606 } // namespace internal 2607 } // namespace internal
2607 } // namespace v8 2608 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698