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

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

Issue 2108793003: [turbofan] Drop the obsolete TypeGuard operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@MathRandom
Patch Set: Created 4 years, 5 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/js-intrinsic-lowering.cc ('k') | src/compiler/opcodes.h » ('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/graph.h" 7 #include "src/compiler/graph.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 #include "src/compiler/simplified-operator.h" 9 #include "src/compiler/simplified-operator.h"
10 #include "src/types.h" 10 #include "src/types.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return Replace(value); 54 return Replace(value);
55 } 55 }
56 break; 56 break;
57 } 57 }
58 case IrOpcode::kStoreField: { 58 case IrOpcode::kStoreField: {
59 if (access == FieldAccessOf(effect->op())) { 59 if (access == FieldAccessOf(effect->op())) {
60 Node* value_input = NormalizeCheckTaggedPointer( 60 Node* value_input = NormalizeCheckTaggedPointer(
61 NodeProperties::GetValueInput(effect, 0)); 61 NodeProperties::GetValueInput(effect, 0));
62 if (object == value_input) { 62 if (object == value_input) {
63 Node* const value = NodeProperties::GetValueInput(effect, 1); 63 Node* const value = NodeProperties::GetValueInput(effect, 1);
64 Type* stored_value_type = NodeProperties::GetType(value); 64 Type* value_type = NodeProperties::GetType(value);
65 Type* load_type = NodeProperties::GetType(node); 65 Type* node_type = NodeProperties::GetType(node);
66 // Make sure the replacement's type is a subtype of the node's 66 // Make sure the replacement's type is a subtype of the node's
67 // type. Otherwise we could confuse optimizations that were 67 // type. Otherwise we could confuse optimizations that were
68 // based on the original type. 68 // based on the original type.
69 if (stored_value_type->Is(load_type)) { 69 if (value_type->Is(node_type)) {
70 ReplaceWithValue(node, value); 70 ReplaceWithValue(node, value);
71 return Replace(value); 71 return Replace(value);
72 } else { 72 } else {
73 Node* renamed = graph()->NewNode( 73 // This LoadField has stronger guarantees than the stored value
74 simplified()->TypeGuard(Type::Intersect( 74 // can give us, which suggests that we are probably in unreachable
75 stored_value_type, load_type, graph()->zone())), 75 // code, guarded by some Check, so don't bother trying to optimize
76 value, NodeProperties::GetControlInput(node)); 76 // this LoadField {node}.
77 ReplaceWithValue(node, renamed); 77 return NoChange();
78 return Replace(renamed);
79 } 78 }
80 } 79 }
81 // TODO(turbofan): Alias analysis to the rescue? 80 // TODO(turbofan): Alias analysis to the rescue?
82 return NoChange(); 81 return NoChange();
83 } 82 }
84 break; 83 break;
85 } 84 }
86 case IrOpcode::kBeginRegion: 85 case IrOpcode::kBeginRegion:
87 case IrOpcode::kStoreBuffer: 86 case IrOpcode::kStoreBuffer:
88 case IrOpcode::kStoreElement: { 87 case IrOpcode::kStoreElement: {
(...skipping 22 matching lines...) Expand all
111 } 110 }
112 } 111 }
113 } 112 }
114 UNREACHABLE(); 113 UNREACHABLE();
115 return NoChange(); 114 return NoChange();
116 } 115 }
117 116
118 } // namespace compiler 117 } // namespace compiler
119 } // namespace internal 118 } // namespace internal
120 } // namespace v8 119 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-intrinsic-lowering.cc ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698