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

Side by Side Diff: src/compiler/load-elimination.cc

Issue 1158723005: [turbofan] Turn LoadElimination into an AdvancedReducer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « src/compiler/load-elimination.h ('k') | src/compiler/pipeline.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/compiler/load-elimination.h" 5 #include "src/compiler/load-elimination.h"
6 6
7 #include "src/compiler/node-properties.h" 7 #include "src/compiler/node-properties.h"
8 #include "src/compiler/simplified-operator.h" 8 #include "src/compiler/simplified-operator.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 18 matching lines...) Expand all
29 DCHECK_EQ(IrOpcode::kLoadField, node->opcode()); 29 DCHECK_EQ(IrOpcode::kLoadField, node->opcode());
30 FieldAccess const access = FieldAccessOf(node->op()); 30 FieldAccess const access = FieldAccessOf(node->op());
31 Node* const object = NodeProperties::GetValueInput(node, 0); 31 Node* const object = NodeProperties::GetValueInput(node, 0);
32 for (Node* effect = NodeProperties::GetEffectInput(node);; 32 for (Node* effect = NodeProperties::GetEffectInput(node);;
33 effect = NodeProperties::GetEffectInput(effect)) { 33 effect = NodeProperties::GetEffectInput(effect)) {
34 switch (effect->opcode()) { 34 switch (effect->opcode()) {
35 case IrOpcode::kLoadField: { 35 case IrOpcode::kLoadField: {
36 if (object == NodeProperties::GetValueInput(effect, 0) && 36 if (object == NodeProperties::GetValueInput(effect, 0) &&
37 access == FieldAccessOf(effect->op())) { 37 access == FieldAccessOf(effect->op())) {
38 Node* const value = effect; 38 Node* const value = effect;
39 NodeProperties::ReplaceWithValue(node, value); 39 ReplaceWithValue(node, value);
40 return Replace(value); 40 return Replace(value);
41 } 41 }
42 break; 42 break;
43 } 43 }
44 case IrOpcode::kStoreField: { 44 case IrOpcode::kStoreField: {
45 if (access == FieldAccessOf(effect->op())) { 45 if (access == FieldAccessOf(effect->op())) {
46 if (object == NodeProperties::GetValueInput(effect, 0)) { 46 if (object == NodeProperties::GetValueInput(effect, 0)) {
47 Node* const value = NodeProperties::GetValueInput(effect, 1); 47 Node* const value = NodeProperties::GetValueInput(effect, 1);
48 NodeProperties::ReplaceWithValue(node, value); 48 ReplaceWithValue(node, value);
49 return Replace(value); 49 return Replace(value);
50 } 50 }
51 // TODO(turbofan): Alias analysis to the rescue? 51 // TODO(turbofan): Alias analysis to the rescue?
52 return NoChange(); 52 return NoChange();
53 } 53 }
54 break; 54 break;
55 } 55 }
56 case IrOpcode::kStoreBuffer: 56 case IrOpcode::kStoreBuffer:
57 case IrOpcode::kStoreElement: { 57 case IrOpcode::kStoreElement: {
58 // These can never interfere with field loads. 58 // These can never interfere with field loads.
59 break; 59 break;
60 } 60 }
61 default: { 61 default: {
62 if (!effect->op()->HasProperty(Operator::kNoWrite) || 62 if (!effect->op()->HasProperty(Operator::kNoWrite) ||
63 effect->op()->EffectInputCount() != 1) { 63 effect->op()->EffectInputCount() != 1) {
64 return NoChange(); 64 return NoChange();
65 } 65 }
66 break; 66 break;
67 } 67 }
68 } 68 }
69 } 69 }
70 UNREACHABLE(); 70 UNREACHABLE();
71 return NoChange(); 71 return NoChange();
72 } 72 }
73 73
74 } // namespace compiler 74 } // namespace compiler
75 } // namespace internal 75 } // namespace internal
76 } // namespace v8 76 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/load-elimination.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698