OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/code-stub-assembler.h" | 5 #include "src/code-stub-assembler.h" |
6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 | 10 |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 Callable callable = CodeFactory::NonNumberToNumber(isolate()); | 719 Callable callable = CodeFactory::NonNumberToNumber(isolate()); |
720 var_value.Bind(CallStub(callable, context, value)); | 720 var_value.Bind(CallStub(callable, context, value)); |
721 Goto(&loop); | 721 Goto(&loop); |
722 } | 722 } |
723 } | 723 } |
724 } | 724 } |
725 Bind(&done_loop); | 725 Bind(&done_loop); |
726 return var_result.value(); | 726 return var_result.value(); |
727 } | 727 } |
728 | 728 |
729 Node* CodeStubAssembler::TruncateFloat64ToInt32(Node* value) { | |
730 return TruncateFloat64ToInt32JavaScript(value); | |
731 } | |
732 | |
733 Node* CodeStubAssembler::TruncateHeapNumberValueToWord32(Node* object) { | 729 Node* CodeStubAssembler::TruncateHeapNumberValueToWord32(Node* object) { |
734 Node* value = LoadHeapNumberValue(object); | 730 Node* value = LoadHeapNumberValue(object); |
735 return TruncateFloat64ToInt32(value); | 731 return TruncateFloat64ToWord32(value); |
736 } | 732 } |
737 | 733 |
738 Node* CodeStubAssembler::ChangeFloat64ToTagged(Node* value) { | 734 Node* CodeStubAssembler::ChangeFloat64ToTagged(Node* value) { |
739 Node* value32 = TruncateFloat64ToInt32RoundToZero(value); | 735 Node* value32 = RoundFloat64ToInt32(value); |
740 Node* value64 = ChangeInt32ToFloat64(value32); | 736 Node* value64 = ChangeInt32ToFloat64(value32); |
741 | 737 |
742 Label if_valueisint32(this), if_valueisheapnumber(this), if_join(this); | 738 Label if_valueisint32(this), if_valueisheapnumber(this), if_join(this); |
743 | 739 |
744 Label if_valueisequal(this), if_valueisnotequal(this); | 740 Label if_valueisequal(this), if_valueisnotequal(this); |
745 Branch(Float64Equal(value, value64), &if_valueisequal, &if_valueisnotequal); | 741 Branch(Float64Equal(value, value64), &if_valueisequal, &if_valueisnotequal); |
746 Bind(&if_valueisequal); | 742 Bind(&if_valueisequal); |
747 { | 743 { |
748 Label if_valueiszero(this), if_valueisnotzero(this); | 744 GotoUnless(Word32Equal(value32, Int32Constant(0)), &if_valueisint32); |
749 Branch(Float64Equal(value, Float64Constant(0.0)), &if_valueiszero, | |
750 &if_valueisnotzero); | |
751 | |
752 Bind(&if_valueiszero); | |
753 BranchIfInt32LessThan(Float64ExtractHighWord32(value), Int32Constant(0), | 745 BranchIfInt32LessThan(Float64ExtractHighWord32(value), Int32Constant(0), |
754 &if_valueisheapnumber, &if_valueisint32); | 746 &if_valueisheapnumber, &if_valueisint32); |
755 | |
756 Bind(&if_valueisnotzero); | |
757 Goto(&if_valueisint32); | |
758 } | 747 } |
759 Bind(&if_valueisnotequal); | 748 Bind(&if_valueisnotequal); |
760 Goto(&if_valueisheapnumber); | 749 Goto(&if_valueisheapnumber); |
761 | 750 |
762 Variable var_result(this, MachineRepresentation::kTagged); | 751 Variable var_result(this, MachineRepresentation::kTagged); |
763 Bind(&if_valueisint32); | 752 Bind(&if_valueisint32); |
764 { | 753 { |
765 if (Is64()) { | 754 if (Is64()) { |
766 Node* result = SmiTag(ChangeInt32ToInt64(value32)); | 755 Node* result = SmiTag(ChangeInt32ToInt64(value32)); |
767 var_result.Bind(result); | 756 var_result.Bind(result); |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 } | 1134 } |
1146 | 1135 |
1147 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, | 1136 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, |
1148 uint32_t mask) { | 1137 uint32_t mask) { |
1149 return Word32Shr(Word32And(word32, Int32Constant(mask)), | 1138 return Word32Shr(Word32And(word32, Int32Constant(mask)), |
1150 Int32Constant(shift)); | 1139 Int32Constant(shift)); |
1151 } | 1140 } |
1152 | 1141 |
1153 } // namespace internal | 1142 } // namespace internal |
1154 } // namespace v8 | 1143 } // namespace v8 |
OLD | NEW |