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

Side by Side Diff: src/compiler/code-stub-assembler.cc

Issue 1881003002: [stubs] Introduce LeftShift, SignedRightShift and UnsignedRightShift stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update after rollback Created 4 years, 8 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/code-stub-assembler.h ('k') | src/interpreter/interpreter.cc » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/code-stub-assembler.h" 5 #include "src/compiler/code-stub-assembler.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 Bind(&if_notoverflow); 876 Bind(&if_notoverflow);
877 { 877 {
878 Node* result = Projection(0, pair); 878 Node* result = Projection(0, pair);
879 var_result.Bind(result); 879 var_result.Bind(result);
880 } 880 }
881 Goto(&if_join); 881 Goto(&if_join);
882 Bind(&if_join); 882 Bind(&if_join);
883 return var_result.value(); 883 return var_result.value();
884 } 884 }
885 885
886 Node* CodeStubAssembler::ChangeUint32ToTagged(Node* value) {
887 Label if_overflow(this, Label::kDeferred), if_not_overflow(this),
888 if_join(this);
889 Variable var_result(this, MachineRepresentation::kTagged);
890 // If {value} > 2^31 - 1, we need to store it in a HeapNumber.
891 Branch(Int32LessThan(value, Int32Constant(0)), &if_overflow,
892 &if_not_overflow);
893 Bind(&if_not_overflow);
894 {
895 if (raw_assembler_->machine()->Is64()) {
896 var_result.Bind(SmiTag(ChangeUint32ToUint64(value)));
897 } else {
898 // If tagging {value} results in an overflow, we need to use a HeapNumber
899 // to represent it.
900 Node* pair = Int32AddWithOverflow(value, value);
901 Node* overflow = Projection(1, pair);
902 GotoIf(overflow, &if_overflow);
903
904 Node* result = Projection(0, pair);
905 var_result.Bind(result);
906 }
907 }
908 Goto(&if_join);
909
910 Bind(&if_overflow);
911 {
912 Node* float64_value = ChangeUint32ToFloat64(value);
913 var_result.Bind(AllocateHeapNumberWithValue(float64_value));
914 }
915 Goto(&if_join);
916
917 Bind(&if_join);
918 return var_result.value();
919 }
920
886 Node* CodeStubAssembler::TruncateTaggedToFloat64(Node* context, Node* value) { 921 Node* CodeStubAssembler::TruncateTaggedToFloat64(Node* context, Node* value) {
887 // We might need to loop once due to ToNumber conversion. 922 // We might need to loop once due to ToNumber conversion.
888 Variable var_value(this, MachineRepresentation::kTagged), 923 Variable var_value(this, MachineRepresentation::kTagged),
889 var_result(this, MachineRepresentation::kFloat64); 924 var_result(this, MachineRepresentation::kFloat64);
890 Label loop(this, &var_value), done_loop(this, &var_result); 925 Label loop(this, &var_value), done_loop(this, &var_result);
891 var_value.Bind(value); 926 var_value.Bind(value);
892 Goto(&loop); 927 Goto(&loop);
893 Bind(&loop); 928 Bind(&loop);
894 { 929 {
895 // Load the current {value}. 930 // Load the current {value}.
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 } 1749 }
1715 } 1750 }
1716 } 1751 }
1717 1752
1718 bound_ = true; 1753 bound_ = true;
1719 } 1754 }
1720 1755
1721 } // namespace compiler 1756 } // namespace compiler
1722 } // namespace internal 1757 } // namespace internal
1723 } // namespace v8 1758 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/code-stub-assembler.h ('k') | src/interpreter/interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698