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

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

Issue 2114613002: [intrinsics] Drop the now obsolete %_DoubleHi and %_DoubleLo intrinsics. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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/mjsunit/asm/double-hi.js » ('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"
11 #include "src/codegen.h" 11 #include "src/codegen.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 RUNTIME_FUNCTION(Runtime_DoubleHi) {
17 HandleScope scope(isolate);
18 DCHECK(args.length() == 1);
19 CONVERT_DOUBLE_ARG_CHECKED(x, 0);
20 uint64_t unsigned64 = double_to_uint64(x);
21 uint32_t unsigned32 = static_cast<uint32_t>(unsigned64 >> 32);
22 int32_t signed32 = bit_cast<int32_t, uint32_t>(unsigned32);
23 return *isolate->factory()->NewNumber(signed32);
24 }
25
26
27 RUNTIME_FUNCTION(Runtime_DoubleLo) {
28 HandleScope scope(isolate);
29 DCHECK(args.length() == 1);
30 CONVERT_DOUBLE_ARG_CHECKED(x, 0);
31 uint64_t unsigned64 = double_to_uint64(x);
32 uint32_t unsigned32 = static_cast<uint32_t>(unsigned64);
33 int32_t signed32 = bit_cast<int32_t, uint32_t>(unsigned32);
34 return *isolate->factory()->NewNumber(signed32);
35 }
36
37
38 RUNTIME_FUNCTION(Runtime_GenerateRandomNumbers) { 16 RUNTIME_FUNCTION(Runtime_GenerateRandomNumbers) {
39 HandleScope scope(isolate); 17 HandleScope scope(isolate);
40 DCHECK(args.length() == 1); 18 DCHECK(args.length() == 1);
41 if (isolate->serializer_enabled()) { 19 if (isolate->serializer_enabled()) {
42 // Random numbers in the snapshot are not really that random. And we cannot 20 // Random numbers in the snapshot are not really that random. And we cannot
43 // return a typed array as it cannot be serialized. To make calling 21 // return a typed array as it cannot be serialized. To make calling
44 // Math.random possible when creating a custom startup snapshot, we simply 22 // Math.random possible when creating a custom startup snapshot, we simply
45 // return a normal array with a single random number. 23 // return a normal array with a single random number.
46 Handle<HeapNumber> random_number = isolate->factory()->NewHeapNumber( 24 Handle<HeapNumber> random_number = isolate->factory()->NewHeapNumber(
47 isolate->random_number_generator()->NextDouble()); 25 isolate->random_number_generator()->NextDouble());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 base::RandomNumberGenerator::XorShift128(&state0, &state1); 63 base::RandomNumberGenerator::XorShift128(&state0, &state1);
86 array[i] = base::RandomNumberGenerator::ToDouble(state0, state1); 64 array[i] = base::RandomNumberGenerator::ToDouble(state0, state1);
87 } 65 }
88 // Persist current state. 66 // Persist current state.
89 array[kState0Offset] = uint64_to_double(state0); 67 array[kState0Offset] = uint64_to_double(state0);
90 array[kState1Offset] = uint64_to_double(state1); 68 array[kState1Offset] = uint64_to_double(state1);
91 return *typed_array; 69 return *typed_array;
92 } 70 }
93 } // namespace internal 71 } // namespace internal
94 } // namespace v8 72 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | test/mjsunit/asm/double-hi.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698