OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 DCHECK(args.length() == 1); | 128 DCHECK(args.length() == 1); |
129 isolate->counters()->math_floor()->Increment(); | 129 isolate->counters()->math_floor()->Increment(); |
130 | 130 |
131 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 131 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
132 return *isolate->factory()->NewNumber(Floor(x)); | 132 return *isolate->factory()->NewNumber(Floor(x)); |
133 } | 133 } |
134 | 134 |
135 | 135 |
136 // Slow version of Math.pow. We check for fast paths for special cases. | 136 // Slow version of Math.pow. We check for fast paths for special cases. |
137 // Used if VFP3 is not available. | 137 // Used if VFP3 is not available. |
138 RUNTIME_FUNCTION(Runtime_MathPowSlow) { | 138 RUNTIME_FUNCTION(Runtime_MathPow) { |
139 HandleScope scope(isolate); | 139 HandleScope scope(isolate); |
140 DCHECK(args.length() == 2); | 140 DCHECK(args.length() == 2); |
141 isolate->counters()->math_pow()->Increment(); | 141 isolate->counters()->math_pow()->Increment(); |
142 | 142 |
143 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 143 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
144 | 144 |
145 // If the second argument is a smi, it is much faster to call the | 145 // If the second argument is a smi, it is much faster to call the |
146 // custom powi() function than the generic pow(). | 146 // custom powi() function than the generic pow(). |
147 if (args[1]->IsSmi()) { | 147 if (args[1]->IsSmi()) { |
148 int y = args.smi_at(1); | 148 int y = args.smi_at(1); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 RUNTIME_FUNCTION(Runtime_MathFround) { | 231 RUNTIME_FUNCTION(Runtime_MathFround) { |
232 HandleScope scope(isolate); | 232 HandleScope scope(isolate); |
233 DCHECK(args.length() == 1); | 233 DCHECK(args.length() == 1); |
234 | 234 |
235 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 235 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
236 float xf = DoubleToFloat32(x); | 236 float xf = DoubleToFloat32(x); |
237 return *isolate->factory()->NewNumber(xf); | 237 return *isolate->factory()->NewNumber(xf); |
238 } | 238 } |
239 | 239 |
240 | 240 |
241 RUNTIME_FUNCTION(Runtime_MathPow) { | |
242 SealHandleScope shs(isolate); | |
243 return __RT_impl_Runtime_MathPowSlow(args, isolate); | |
244 } | |
245 | |
246 | |
247 RUNTIME_FUNCTION(Runtime_IsMinusZero) { | 241 RUNTIME_FUNCTION(Runtime_IsMinusZero) { |
248 SealHandleScope shs(isolate); | 242 SealHandleScope shs(isolate); |
249 DCHECK(args.length() == 1); | 243 DCHECK(args.length() == 1); |
250 CONVERT_ARG_CHECKED(Object, obj, 0); | 244 CONVERT_ARG_CHECKED(Object, obj, 0); |
251 if (!obj->IsHeapNumber()) return isolate->heap()->false_value(); | 245 if (!obj->IsHeapNumber()) return isolate->heap()->false_value(); |
252 HeapNumber* number = HeapNumber::cast(obj); | 246 HeapNumber* number = HeapNumber::cast(obj); |
253 return isolate->heap()->ToBoolean(IsMinusZero(number->value())); | 247 return isolate->heap()->ToBoolean(IsMinusZero(number->value())); |
254 } | 248 } |
255 } // namespace internal | 249 } // namespace internal |
256 } // namespace v8 | 250 } // namespace v8 |
OLD | NEW |