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

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

Issue 2373253003: Revert of [stubs] Don't unconditionally canonicalize in ChangeFloat64ToTagged. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « src/code-stub-assembler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/frames-inl.h" 7 #include "src/frames-inl.h"
8 #include "src/frames.h" 8 #include "src/frames.h"
9 #include "src/ic/handler-configuration.h" 9 #include "src/ic/handler-configuration.h"
10 #include "src/ic/stub-cache.h" 10 #include "src/ic/stub-cache.h"
(...skipping 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 } 1863 }
1864 Bind(&done_loop); 1864 Bind(&done_loop);
1865 return var_result.value(); 1865 return var_result.value();
1866 } 1866 }
1867 1867
1868 Node* CodeStubAssembler::TruncateHeapNumberValueToWord32(Node* object) { 1868 Node* CodeStubAssembler::TruncateHeapNumberValueToWord32(Node* object) {
1869 Node* value = LoadHeapNumberValue(object); 1869 Node* value = LoadHeapNumberValue(object);
1870 return TruncateFloat64ToWord32(value); 1870 return TruncateFloat64ToWord32(value);
1871 } 1871 }
1872 1872
1873 Node* CodeStubAssembler::ChangeFloat64ToTagged(Node* value, 1873 Node* CodeStubAssembler::ChangeFloat64ToTagged(Node* value) {
1874 CanonicalizationMode mode) { 1874 Node* value32 = RoundFloat64ToInt32(value);
1875 switch (mode) { 1875 Node* value64 = ChangeInt32ToFloat64(value32);
1876 case CanonicalizationMode::kDontCanonicalize: {
1877 return AllocateHeapNumberWithValue(value);
1878 }
1879 case CanonicalizationMode::kCanonicalize: {
1880 Node* value32 = RoundFloat64ToInt32(value);
1881 Node* value64 = ChangeInt32ToFloat64(value32);
1882 1876
1883 Label if_valueisint32(this), if_valueisheapnumber(this), if_join(this); 1877 Label if_valueisint32(this), if_valueisheapnumber(this), if_join(this);
1884 1878
1885 Label if_valueisequal(this), if_valueisnotequal(this); 1879 Label if_valueisequal(this), if_valueisnotequal(this);
1886 Branch(Float64Equal(value, value64), &if_valueisequal, 1880 Branch(Float64Equal(value, value64), &if_valueisequal, &if_valueisnotequal);
1887 &if_valueisnotequal); 1881 Bind(&if_valueisequal);
1888 Bind(&if_valueisequal); 1882 {
1883 GotoUnless(Word32Equal(value32, Int32Constant(0)), &if_valueisint32);
1884 BranchIfInt32LessThan(Float64ExtractHighWord32(value), Int32Constant(0),
1885 &if_valueisheapnumber, &if_valueisint32);
1886 }
1887 Bind(&if_valueisnotequal);
1888 Goto(&if_valueisheapnumber);
1889
1890 Variable var_result(this, MachineRepresentation::kTagged);
1891 Bind(&if_valueisint32);
1892 {
1893 if (Is64()) {
1894 Node* result = SmiTag(ChangeInt32ToInt64(value32));
1895 var_result.Bind(result);
1896 Goto(&if_join);
1897 } else {
1898 Node* pair = Int32AddWithOverflow(value32, value32);
1899 Node* overflow = Projection(1, pair);
1900 Label if_overflow(this, Label::kDeferred), if_notoverflow(this);
1901 Branch(overflow, &if_overflow, &if_notoverflow);
1902 Bind(&if_overflow);
1903 Goto(&if_valueisheapnumber);
1904 Bind(&if_notoverflow);
1889 { 1905 {
1890 GotoUnless(Word32Equal(value32, Int32Constant(0)), &if_valueisint32); 1906 Node* result = Projection(0, pair);
1891 BranchIfInt32LessThan(Float64ExtractHighWord32(value), Int32Constant(0),
1892 &if_valueisheapnumber, &if_valueisint32);
1893 }
1894 Bind(&if_valueisnotequal);
1895 Goto(&if_valueisheapnumber);
1896
1897 Variable var_result(this, MachineRepresentation::kTagged);
1898 Bind(&if_valueisint32);
1899 {
1900 if (Is64()) {
1901 Node* result = SmiTag(ChangeInt32ToInt64(value32));
1902 var_result.Bind(result);
1903 Goto(&if_join);
1904 } else {
1905 Node* pair = Int32AddWithOverflow(value32, value32);
1906 Node* overflow = Projection(1, pair);
1907 Label if_overflow(this, Label::kDeferred), if_notoverflow(this);
1908 Branch(overflow, &if_overflow, &if_notoverflow);
1909 Bind(&if_overflow);
1910 Goto(&if_valueisheapnumber);
1911 Bind(&if_notoverflow);
1912 {
1913 Node* result = Projection(0, pair);
1914 var_result.Bind(result);
1915 Goto(&if_join);
1916 }
1917 }
1918 }
1919 Bind(&if_valueisheapnumber);
1920 {
1921 Node* result = AllocateHeapNumberWithValue(value);
1922 var_result.Bind(result); 1907 var_result.Bind(result);
1923 Goto(&if_join); 1908 Goto(&if_join);
1924 } 1909 }
1925 Bind(&if_join);
1926 return var_result.value();
1927 } 1910 }
1928 } 1911 }
1929 UNREACHABLE(); 1912 Bind(&if_valueisheapnumber);
1930 return nullptr; 1913 {
1914 Node* result = AllocateHeapNumberWithValue(value);
1915 var_result.Bind(result);
1916 Goto(&if_join);
1917 }
1918 Bind(&if_join);
1919 return var_result.value();
1931 } 1920 }
1932 1921
1933 Node* CodeStubAssembler::ChangeInt32ToTagged(Node* value) { 1922 Node* CodeStubAssembler::ChangeInt32ToTagged(Node* value) {
1934 if (Is64()) { 1923 if (Is64()) {
1935 return SmiTag(ChangeInt32ToInt64(value)); 1924 return SmiTag(ChangeInt32ToInt64(value));
1936 } 1925 }
1937 Variable var_result(this, MachineRepresentation::kTagged); 1926 Variable var_result(this, MachineRepresentation::kTagged);
1938 Node* pair = Int32AddWithOverflow(value, value); 1927 Node* pair = Int32AddWithOverflow(value, value);
1939 Node* overflow = Projection(1, pair); 1928 Node* overflow = Projection(1, pair);
1940 Label if_overflow(this, Label::kDeferred), if_notoverflow(this), 1929 Label if_overflow(this, Label::kDeferred), if_notoverflow(this),
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
2636 { 2625 {
2637 // Load the floating-point value of {arg}. 2626 // Load the floating-point value of {arg}.
2638 Node* arg_value = LoadHeapNumberValue(arg); 2627 Node* arg_value = LoadHeapNumberValue(arg);
2639 2628
2640 // Check if {arg} is NaN. 2629 // Check if {arg} is NaN.
2641 GotoUnless(Float64Equal(arg_value, arg_value), &return_zero); 2630 GotoUnless(Float64Equal(arg_value, arg_value), &return_zero);
2642 2631
2643 // Truncate {arg} towards zero. 2632 // Truncate {arg} towards zero.
2644 Node* value = Float64Trunc(arg_value); 2633 Node* value = Float64Trunc(arg_value);
2645 2634
2646 // Perform optional minus zero truncation. 2635 if (mode == kTruncateMinusZero) {
2647 switch (mode) { 2636 // Truncate -0.0 to 0.
2648 case kNoTruncation: 2637 GotoIf(Float64Equal(value, Float64Constant(0.0)), &return_zero);
2649 break;
2650 case kTruncateMinusZero: {
2651 // Truncate -0.0 to 0.
2652 GotoIf(Float64Equal(value, Float64Constant(0.0)), &return_zero);
2653 break;
2654 }
2655 } 2638 }
2656 2639
2657 // Tag the {value} using Smi canonicalization, i.e. if {value} can be 2640 var_arg.Bind(ChangeFloat64ToTagged(value));
2658 // represented as a Smi, then this will produce a Smi.
2659 var_arg.Bind(
2660 ChangeFloat64ToTagged(value, CanonicalizationMode::kCanonicalize));
2661 Goto(&out); 2641 Goto(&out);
2662 } 2642 }
2663 2643
2664 Bind(&if_argisnotheapnumber); 2644 Bind(&if_argisnotheapnumber);
2665 { 2645 {
2666 // Need to convert {arg} to a Number first. 2646 // Need to convert {arg} to a Number first.
2667 Callable callable = CodeFactory::NonNumberToNumber(isolate()); 2647 Callable callable = CodeFactory::NonNumberToNumber(isolate());
2668 var_arg.Bind(CallStub(callable, context, arg)); 2648 var_arg.Bind(CallStub(callable, context, arg));
2669 Goto(&loop); 2649 Goto(&loop);
2670 } 2650 }
(...skipping 2657 matching lines...) Expand 10 before | Expand all | Expand 10 after
5328 Heap::kTheHoleValueRootIndex); 5308 Heap::kTheHoleValueRootIndex);
5329 5309
5330 // Store the WeakCell in the feedback vector. 5310 // Store the WeakCell in the feedback vector.
5331 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, 5311 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER,
5332 CodeStubAssembler::SMI_PARAMETERS); 5312 CodeStubAssembler::SMI_PARAMETERS);
5333 return cell; 5313 return cell;
5334 } 5314 }
5335 5315
5336 } // namespace internal 5316 } // namespace internal
5337 } // namespace v8 5317 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stub-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698