OLD | NEW |
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.h" | 5 #include "src/builtins/builtins.h" |
6 #include "src/builtins/builtins-utils.h" | 6 #include "src/builtins/builtins-utils.h" |
7 | 7 |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/uri.h" | 10 #include "src/uri.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 { | 120 { |
121 // Load the current {num} value. | 121 // Load the current {num} value. |
122 Node* num = var_num.value(); | 122 Node* num = var_num.value(); |
123 | 123 |
124 // Check if {num} is a Smi or a HeapObject. | 124 // Check if {num} is a Smi or a HeapObject. |
125 assembler.GotoIf(assembler.TaggedIsSmi(num), &return_true); | 125 assembler.GotoIf(assembler.TaggedIsSmi(num), &return_true); |
126 | 126 |
127 // Check if {num} is a HeapNumber. | 127 // Check if {num} is a HeapNumber. |
128 Label if_numisheapnumber(&assembler), | 128 Label if_numisheapnumber(&assembler), |
129 if_numisnotheapnumber(&assembler, Label::kDeferred); | 129 if_numisnotheapnumber(&assembler, Label::kDeferred); |
130 assembler.Branch(assembler.WordEqual(assembler.LoadMap(num), | 130 assembler.Branch(assembler.IsHeapNumberMap(assembler.LoadMap(num)), |
131 assembler.HeapNumberMapConstant()), | |
132 &if_numisheapnumber, &if_numisnotheapnumber); | 131 &if_numisheapnumber, &if_numisnotheapnumber); |
133 | 132 |
134 assembler.Bind(&if_numisheapnumber); | 133 assembler.Bind(&if_numisheapnumber); |
135 { | 134 { |
136 // Check if {num} contains a finite, non-NaN value. | 135 // Check if {num} contains a finite, non-NaN value. |
137 Node* num_value = assembler.LoadHeapNumberValue(num); | 136 Node* num_value = assembler.LoadHeapNumberValue(num); |
138 assembler.BranchIfFloat64IsNaN(assembler.Float64Sub(num_value, num_value), | 137 assembler.BranchIfFloat64IsNaN(assembler.Float64Sub(num_value, num_value), |
139 &return_false, &return_true); | 138 &return_false, &return_true); |
140 } | 139 } |
141 | 140 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 { | 174 { |
176 // Load the current {num} value. | 175 // Load the current {num} value. |
177 Node* num = var_num.value(); | 176 Node* num = var_num.value(); |
178 | 177 |
179 // Check if {num} is a Smi or a HeapObject. | 178 // Check if {num} is a Smi or a HeapObject. |
180 assembler.GotoIf(assembler.TaggedIsSmi(num), &return_false); | 179 assembler.GotoIf(assembler.TaggedIsSmi(num), &return_false); |
181 | 180 |
182 // Check if {num} is a HeapNumber. | 181 // Check if {num} is a HeapNumber. |
183 Label if_numisheapnumber(&assembler), | 182 Label if_numisheapnumber(&assembler), |
184 if_numisnotheapnumber(&assembler, Label::kDeferred); | 183 if_numisnotheapnumber(&assembler, Label::kDeferred); |
185 assembler.Branch(assembler.WordEqual(assembler.LoadMap(num), | 184 assembler.Branch(assembler.IsHeapNumberMap(assembler.LoadMap(num)), |
186 assembler.HeapNumberMapConstant()), | |
187 &if_numisheapnumber, &if_numisnotheapnumber); | 185 &if_numisheapnumber, &if_numisnotheapnumber); |
188 | 186 |
189 assembler.Bind(&if_numisheapnumber); | 187 assembler.Bind(&if_numisheapnumber); |
190 { | 188 { |
191 // Check if {num} contains a NaN. | 189 // Check if {num} contains a NaN. |
192 Node* num_value = assembler.LoadHeapNumberValue(num); | 190 Node* num_value = assembler.LoadHeapNumberValue(num); |
193 assembler.BranchIfFloat64IsNaN(num_value, &return_true, &return_false); | 191 assembler.BranchIfFloat64IsNaN(num_value, &return_true, &return_false); |
194 } | 192 } |
195 | 193 |
196 assembler.Bind(&if_numisnotheapnumber); | 194 assembler.Bind(&if_numisnotheapnumber); |
197 { | 195 { |
198 // Need to convert {num} to a Number first. | 196 // Need to convert {num} to a Number first. |
199 Callable callable = CodeFactory::NonNumberToNumber(assembler.isolate()); | 197 Callable callable = CodeFactory::NonNumberToNumber(assembler.isolate()); |
200 var_num.Bind(assembler.CallStub(callable, context, num)); | 198 var_num.Bind(assembler.CallStub(callable, context, num)); |
201 assembler.Goto(&loop); | 199 assembler.Goto(&loop); |
202 } | 200 } |
203 } | 201 } |
204 | 202 |
205 assembler.Bind(&return_true); | 203 assembler.Bind(&return_true); |
206 assembler.Return(assembler.BooleanConstant(true)); | 204 assembler.Return(assembler.BooleanConstant(true)); |
207 | 205 |
208 assembler.Bind(&return_false); | 206 assembler.Bind(&return_false); |
209 assembler.Return(assembler.BooleanConstant(false)); | 207 assembler.Return(assembler.BooleanConstant(false)); |
210 } | 208 } |
211 | 209 |
212 } // namespace internal | 210 } // namespace internal |
213 } // namespace v8 | 211 } // namespace v8 |
OLD | NEW |