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

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

Issue 1852553003: [builtins] Migrate Math.clz32 to a TurboFan builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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') | test/cctest/compiler/test-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 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.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/base/utils/random-number-generator.h" 9 #include "src/base/utils/random-number-generator.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 HandleScope scope(isolate); 101 HandleScope scope(isolate);
102 DCHECK(args.length() == 1); 102 DCHECK(args.length() == 1);
103 isolate->counters()->math_exp_runtime()->Increment(); 103 isolate->counters()->math_exp_runtime()->Increment();
104 104
105 CONVERT_DOUBLE_ARG_CHECKED(x, 0); 105 CONVERT_DOUBLE_ARG_CHECKED(x, 0);
106 lazily_initialize_fast_exp(isolate); 106 lazily_initialize_fast_exp(isolate);
107 return *isolate->factory()->NewNumber(fast_exp(x, isolate)); 107 return *isolate->factory()->NewNumber(fast_exp(x, isolate));
108 } 108 }
109 109
110 110
111 RUNTIME_FUNCTION(Runtime_MathClz32) {
112 HandleScope scope(isolate);
113 DCHECK(args.length() == 1);
114 isolate->counters()->math_clz32_runtime()->Increment();
115
116 CONVERT_NUMBER_CHECKED(uint32_t, x, Uint32, args[0]);
117 return *isolate->factory()->NewNumberFromUint(
118 base::bits::CountLeadingZeros32(x));
119 }
120
121
122 // Slow version of Math.pow. We check for fast paths for special cases. 111 // Slow version of Math.pow. We check for fast paths for special cases.
123 // Used if VFP3 is not available. 112 // Used if VFP3 is not available.
124 RUNTIME_FUNCTION(Runtime_MathPow) { 113 RUNTIME_FUNCTION(Runtime_MathPow) {
125 HandleScope scope(isolate); 114 HandleScope scope(isolate);
126 DCHECK(args.length() == 2); 115 DCHECK(args.length() == 2);
127 isolate->counters()->math_pow_runtime()->Increment(); 116 isolate->counters()->math_pow_runtime()->Increment();
128 117
129 CONVERT_DOUBLE_ARG_CHECKED(x, 0); 118 CONVERT_DOUBLE_ARG_CHECKED(x, 0);
130 119
131 // If the second argument is a smi, it is much faster to call the 120 // If the second argument is a smi, it is much faster to call the
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 base::RandomNumberGenerator::XorShift128(&state0, &state1); 200 base::RandomNumberGenerator::XorShift128(&state0, &state1);
212 array[i] = base::RandomNumberGenerator::ToDouble(state0, state1); 201 array[i] = base::RandomNumberGenerator::ToDouble(state0, state1);
213 } 202 }
214 // Persist current state. 203 // Persist current state.
215 array[kState0Offset] = uint64_to_double(state0); 204 array[kState0Offset] = uint64_to_double(state0);
216 array[kState1Offset] = uint64_to_double(state1); 205 array[kState1Offset] = uint64_to_double(state1);
217 return *typed_array; 206 return *typed_array;
218 } 207 }
219 } // namespace internal 208 } // namespace internal
220 } // namespace v8 209 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | test/cctest/compiler/test-code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698