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

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 598963002: Add support for Float32 representation changes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/js-graph.cc ('k') | src/compiler/representation-change.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/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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 elements, NodeProperties::GetEffectInput(node)); 552 elements, NodeProperties::GetEffectInput(node));
553 element_access = AccessBuilder::ForTypedArrayElement(type, true); 553 element_access = AccessBuilder::ForTypedArrayElement(type, true);
554 } else { 554 } else {
555 DCHECK(IsFixedTypedArrayElementsKind(elements_kind)); 555 DCHECK(IsFixedTypedArrayElementsKind(elements_kind));
556 element_access = AccessBuilder::ForTypedArrayElement(type, false); 556 element_access = AccessBuilder::ForTypedArrayElement(type, false);
557 } 557 }
558 Node* value = 558 Node* value =
559 graph()->NewNode(simplified()->LoadElement(element_access), elements, 559 graph()->NewNode(simplified()->LoadElement(element_access), elements,
560 key, jsgraph()->Uint32Constant(length), 560 key, jsgraph()->Uint32Constant(length),
561 NodeProperties::GetEffectInput(node)); 561 NodeProperties::GetEffectInput(node));
562 // TODO(titzer): Remove this hack once float32 is properly supported in
563 // simplified lowering.
564 if (element_access.machine_type == kRepFloat32) {
565 Node* change =
566 graph()->NewNode(machine()->ChangeFloat32ToFloat64(), value);
567 NodeProperties::ReplaceWithValue(node, change, value);
568 return Changed(value);
569 }
570 return ReplaceEagerly(node, value); 562 return ReplaceEagerly(node, value);
571 } 563 }
572 return NoChange(); 564 return NoChange();
573 } 565 }
574 566
575 567
576 Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) { 568 Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) {
577 Node* key = NodeProperties::GetValueInput(node, 1); 569 Node* key = NodeProperties::GetValueInput(node, 1);
578 Node* base = NodeProperties::GetValueInput(node, 0); 570 Node* base = NodeProperties::GetValueInput(node, 0);
579 Node* value = NodeProperties::GetValueInput(node, 2); 571 Node* value = NodeProperties::GetValueInput(node, 2);
(...skipping 23 matching lines...) Expand all
603 DCHECK(IsFixedTypedArrayElementsKind(elements_kind)); 595 DCHECK(IsFixedTypedArrayElementsKind(elements_kind));
604 element_access = AccessBuilder::ForTypedArrayElement(type, false); 596 element_access = AccessBuilder::ForTypedArrayElement(type, false);
605 } 597 }
606 598
607 Node* check = graph()->NewNode(machine()->Uint32LessThan(), key, 599 Node* check = graph()->NewNode(machine()->Uint32LessThan(), key,
608 jsgraph()->Uint32Constant(length)); 600 jsgraph()->Uint32Constant(length));
609 Node* branch = graph()->NewNode(common()->Branch(), check, 601 Node* branch = graph()->NewNode(common()->Branch(), check,
610 NodeProperties::GetControlInput(node)); 602 NodeProperties::GetControlInput(node));
611 603
612 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 604 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
613 // TODO(titzer): Remove this hack once float32 is properly supported in 605
614 // simplified lowering.
615 if (element_access.machine_type == kRepFloat32) {
616 value = graph()->NewNode(machine()->TruncateFloat64ToFloat32(), value);
617 }
618 Node* store = 606 Node* store =
619 graph()->NewNode(simplified()->StoreElement(element_access), elements, 607 graph()->NewNode(simplified()->StoreElement(element_access), elements,
620 key, jsgraph()->Uint32Constant(length), value, 608 key, jsgraph()->Uint32Constant(length), value,
621 NodeProperties::GetEffectInput(node), if_true); 609 NodeProperties::GetEffectInput(node), if_true);
622 610
623 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 611 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
624 612
625 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); 613 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
626 Node* phi = graph()->NewNode(common()->EffectPhi(2), store, 614 Node* phi = graph()->NewNode(common()->EffectPhi(2), store,
627 NodeProperties::GetEffectInput(node), merge); 615 NodeProperties::GetEffectInput(node), merge);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 return JSBuiltinReducer(jsgraph()).Reduce(node); 702 return JSBuiltinReducer(jsgraph()).Reduce(node);
715 default: 703 default:
716 break; 704 break;
717 } 705 }
718 return NoChange(); 706 return NoChange();
719 } 707 }
720 708
721 } // namespace compiler 709 } // namespace compiler
722 } // namespace internal 710 } // namespace internal
723 } // namespace v8 711 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-graph.cc ('k') | src/compiler/representation-change.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698