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

Side by Side Diff: src/code-stubs.cc

Issue 2375863002: [stubs] Fix invalid IntPtrMul in DivideStub. (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 | « no previous file | 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after
1838 &bailout); 1838 &bailout);
1839 assembler->Goto(&divisor_is_not_minus_one); 1839 assembler->Goto(&divisor_is_not_minus_one);
1840 } 1840 }
1841 assembler->Bind(&divisor_is_not_minus_one); 1841 assembler->Bind(&divisor_is_not_minus_one);
1842 1842
1843 // TODO(epertoso): consider adding a machine instruction that returns 1843 // TODO(epertoso): consider adding a machine instruction that returns
1844 // both the result and the remainder. 1844 // both the result and the remainder.
1845 Node* untagged_result = 1845 Node* untagged_result =
1846 assembler->Int32Div(untagged_dividend, untagged_divisor); 1846 assembler->Int32Div(untagged_dividend, untagged_divisor);
1847 Node* truncated = 1847 Node* truncated =
1848 assembler->IntPtrMul(untagged_result, untagged_divisor); 1848 assembler->Int32Mul(untagged_result, untagged_divisor);
1849 // Do floating point division if the remainder is not 0. 1849 // Do floating point division if the remainder is not 0.
1850 assembler->GotoIf( 1850 assembler->GotoIf(
1851 assembler->Word32NotEqual(untagged_dividend, truncated), &bailout); 1851 assembler->Word32NotEqual(untagged_dividend, truncated), &bailout);
1852 var_result.Bind(assembler->SmiTag(untagged_result)); 1852 var_result.Bind(assembler->SmiTag(untagged_result));
1853 assembler->Goto(&end); 1853 assembler->Goto(&end);
1854 1854
1855 // Bailout: convert {dividend} and {divisor} to double and do double 1855 // Bailout: convert {dividend} and {divisor} to double and do double
1856 // division. 1856 // division.
1857 assembler->Bind(&bailout); 1857 assembler->Bind(&bailout);
1858 { 1858 {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 untagged_dividend, 2041 untagged_dividend,
2042 assembler->Int32Constant(kSmiValueSize == 32 ? kMinInt 2042 assembler->Int32Constant(kSmiValueSize == 32 ? kMinInt
2043 : (kMinInt >> 1))), 2043 : (kMinInt >> 1))),
2044 &bailout); 2044 &bailout);
2045 assembler->Goto(&divisor_is_not_minus_one); 2045 assembler->Goto(&divisor_is_not_minus_one);
2046 } 2046 }
2047 assembler->Bind(&divisor_is_not_minus_one); 2047 assembler->Bind(&divisor_is_not_minus_one);
2048 2048
2049 Node* untagged_result = 2049 Node* untagged_result =
2050 assembler->Int32Div(untagged_dividend, untagged_divisor); 2050 assembler->Int32Div(untagged_dividend, untagged_divisor);
2051 Node* truncated = assembler->IntPtrMul(untagged_result, untagged_divisor); 2051 Node* truncated = assembler->Int32Mul(untagged_result, untagged_divisor);
2052 // Do floating point division if the remainder is not 0. 2052 // Do floating point division if the remainder is not 0.
2053 assembler->GotoIf(assembler->Word32NotEqual(untagged_dividend, truncated), 2053 assembler->GotoIf(assembler->Word32NotEqual(untagged_dividend, truncated),
2054 &bailout); 2054 &bailout);
2055 var_type_feedback.Bind( 2055 var_type_feedback.Bind(
2056 assembler->Int32Constant(BinaryOperationFeedback::kSignedSmall)); 2056 assembler->Int32Constant(BinaryOperationFeedback::kSignedSmall));
2057 var_result.Bind(assembler->SmiTag(untagged_result)); 2057 var_result.Bind(assembler->SmiTag(untagged_result));
2058 assembler->Goto(&end); 2058 assembler->Goto(&end);
2059 2059
2060 // Bailout: convert {dividend} and {divisor} to double and do double 2060 // Bailout: convert {dividend} and {divisor} to double and do double
2061 // division. 2061 // division.
(...skipping 3835 matching lines...) Expand 10 before | Expand all | Expand 10 after
5897 5897
5898 if (type == MachineType::Pointer()) { 5898 if (type == MachineType::Pointer()) {
5899 return Representation::External(); 5899 return Representation::External();
5900 } 5900 }
5901 5901
5902 return Representation::Tagged(); 5902 return Representation::Tagged();
5903 } 5903 }
5904 5904
5905 } // namespace internal 5905 } // namespace internal
5906 } // namespace v8 5906 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698