Chromium Code Reviews| 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 549 simplified()->LoadField(AccessBuilder::ForExternalArrayPointer()), | 549 simplified()->LoadField(AccessBuilder::ForExternalArrayPointer()), |
| 550 elements, NodeProperties::GetEffectInput(node)); | 550 elements, NodeProperties::GetEffectInput(node)); |
| 551 element_access = AccessBuilder::ForTypedArrayElement(type, true); | 551 element_access = AccessBuilder::ForTypedArrayElement(type, true); |
| 552 } else { | 552 } else { |
| 553 DCHECK(IsFixedTypedArrayElementsKind(elements_kind)); | 553 DCHECK(IsFixedTypedArrayElementsKind(elements_kind)); |
| 554 element_access = AccessBuilder::ForTypedArrayElement(type, false); | 554 element_access = AccessBuilder::ForTypedArrayElement(type, false); |
| 555 } | 555 } |
| 556 Node* value = | 556 Node* value = |
| 557 graph()->NewNode(simplified()->LoadElement(element_access), elements, | 557 graph()->NewNode(simplified()->LoadElement(element_access), elements, |
| 558 key, NodeProperties::GetEffectInput(node)); | 558 key, NodeProperties::GetEffectInput(node)); |
| 559 // TODO(titzer): Remove this hack once float32 is properly supported in | |
| 560 // simplified lowering. | |
| 561 if (element_access.machine_type == kRepFloat32) { | |
|
titzer
2014/09/24 10:55:23
You can move this into simplified-lowering. A more
| |
| 562 Node* change = | |
| 563 graph()->NewNode(machine()->ChangeFloat32ToFloat64(), value); | |
| 564 NodeProperties::ReplaceWithValue(node, change, value); | |
| 565 return Changed(value); | |
| 566 } | |
| 559 return ReplaceEagerly(node, value); | 567 return ReplaceEagerly(node, value); |
| 560 } | 568 } |
| 561 return NoChange(); | 569 return NoChange(); |
| 562 } | 570 } |
| 563 | 571 |
| 564 | 572 |
| 565 Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) { | 573 Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) { |
| 566 Node* key = NodeProperties::GetValueInput(node, 1); | 574 Node* key = NodeProperties::GetValueInput(node, 1); |
| 567 Node* base = NodeProperties::GetValueInput(node, 0); | 575 Node* base = NodeProperties::GetValueInput(node, 0); |
| 568 Node* value = NodeProperties::GetValueInput(node, 2); | 576 Node* value = NodeProperties::GetValueInput(node, 2); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 592 DCHECK(IsFixedTypedArrayElementsKind(elements_kind)); | 600 DCHECK(IsFixedTypedArrayElementsKind(elements_kind)); |
| 593 element_access = AccessBuilder::ForTypedArrayElement(type, false); | 601 element_access = AccessBuilder::ForTypedArrayElement(type, false); |
| 594 } | 602 } |
| 595 | 603 |
| 596 Node* check = graph()->NewNode(machine()->Uint32LessThan(), key, | 604 Node* check = graph()->NewNode(machine()->Uint32LessThan(), key, |
| 597 jsgraph()->Uint32Constant(length)); | 605 jsgraph()->Uint32Constant(length)); |
| 598 Node* branch = graph()->NewNode(common()->Branch(), check, | 606 Node* branch = graph()->NewNode(common()->Branch(), check, |
| 599 NodeProperties::GetControlInput(node)); | 607 NodeProperties::GetControlInput(node)); |
| 600 | 608 |
| 601 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 609 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
| 610 // TODO(titzer): Remove this hack once float32 is properly supported in | |
| 611 // simplified lowering. | |
| 612 if (element_access.machine_type == kRepFloat32) { | |
| 613 value = graph()->NewNode(machine()->TruncateFloat64ToFloat32(), value); | |
| 614 } | |
| 602 Node* store = graph()->NewNode( | 615 Node* store = graph()->NewNode( |
| 603 simplified()->StoreElement(element_access), elements, key, value, | 616 simplified()->StoreElement(element_access), elements, key, value, |
| 604 NodeProperties::GetEffectInput(node), if_true); | 617 NodeProperties::GetEffectInput(node), if_true); |
| 605 | 618 |
| 606 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 619 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
| 607 | 620 |
| 608 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); | 621 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); |
| 609 Node* phi = graph()->NewNode(common()->EffectPhi(2), store, | 622 Node* phi = graph()->NewNode(common()->EffectPhi(2), store, |
| 610 NodeProperties::GetEffectInput(node), merge); | 623 NodeProperties::GetEffectInput(node), merge); |
| 611 | 624 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 697 return JSBuiltinReducer(jsgraph()).Reduce(node); | 710 return JSBuiltinReducer(jsgraph()).Reduce(node); |
| 698 default: | 711 default: |
| 699 break; | 712 break; |
| 700 } | 713 } |
| 701 return NoChange(); | 714 return NoChange(); |
| 702 } | 715 } |
| 703 | 716 |
| 704 } // namespace compiler | 717 } // namespace compiler |
| 705 } // namespace internal | 718 } // namespace internal |
| 706 } // namespace v8 | 719 } // namespace v8 |
| OLD | NEW |