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

Side by Side Diff: src/runtime/runtime-maths.cc

Issue 1004083002: [turbofan] Use builtin inlining mechanism for Math.abs and Math.sqrt. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/runtime/runtime.h ('k') | src/x87/lithium-codegen-x87.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 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 return *number; 200 return *number;
201 } 201 }
202 202
203 if (sign && value >= -0.5) return isolate->heap()->minus_zero_value(); 203 if (sign && value >= -0.5) return isolate->heap()->minus_zero_value();
204 204
205 // Do not call NumberFromDouble() to avoid extra checks. 205 // Do not call NumberFromDouble() to avoid extra checks.
206 return *isolate->factory()->NewNumber(Floor(value + 0.5)); 206 return *isolate->factory()->NewNumber(Floor(value + 0.5));
207 } 207 }
208 208
209 209
210 RUNTIME_FUNCTION(Runtime_MathSqrtRT) { 210 RUNTIME_FUNCTION(Runtime_MathSqrt) {
211 HandleScope scope(isolate); 211 HandleScope scope(isolate);
212 DCHECK(args.length() == 1); 212 DCHECK(args.length() == 1);
213 isolate->counters()->math_sqrt()->Increment(); 213 isolate->counters()->math_sqrt()->Increment();
214 214
215 CONVERT_DOUBLE_ARG_CHECKED(x, 0); 215 CONVERT_DOUBLE_ARG_CHECKED(x, 0);
216 return *isolate->factory()->NewNumber(fast_sqrt(x)); 216 return *isolate->factory()->NewNumber(fast_sqrt(x));
217 } 217 }
218 218
219 219
220 RUNTIME_FUNCTION(Runtime_MathFround) { 220 RUNTIME_FUNCTION(Runtime_MathFround) {
(...skipping 15 matching lines...) Expand all
236 RUNTIME_FUNCTION(Runtime_IsMinusZero) { 236 RUNTIME_FUNCTION(Runtime_IsMinusZero) {
237 SealHandleScope shs(isolate); 237 SealHandleScope shs(isolate);
238 DCHECK(args.length() == 1); 238 DCHECK(args.length() == 1);
239 CONVERT_ARG_CHECKED(Object, obj, 0); 239 CONVERT_ARG_CHECKED(Object, obj, 0);
240 if (!obj->IsHeapNumber()) return isolate->heap()->false_value(); 240 if (!obj->IsHeapNumber()) return isolate->heap()->false_value();
241 HeapNumber* number = HeapNumber::cast(obj); 241 HeapNumber* number = HeapNumber::cast(obj);
242 return isolate->heap()->ToBoolean(IsMinusZero(number->value())); 242 return isolate->heap()->ToBoolean(IsMinusZero(number->value()));
243 } 243 }
244 } 244 }
245 } // namespace v8::internal 245 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/x87/lithium-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698