OLD | NEW |
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/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
6 #include "src/compiler/graph-inl.h" | 6 #include "src/compiler/graph-inl.h" |
7 #include "src/compiler/js-builtin-reducer.h" | 7 #include "src/compiler/js-builtin-reducer.h" |
8 #include "src/compiler/js-typed-lowering.h" | 8 #include "src/compiler/js-typed-lowering.h" |
9 #include "src/compiler/node-aux-data-inl.h" | 9 #include "src/compiler/node-aux-data-inl.h" |
10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 NodeProperties::GetEffectInput(node)); | 590 NodeProperties::GetEffectInput(node)); |
591 if (IsExternalArrayElementsKind(elements_kind)) { | 591 if (IsExternalArrayElementsKind(elements_kind)) { |
592 elements = graph()->NewNode( | 592 elements = graph()->NewNode( |
593 simplified()->LoadField(AccessBuilder::ForExternalArrayPointer()), | 593 simplified()->LoadField(AccessBuilder::ForExternalArrayPointer()), |
594 elements, NodeProperties::GetEffectInput(node)); | 594 elements, NodeProperties::GetEffectInput(node)); |
595 element_access = AccessBuilder::ForTypedArrayElement(type, true); | 595 element_access = AccessBuilder::ForTypedArrayElement(type, true); |
596 } else { | 596 } else { |
597 DCHECK(IsFixedTypedArrayElementsKind(elements_kind)); | 597 DCHECK(IsFixedTypedArrayElementsKind(elements_kind)); |
598 element_access = AccessBuilder::ForTypedArrayElement(type, false); | 598 element_access = AccessBuilder::ForTypedArrayElement(type, false); |
599 } | 599 } |
600 | |
601 Node* check = graph()->NewNode(machine()->Uint32LessThan(), key, | |
602 jsgraph()->Uint32Constant(length)); | |
603 Node* branch = graph()->NewNode(common()->Branch(), check, | |
604 NodeProperties::GetControlInput(node)); | |
605 | |
606 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | |
607 | |
608 Node* store = | 600 Node* store = |
609 graph()->NewNode(simplified()->StoreElement(element_access), elements, | 601 graph()->NewNode(simplified()->StoreElement(element_access), elements, |
610 key, jsgraph()->Uint32Constant(length), value, | 602 key, jsgraph()->Uint32Constant(length), value, |
611 NodeProperties::GetEffectInput(node), if_true); | 603 NodeProperties::GetEffectInput(node), |
612 | 604 NodeProperties::GetControlInput(node)); |
613 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 605 return ReplaceEagerly(node, store); |
614 | |
615 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); | |
616 Node* phi = graph()->NewNode(common()->EffectPhi(2), store, | |
617 NodeProperties::GetEffectInput(node), merge); | |
618 | |
619 return ReplaceWith(phi); | |
620 } | 606 } |
621 return NoChange(); | 607 return NoChange(); |
622 } | 608 } |
623 | 609 |
624 | 610 |
625 static Reduction ReplaceWithReduction(Node* node, Reduction reduction) { | 611 static Reduction ReplaceWithReduction(Node* node, Reduction reduction) { |
626 if (reduction.Changed()) { | 612 if (reduction.Changed()) { |
627 NodeProperties::ReplaceWithValue(node, reduction.replacement()); | 613 NodeProperties::ReplaceWithValue(node, reduction.replacement()); |
628 return reduction; | 614 return reduction; |
629 } | 615 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 return JSBuiltinReducer(jsgraph()).Reduce(node); | 699 return JSBuiltinReducer(jsgraph()).Reduce(node); |
714 default: | 700 default: |
715 break; | 701 break; |
716 } | 702 } |
717 return NoChange(); | 703 return NoChange(); |
718 } | 704 } |
719 | 705 |
720 } // namespace compiler | 706 } // namespace compiler |
721 } // namespace internal | 707 } // namespace internal |
722 } // namespace v8 | 708 } // namespace v8 |
OLD | NEW |