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

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

Issue 2426923002: [stubs] Removes the BranchIf.*() methods from CodeAssembler, changes their uses to Branch(). (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/builtins/builtins-array.cc ('k') | src/builtins/builtins-string.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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 assembler->HeapNumberMapConstant()), 61 assembler->HeapNumberMapConstant()),
62 &return_false); 62 &return_false);
63 63
64 // Load the actual value of {number}. 64 // Load the actual value of {number}.
65 Node* number_value = assembler->LoadHeapNumberValue(number); 65 Node* number_value = assembler->LoadHeapNumberValue(number);
66 66
67 // Truncate the value of {number} to an integer (or an infinity). 67 // Truncate the value of {number} to an integer (or an infinity).
68 Node* integer = assembler->Float64Trunc(number_value); 68 Node* integer = assembler->Float64Trunc(number_value);
69 69
70 // Check if {number}s value matches the integer (ruling out the infinities). 70 // Check if {number}s value matches the integer (ruling out the infinities).
71 assembler->BranchIfFloat64Equal(assembler->Float64Sub(number_value, integer), 71 assembler->Branch(
72 assembler->Float64Constant(0.0), &return_true, 72 assembler->Float64Equal(assembler->Float64Sub(number_value, integer),
73 &return_false); 73 assembler->Float64Constant(0.0)),
74 &return_true, &return_false);
74 75
75 assembler->Bind(&return_true); 76 assembler->Bind(&return_true);
76 assembler->Return(assembler->BooleanConstant(true)); 77 assembler->Return(assembler->BooleanConstant(true));
77 78
78 assembler->Bind(&return_false); 79 assembler->Bind(&return_false);
79 assembler->Return(assembler->BooleanConstant(false)); 80 assembler->Return(assembler->BooleanConstant(false));
80 } 81 }
81 82
82 // ES6 section 20.1.2.4 Number.isNaN ( number ) 83 // ES6 section 20.1.2.4 Number.isNaN ( number )
83 void Builtins::Generate_NumberIsNaN(CodeStubAssembler* assembler) { 84 void Builtins::Generate_NumberIsNaN(CodeStubAssembler* assembler) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // Truncate the value of {number} to an integer (or an infinity). 133 // Truncate the value of {number} to an integer (or an infinity).
133 Node* integer = assembler->Float64Trunc(number_value); 134 Node* integer = assembler->Float64Trunc(number_value);
134 135
135 // Check if {number}s value matches the integer (ruling out the infinities). 136 // Check if {number}s value matches the integer (ruling out the infinities).
136 assembler->GotoUnless( 137 assembler->GotoUnless(
137 assembler->Float64Equal(assembler->Float64Sub(number_value, integer), 138 assembler->Float64Equal(assembler->Float64Sub(number_value, integer),
138 assembler->Float64Constant(0.0)), 139 assembler->Float64Constant(0.0)),
139 &return_false); 140 &return_false);
140 141
141 // Check if the {integer} value is in safe integer range. 142 // Check if the {integer} value is in safe integer range.
142 assembler->BranchIfFloat64LessThanOrEqual( 143 assembler->Branch(assembler->Float64LessThanOrEqual(
143 assembler->Float64Abs(integer), 144 assembler->Float64Abs(integer),
144 assembler->Float64Constant(kMaxSafeInteger), &return_true, &return_false); 145 assembler->Float64Constant(kMaxSafeInteger)),
146 &return_true, &return_false);
145 147
146 assembler->Bind(&return_true); 148 assembler->Bind(&return_true);
147 assembler->Return(assembler->BooleanConstant(true)); 149 assembler->Return(assembler->BooleanConstant(true));
148 150
149 assembler->Bind(&return_false); 151 assembler->Bind(&return_false);
150 assembler->Return(assembler->BooleanConstant(false)); 152 assembler->Return(assembler->BooleanConstant(false));
151 } 153 }
152 154
153 // ES6 section 20.1.2.12 Number.parseFloat ( string ) 155 // ES6 section 20.1.2.12 Number.parseFloat ( string )
154 void Builtins::Generate_NumberParseFloat(CodeStubAssembler* assembler) { 156 void Builtins::Generate_NumberParseFloat(CodeStubAssembler* assembler) {
(...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 compiler::Node* lhs = assembler->Parameter(0); 1712 compiler::Node* lhs = assembler->Parameter(0);
1711 compiler::Node* rhs = assembler->Parameter(1); 1713 compiler::Node* rhs = assembler->Parameter(1);
1712 compiler::Node* context = assembler->Parameter(2); 1714 compiler::Node* context = assembler->Parameter(2);
1713 1715
1714 assembler->Return(assembler->StrictEqual(CodeStubAssembler::kNegateResult, 1716 assembler->Return(assembler->StrictEqual(CodeStubAssembler::kNegateResult,
1715 lhs, rhs, context)); 1717 lhs, rhs, context));
1716 } 1718 }
1717 1719
1718 } // namespace internal 1720 } // namespace internal
1719 } // namespace v8 1721 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-array.cc ('k') | src/builtins/builtins-string.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698