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

Side by Side Diff: src/compiler/js-inlining.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-call-reducer.cc ('k') | src/compiler/node-properties.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/js-inlining.h" 5 #include "src/compiler/js-inlining.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/compilation-info.h" 8 #include "src/compilation-info.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/compiler/all-nodes.h" 10 #include "src/compiler/all-nodes.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 BailoutId(-1), OutputFrameStateCombine::Ignore(), state_info); 271 BailoutId(-1), OutputFrameStateCombine::Ignore(), state_info);
272 const Operator* op0 = common()->StateValues(0, SparseInputMask::Dense()); 272 const Operator* op0 = common()->StateValues(0, SparseInputMask::Dense());
273 Node* node0 = graph()->NewNode(op0); 273 Node* node0 = graph()->NewNode(op0);
274 return graph()->NewNode(op, node0, node0, node0, 274 return graph()->NewNode(op, node0, node0, node0,
275 jsgraph()->UndefinedConstant(), function, 275 jsgraph()->UndefinedConstant(), function,
276 frame_state); 276 frame_state);
277 } 277 }
278 278
279 namespace { 279 namespace {
280 280
281 // TODO(turbofan): Shall we move this to the NodeProperties? Or some (untyped)
282 // alias analyzer?
283 bool IsSame(Node* a, Node* b) {
284 if (a == b) {
285 return true;
286 } else if (a->opcode() == IrOpcode::kCheckHeapObject) {
287 return IsSame(a->InputAt(0), b);
288 } else if (b->opcode() == IrOpcode::kCheckHeapObject) {
289 return IsSame(a, b->InputAt(0));
290 }
291 return false;
292 }
293
294 // TODO(bmeurer): Unify this with the witness helper functions in the 281 // TODO(bmeurer): Unify this with the witness helper functions in the
295 // js-builtin-reducer.cc once we have a better understanding of the 282 // js-builtin-reducer.cc once we have a better understanding of the
296 // map tracking we want to do, and eventually changed the CheckMaps 283 // map tracking we want to do, and eventually changed the CheckMaps
297 // operator to carry map constants on the operator instead of inputs. 284 // operator to carry map constants on the operator instead of inputs.
298 // I.e. if the CheckMaps has some kind of SmallMapSet as operator 285 // I.e. if the CheckMaps has some kind of SmallMapSet as operator
299 // parameter, then this could be changed to call a generic 286 // parameter, then this could be changed to call a generic
300 // 287 //
301 // SmallMapSet NodeProperties::CollectMapWitness(receiver, effect) 288 // SmallMapSet NodeProperties::CollectMapWitness(receiver, effect)
302 // 289 //
303 // function, which either returns the map set from the CheckMaps or 290 // function, which either returns the map set from the CheckMaps or
304 // a singleton set from a StoreField. 291 // a singleton set from a StoreField.
305 bool NeedsConvertReceiver(Node* receiver, Node* effect) { 292 bool NeedsConvertReceiver(Node* receiver, Node* effect) {
306 for (Node* dominator = effect;;) { 293 for (Node* dominator = effect;;) {
307 if (dominator->opcode() == IrOpcode::kCheckMaps && 294 if (dominator->opcode() == IrOpcode::kCheckMaps &&
308 IsSame(dominator->InputAt(0), receiver)) { 295 NodeProperties::IsSame(dominator->InputAt(0), receiver)) {
309 // Check if all maps have the given {instance_type}. 296 // Check if all maps have the given {instance_type}.
310 ZoneHandleSet<Map> const& maps = 297 ZoneHandleSet<Map> const& maps =
311 CheckMapsParametersOf(dominator->op()).maps(); 298 CheckMapsParametersOf(dominator->op()).maps();
312 for (size_t i = 0; i < maps.size(); ++i) { 299 for (size_t i = 0; i < maps.size(); ++i) {
313 if (!maps[i]->IsJSReceiverMap()) return true; 300 if (!maps[i]->IsJSReceiverMap()) return true;
314 } 301 }
315 return false; 302 return false;
316 } 303 }
317 switch (dominator->opcode()) { 304 switch (dominator->opcode()) {
318 case IrOpcode::kStoreField: { 305 case IrOpcode::kStoreField: {
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 657
671 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); } 658 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); }
672 659
673 SimplifiedOperatorBuilder* JSInliner::simplified() const { 660 SimplifiedOperatorBuilder* JSInliner::simplified() const {
674 return jsgraph()->simplified(); 661 return jsgraph()->simplified();
675 } 662 }
676 663
677 } // namespace compiler 664 } // namespace compiler
678 } // namespace internal 665 } // namespace internal
679 } // namespace v8 666 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-call-reducer.cc ('k') | src/compiler/node-properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698