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

Side by Side Diff: src/builtins/builtins-number.cc

Issue 2451973003: [builtins] Don't canonicalize results of Math double operations. (Closed)
Patch Set: Same for the number builtins. Created 4 years, 1 month 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/builtins/builtins-math.cc ('k') | src/code-stub-assembler.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 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/builtins/builtins-utils.h" 5 #include "src/builtins/builtins-utils.h"
6 #include "src/builtins/builtins.h" 6 #include "src/builtins/builtins.h"
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 var_result.Bind(assembler->CallStub(callable, context, var_lhs.value(), 928 var_result.Bind(assembler->CallStub(callable, context, var_lhs.value(),
929 var_rhs.value())); 929 var_rhs.value()));
930 assembler->Goto(&end); 930 assembler->Goto(&end);
931 } 931 }
932 932
933 assembler->Bind(&do_fadd); 933 assembler->Bind(&do_fadd);
934 { 934 {
935 Node* lhs_value = var_fadd_lhs.value(); 935 Node* lhs_value = var_fadd_lhs.value();
936 Node* rhs_value = var_fadd_rhs.value(); 936 Node* rhs_value = var_fadd_rhs.value();
937 Node* value = assembler->Float64Add(lhs_value, rhs_value); 937 Node* value = assembler->Float64Add(lhs_value, rhs_value);
938 Node* result = assembler->ChangeFloat64ToTagged(value); 938 Node* result = assembler->AllocateHeapNumberWithValue(value);
939 var_result.Bind(result); 939 var_result.Bind(result);
940 assembler->Goto(&end); 940 assembler->Goto(&end);
941 } 941 }
942 assembler->Bind(&end); 942 assembler->Bind(&end);
943 assembler->Return(var_result.value()); 943 assembler->Return(var_result.value());
944 } 944 }
945 945
946 void Builtins::Generate_Subtract(CodeStubAssembler* assembler) { 946 void Builtins::Generate_Subtract(CodeStubAssembler* assembler) {
947 typedef CodeStubAssembler::Label Label; 947 typedef CodeStubAssembler::Label Label;
948 typedef compiler::Node Node; 948 typedef compiler::Node Node;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 assembler->Goto(&loop); 1107 assembler->Goto(&loop);
1108 } 1108 }
1109 } 1109 }
1110 } 1110 }
1111 1111
1112 assembler->Bind(&do_fsub); 1112 assembler->Bind(&do_fsub);
1113 { 1113 {
1114 Node* lhs_value = var_fsub_lhs.value(); 1114 Node* lhs_value = var_fsub_lhs.value();
1115 Node* rhs_value = var_fsub_rhs.value(); 1115 Node* rhs_value = var_fsub_rhs.value();
1116 Node* value = assembler->Float64Sub(lhs_value, rhs_value); 1116 Node* value = assembler->Float64Sub(lhs_value, rhs_value);
1117 var_result.Bind(assembler->ChangeFloat64ToTagged(value)); 1117 var_result.Bind(assembler->AllocateHeapNumberWithValue(value));
1118 assembler->Goto(&end); 1118 assembler->Goto(&end);
1119 } 1119 }
1120 assembler->Bind(&end); 1120 assembler->Bind(&end);
1121 assembler->Return(var_result.value()); 1121 assembler->Return(var_result.value());
1122 } 1122 }
1123 1123
1124 void Builtins::Generate_Multiply(CodeStubAssembler* assembler) { 1124 void Builtins::Generate_Multiply(CodeStubAssembler* assembler) {
1125 typedef CodeStubAssembler::Label Label; 1125 typedef CodeStubAssembler::Label Label;
1126 typedef compiler::Node Node; 1126 typedef compiler::Node Node;
1127 typedef CodeStubAssembler::Variable Variable; 1127 typedef CodeStubAssembler::Variable Variable;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 var_lhs.Bind(assembler->CallStub(callable, context, lhs)); 1259 var_lhs.Bind(assembler->CallStub(callable, context, lhs));
1260 assembler->Goto(&loop); 1260 assembler->Goto(&loop);
1261 } 1261 }
1262 } 1262 }
1263 } 1263 }
1264 1264
1265 assembler->Bind(&do_fmul); 1265 assembler->Bind(&do_fmul);
1266 { 1266 {
1267 Node* value = 1267 Node* value =
1268 assembler->Float64Mul(var_lhs_float64.value(), var_rhs_float64.value()); 1268 assembler->Float64Mul(var_lhs_float64.value(), var_rhs_float64.value());
1269 Node* result = assembler->ChangeFloat64ToTagged(value); 1269 Node* result = assembler->AllocateHeapNumberWithValue(value);
1270 var_result.Bind(result); 1270 var_result.Bind(result);
1271 assembler->Goto(&return_result); 1271 assembler->Goto(&return_result);
1272 } 1272 }
1273 1273
1274 assembler->Bind(&return_result); 1274 assembler->Bind(&return_result);
1275 assembler->Return(var_result.value()); 1275 assembler->Return(var_result.value());
1276 } 1276 }
1277 1277
1278 void Builtins::Generate_Divide(CodeStubAssembler* assembler) { 1278 void Builtins::Generate_Divide(CodeStubAssembler* assembler) {
1279 typedef CodeStubAssembler::Label Label; 1279 typedef CodeStubAssembler::Label Label;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 var_dividend.Bind(assembler->CallStub(callable, context, dividend)); 1479 var_dividend.Bind(assembler->CallStub(callable, context, dividend));
1480 assembler->Goto(&loop); 1480 assembler->Goto(&loop);
1481 } 1481 }
1482 } 1482 }
1483 } 1483 }
1484 1484
1485 assembler->Bind(&do_fdiv); 1485 assembler->Bind(&do_fdiv);
1486 { 1486 {
1487 Node* value = assembler->Float64Div(var_dividend_float64.value(), 1487 Node* value = assembler->Float64Div(var_dividend_float64.value(),
1488 var_divisor_float64.value()); 1488 var_divisor_float64.value());
1489 var_result.Bind(assembler->ChangeFloat64ToTagged(value)); 1489 var_result.Bind(assembler->AllocateHeapNumberWithValue(value));
1490 assembler->Goto(&end); 1490 assembler->Goto(&end);
1491 } 1491 }
1492 assembler->Bind(&end); 1492 assembler->Bind(&end);
1493 assembler->Return(var_result.value()); 1493 assembler->Return(var_result.value());
1494 } 1494 }
1495 1495
1496 void Builtins::Generate_Modulus(CodeStubAssembler* assembler) { 1496 void Builtins::Generate_Modulus(CodeStubAssembler* assembler) {
1497 typedef CodeStubAssembler::Label Label; 1497 typedef CodeStubAssembler::Label Label;
1498 typedef compiler::Node Node; 1498 typedef compiler::Node Node;
1499 typedef CodeStubAssembler::Variable Variable; 1499 typedef CodeStubAssembler::Variable Variable;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 var_dividend.Bind(assembler->CallStub(callable, context, dividend)); 1637 var_dividend.Bind(assembler->CallStub(callable, context, dividend));
1638 assembler->Goto(&loop); 1638 assembler->Goto(&loop);
1639 } 1639 }
1640 } 1640 }
1641 } 1641 }
1642 1642
1643 assembler->Bind(&do_fmod); 1643 assembler->Bind(&do_fmod);
1644 { 1644 {
1645 Node* value = assembler->Float64Mod(var_dividend_float64.value(), 1645 Node* value = assembler->Float64Mod(var_dividend_float64.value(),
1646 var_divisor_float64.value()); 1646 var_divisor_float64.value());
1647 var_result.Bind(assembler->ChangeFloat64ToTagged(value)); 1647 var_result.Bind(assembler->AllocateHeapNumberWithValue(value));
1648 assembler->Goto(&return_result); 1648 assembler->Goto(&return_result);
1649 } 1649 }
1650 1650
1651 assembler->Bind(&return_result); 1651 assembler->Bind(&return_result);
1652 assembler->Return(var_result.value()); 1652 assembler->Return(var_result.value());
1653 } 1653 }
1654 1654
1655 void Builtins::Generate_ShiftLeft(CodeStubAssembler* assembler) { 1655 void Builtins::Generate_ShiftLeft(CodeStubAssembler* assembler) {
1656 compiler::Node* left = assembler->Parameter(0); 1656 compiler::Node* left = assembler->Parameter(0);
1657 compiler::Node* right = assembler->Parameter(1); 1657 compiler::Node* right = assembler->Parameter(1);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 compiler::Node* lhs = assembler->Parameter(0); 1809 compiler::Node* lhs = assembler->Parameter(0);
1810 compiler::Node* rhs = assembler->Parameter(1); 1810 compiler::Node* rhs = assembler->Parameter(1);
1811 compiler::Node* context = assembler->Parameter(2); 1811 compiler::Node* context = assembler->Parameter(2);
1812 1812
1813 assembler->Return(assembler->StrictEqual(CodeStubAssembler::kNegateResult, 1813 assembler->Return(assembler->StrictEqual(CodeStubAssembler::kNegateResult,
1814 lhs, rhs, context)); 1814 lhs, rhs, context));
1815 } 1815 }
1816 1816
1817 } // namespace internal 1817 } // namespace internal
1818 } // namespace v8 1818 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-math.cc ('k') | src/code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698