OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/base/macros.h" | 8 #include "src/base/macros.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 DCHECK(args.length() == 4); \ | 26 DCHECK(args.length() == 4); \ |
27 CONVERT_NUMBER_ARG_HANDLE_CHECKED(w, 0); \ | 27 CONVERT_NUMBER_ARG_HANDLE_CHECKED(w, 0); \ |
28 CONVERT_NUMBER_ARG_HANDLE_CHECKED(x, 1); \ | 28 CONVERT_NUMBER_ARG_HANDLE_CHECKED(x, 1); \ |
29 CONVERT_NUMBER_ARG_HANDLE_CHECKED(y, 2); \ | 29 CONVERT_NUMBER_ARG_HANDLE_CHECKED(y, 2); \ |
30 CONVERT_NUMBER_ARG_HANDLE_CHECKED(z, 3); \ | 30 CONVERT_NUMBER_ARG_HANDLE_CHECKED(z, 3); \ |
31 return *isolate->factory()->NewFloat32x4( \ | 31 return *isolate->factory()->NewFloat32x4( \ |
32 NumberTo##type##Component(*w), NumberTo##type##Component(*x), \ | 32 NumberTo##type##Component(*w), NumberTo##type##Component(*x), \ |
33 NumberTo##type##Component(*y), NumberTo##type##Component(*z)); \ | 33 NumberTo##type##Component(*y), NumberTo##type##Component(*z)); \ |
34 } | 34 } |
35 | 35 |
36 #define SIMD_CREATE_WRAPPER_FUNCTION(type) \ | |
37 RUNTIME_FUNCTION(Runtime_New##type##Wrapper) { \ | |
38 HandleScope scope(isolate); \ | |
39 DCHECK(args.length() == 1); \ | |
40 CONVERT_ARG_HANDLE_CHECKED(type, value, 0); \ | |
41 return *Object::ToObject(isolate, value).ToHandleChecked(); \ | |
42 } | |
43 | |
44 #define SIMD_CHECK_FUNCTION(type) \ | 36 #define SIMD_CHECK_FUNCTION(type) \ |
45 RUNTIME_FUNCTION(Runtime_##type##Check) { \ | 37 RUNTIME_FUNCTION(Runtime_##type##Check) { \ |
46 HandleScope scope(isolate); \ | 38 HandleScope scope(isolate); \ |
47 CONVERT_ARG_HANDLE_CHECKED(type, a, 0); \ | 39 CONVERT_ARG_HANDLE_CHECKED(type, a, 0); \ |
48 return *a; \ | 40 return *a; \ |
49 } | 41 } |
50 | 42 |
51 #define SIMD_EXTRACT_LANE_FUNCTION(type, lanes) \ | 43 #define SIMD_EXTRACT_LANE_FUNCTION(type, lanes) \ |
52 RUNTIME_FUNCTION(Runtime_##type##ExtractLane) { \ | 44 RUNTIME_FUNCTION(Runtime_##type##ExtractLane) { \ |
53 HandleScope scope(isolate); \ | 45 HandleScope scope(isolate); \ |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 SameValueZero(a->get_lane(0), b->get_lane(0)) && \ | 86 SameValueZero(a->get_lane(0), b->get_lane(0)) && \ |
95 SameValueZero(a->get_lane(1), b->get_lane(1)) && \ | 87 SameValueZero(a->get_lane(1), b->get_lane(1)) && \ |
96 SameValueZero(a->get_lane(2), b->get_lane(2)) && \ | 88 SameValueZero(a->get_lane(2), b->get_lane(2)) && \ |
97 SameValueZero(a->get_lane(3), b->get_lane(3))); \ | 89 SameValueZero(a->get_lane(3), b->get_lane(3))); \ |
98 } | 90 } |
99 | 91 |
100 #define SIMD4_EXTRACT_LANE_FUNCTION(type) SIMD_EXTRACT_LANE_FUNCTION(type, 4) | 92 #define SIMD4_EXTRACT_LANE_FUNCTION(type) SIMD_EXTRACT_LANE_FUNCTION(type, 4) |
101 | 93 |
102 #define SIMD4_FUNCTIONS(type) \ | 94 #define SIMD4_FUNCTIONS(type) \ |
103 SIMD4_CREATE_FUNCTION(type) \ | 95 SIMD4_CREATE_FUNCTION(type) \ |
104 SIMD_CREATE_WRAPPER_FUNCTION(type) \ | |
105 SIMD_CHECK_FUNCTION(type) \ | 96 SIMD_CHECK_FUNCTION(type) \ |
106 SIMD4_EXTRACT_LANE_FUNCTION(type) \ | 97 SIMD4_EXTRACT_LANE_FUNCTION(type) \ |
107 SIMD4_EQUALS_FUNCTION(type) \ | 98 SIMD4_EQUALS_FUNCTION(type) \ |
108 SIMD4_SAME_VALUE_FUNCTION(type) \ | 99 SIMD4_SAME_VALUE_FUNCTION(type) \ |
109 SIMD4_SAME_VALUE_ZERO_FUNCTION(type) | 100 SIMD4_SAME_VALUE_ZERO_FUNCTION(type) |
110 | 101 |
111 | 102 |
112 namespace v8 { | 103 namespace v8 { |
113 namespace internal { | 104 namespace internal { |
114 | 105 |
115 namespace { | 106 namespace { |
116 | 107 |
117 // Convert from Number object to float. | 108 // Convert from Number object to float. |
118 inline float NumberToFloat(Object* number) { | 109 inline float NumberToFloat(Object* number) { |
119 return DoubleToFloat32(number->Number()); | 110 return DoubleToFloat32(number->Number()); |
120 } | 111 } |
121 | 112 |
122 | 113 |
123 inline bool Equals(float x, float y) { return x == y; } | 114 inline bool Equals(float x, float y) { return x == y; } |
124 | 115 |
125 } // namespace | 116 } // namespace |
126 | 117 |
127 SIMD4_FUNCTIONS(Float32x4) | 118 SIMD4_FUNCTIONS(Float32x4) |
128 } | 119 |
129 } // namespace v8::internal | 120 } // namespace internal |
| 121 } // namespace v8 |
OLD | NEW |