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

Side by Side Diff: src/compiler/js-call-reducer.cc

Issue 2635243002: [turbofan] Refactor IsSame into NodeProperties. (Closed)
Patch Set: Update. Created 3 years, 11 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-builtin-reducer.cc ('k') | src/compiler/js-inlining.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/js-call-reducer.h" 5 #include "src/compiler/js-call-reducer.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 node->ReplaceInput(3, frame_state); 216 node->ReplaceInput(3, frame_state);
217 node->ReplaceInput(4, effect); 217 node->ReplaceInput(4, effect);
218 node->ReplaceInput(5, control); 218 node->ReplaceInput(5, control);
219 node->TrimInputCount(6); 219 node->TrimInputCount(6);
220 NodeProperties::ChangeOp(node, javascript()->OrdinaryHasInstance()); 220 NodeProperties::ChangeOp(node, javascript()->OrdinaryHasInstance());
221 return Changed(node); 221 return Changed(node);
222 } 222 }
223 223
224 namespace { 224 namespace {
225 225
226 // TODO(turbofan): Shall we move this to the NodeProperties? Or some (untyped)
227 // alias analyzer?
228 bool IsSame(Node* a, Node* b) {
229 if (a == b) {
230 return true;
231 } else if (a->opcode() == IrOpcode::kCheckHeapObject) {
232 return IsSame(a->InputAt(0), b);
233 } else if (b->opcode() == IrOpcode::kCheckHeapObject) {
234 return IsSame(a, b->InputAt(0));
235 }
236 return false;
237 }
238
239 // TODO(turbofan): Share with similar functionality in JSInliningHeuristic 226 // TODO(turbofan): Share with similar functionality in JSInliningHeuristic
240 // and JSNativeContextSpecialization, i.e. move to NodeProperties helper?! 227 // and JSNativeContextSpecialization, i.e. move to NodeProperties helper?!
241 MaybeHandle<Map> InferReceiverMap(Node* node) { 228 MaybeHandle<Map> InferReceiverMap(Node* node) {
242 Node* receiver = NodeProperties::GetValueInput(node, 1); 229 Node* receiver = NodeProperties::GetValueInput(node, 1);
243 Node* effect = NodeProperties::GetEffectInput(node); 230 Node* effect = NodeProperties::GetEffectInput(node);
244 // Check if the {node} is dominated by a CheckMaps with a single map 231 // Check if the {node} is dominated by a CheckMaps with a single map
245 // for the {receiver}, and if so use that map for the lowering below. 232 // for the {receiver}, and if so use that map for the lowering below.
246 for (Node* dominator = effect;;) { 233 for (Node* dominator = effect;;) {
247 if (dominator->opcode() == IrOpcode::kCheckMaps && 234 if (dominator->opcode() == IrOpcode::kCheckMaps &&
248 IsSame(dominator->InputAt(0), receiver)) { 235 NodeProperties::IsSame(dominator->InputAt(0), receiver)) {
249 if (dominator->op()->ValueInputCount() == 2) { 236 if (dominator->op()->ValueInputCount() == 2) {
250 HeapObjectMatcher m(dominator->InputAt(1)); 237 HeapObjectMatcher m(dominator->InputAt(1));
251 if (m.HasValue()) return Handle<Map>::cast(m.Value()); 238 if (m.HasValue()) return Handle<Map>::cast(m.Value());
252 } 239 }
253 return MaybeHandle<Map>(); 240 return MaybeHandle<Map>();
254 } 241 }
255 if (dominator->op()->EffectInputCount() != 1) { 242 if (dominator->op()->EffectInputCount() != 1) {
256 // Didn't find any appropriate CheckMaps node. 243 // Didn't find any appropriate CheckMaps node.
257 return MaybeHandle<Map>(); 244 return MaybeHandle<Map>();
258 } 245 }
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 return jsgraph()->javascript(); 668 return jsgraph()->javascript();
682 } 669 }
683 670
684 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { 671 SimplifiedOperatorBuilder* JSCallReducer::simplified() const {
685 return jsgraph()->simplified(); 672 return jsgraph()->simplified();
686 } 673 }
687 674
688 } // namespace compiler 675 } // namespace compiler
689 } // namespace internal 676 } // namespace internal
690 } // namespace v8 677 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-builtin-reducer.cc ('k') | src/compiler/js-inlining.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698