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

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

Issue 2789713003: [turbofan] load elimination looks through TypeGuards (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 #include "src/compiler/simplified-operator.h" 10 #include "src/compiler/simplified-operator.h"
11 #include "src/factory.h" 11 #include "src/factory.h"
12 #include "src/objects-inl.h" 12 #include "src/objects-inl.h"
13 13
14 namespace v8 { 14 namespace v8 {
15 namespace internal { 15 namespace internal {
16 namespace compiler { 16 namespace compiler {
17 17
18 namespace { 18 namespace {
19 19
20 enum Aliasing { kNoAlias, kMayAlias, kMustAlias }; 20 enum Aliasing { kNoAlias, kMayAlias, kMustAlias };
21 21
22 Node* Normalize(Node* node) {
Benedikt Meurer 2017/03/31 12:48:36 Just do it like FinishRegion below please.
23 while (node->opcode() == IrOpcode::kTypeGuard) {
24 node = node->InputAt(0);
25 }
26 return node;
27 }
28
22 Aliasing QueryAlias(Node* a, Node* b) { 29 Aliasing QueryAlias(Node* a, Node* b) {
30 a = Normalize(a);
31 b = Normalize(b);
23 if (a == b) return kMustAlias; 32 if (a == b) return kMustAlias;
24 if (!NodeProperties::GetType(a)->Maybe(NodeProperties::GetType(b))) { 33 if (!NodeProperties::GetType(a)->Maybe(NodeProperties::GetType(b))) {
25 return kNoAlias; 34 return kNoAlias;
26 } 35 }
27 switch (b->opcode()) { 36 switch (b->opcode()) {
28 case IrOpcode::kAllocate: { 37 case IrOpcode::kAllocate: {
29 switch (a->opcode()) { 38 switch (a->opcode()) {
30 case IrOpcode::kAllocate: 39 case IrOpcode::kAllocate:
31 case IrOpcode::kHeapConstant: 40 case IrOpcode::kHeapConstant:
32 case IrOpcode::kParameter: 41 case IrOpcode::kParameter:
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 return jsgraph()->common(); 1111 return jsgraph()->common();
1103 } 1112 }
1104 1113
1105 Graph* LoadElimination::graph() const { return jsgraph()->graph(); } 1114 Graph* LoadElimination::graph() const { return jsgraph()->graph(); }
1106 1115
1107 Factory* LoadElimination::factory() const { return jsgraph()->factory(); } 1116 Factory* LoadElimination::factory() const { return jsgraph()->factory(); }
1108 1117
1109 } // namespace compiler 1118 } // namespace compiler
1110 } // namespace internal 1119 } // namespace internal
1111 } // namespace v8 1120 } // namespace v8
OLDNEW
« 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