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

Side by Side Diff: src/harmony-simd.js

Issue 1230343003: V8: Add SIMD functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add integer 'neg' functions. Created 5 years, 4 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 | « no previous file | src/heap/heap.cc » ('j') | src/runtime/runtime-simd.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 var $float32x4ToString;
6 var $int32x4ToString;
7 var $bool32x4ToString;
8 var $int16x8ToString;
9 var $bool16x8ToString;
10 var $int8x16ToString;
11 var $bool8x16ToString;
Dan Ehrenberg 2015/08/06 00:12:25 You're supposed to use the new export/import syste
bbudge 2015/08/06 14:07:32 Done.
12
5 (function(global, utils) { 13 (function(global, utils) {
6 14
7 "use strict"; 15 "use strict";
8 16
9 %CheckIsBootstrapping(); 17 %CheckIsBootstrapping();
10 18
11 // ------------------------------------------------------------------- 19 // -------------------------------------------------------------------
12 // Imports 20 // Imports
13 21
14 var GlobalSIMD = global.SIMD; 22 var GlobalSIMD = global.SIMD;
15 23
16 macro SIMD_TYPES(FUNCTION) 24 macro SIMD_FLOAT_TYPES(FUNCTION)
17 FUNCTION(Float32x4, float32x4, 4) 25 FUNCTION(Float32x4, float32x4, 4)
26 endmacro
27
28 macro SIMD_INT_TYPES(FUNCTION)
18 FUNCTION(Int32x4, int32x4, 4) 29 FUNCTION(Int32x4, int32x4, 4)
30 FUNCTION(Int16x8, int16x8, 8)
31 FUNCTION(Int8x16, int8x16, 16)
32 endmacro
33
34 macro SIMD_BOOL_TYPES(FUNCTION)
19 FUNCTION(Bool32x4, bool32x4, 4) 35 FUNCTION(Bool32x4, bool32x4, 4)
20 FUNCTION(Int16x8, int16x8, 8)
21 FUNCTION(Bool16x8, bool16x8, 8) 36 FUNCTION(Bool16x8, bool16x8, 8)
22 FUNCTION(Int8x16, int8x16, 16)
23 FUNCTION(Bool8x16, bool8x16, 16) 37 FUNCTION(Bool8x16, bool8x16, 16)
24 endmacro 38 endmacro
25 39
40 macro SIMD_ALL_TYPES(FUNCTION)
41 SIMD_FLOAT_TYPES(FUNCTION)
42 SIMD_INT_TYPES(FUNCTION)
43 SIMD_BOOL_TYPES(FUNCTION)
44 endmacro
45
26 macro DECLARE_GLOBALS(NAME, TYPE, LANES) 46 macro DECLARE_GLOBALS(NAME, TYPE, LANES)
27 var GlobalNAME = GlobalSIMD.NAME; 47 var GlobalNAME = GlobalSIMD.NAME;
28 endmacro 48 endmacro
29 49
30 SIMD_TYPES(DECLARE_GLOBALS) 50 SIMD_ALL_TYPES(DECLARE_GLOBALS)
31 51
32 macro DECLARE_COMMON_FUNCTIONS(NAME, TYPE, LANES) 52 macro DECLARE_COMMON_FUNCTIONS(NAME, TYPE, LANES)
33 function NAMECheckJS(a) { 53 function NAMECheckJS(a) {
34 return %NAMECheck(a); 54 return %NAMECheck(a);
35 } 55 }
36 56
37 function NAMEToString() { 57 function NAMEToString() {
38 if (typeof(this) !== 'TYPE' && %_ClassOf(this) !== 'NAME') { 58 if (typeof(this) !== 'TYPE' && %_ClassOf(this) !== 'NAME') {
39 throw MakeTypeError(kIncompatibleMethodReceiver, 59 throw MakeTypeError(kIncompatibleMethodReceiver,
40 "NAME.prototype.toString", this); 60 "NAME.prototype.toString", this);
(...skipping 25 matching lines...) Expand all
66 if (typeof(this) !== 'TYPE' && %_ClassOf(this) !== 'NAME') { 86 if (typeof(this) !== 'TYPE' && %_ClassOf(this) !== 'NAME') {
67 throw MakeTypeError(kIncompatibleMethodReceiver, 87 throw MakeTypeError(kIncompatibleMethodReceiver,
68 "NAME.prototype.valueOf", this); 88 "NAME.prototype.valueOf", this);
69 } 89 }
70 return %_ValueOf(this); 90 return %_ValueOf(this);
71 } 91 }
72 92
73 function NAMEExtractLaneJS(instance, lane) { 93 function NAMEExtractLaneJS(instance, lane) {
74 return %NAMEExtractLane(instance, lane); 94 return %NAMEExtractLane(instance, lane);
75 } 95 }
76 endmacro
77 96
78 SIMD_TYPES(DECLARE_COMMON_FUNCTIONS) 97 function NAMEEqualJS(a, b) {
98 return %NAMEEqual(a, b);
99 }
79 100
80 macro SIMD_NUMERIC_TYPES(FUNCTION) 101 function NAMENotEqualJS(a, b) {
81 FUNCTION(Float32x4) 102 return %NAMENotEqual(a, b);
82 FUNCTION(Int32x4) 103 }
83 FUNCTION(Int16x8)
84 FUNCTION(Int8x16)
85 endmacro
86 104
87 macro DECLARE_NUMERIC_FUNCTIONS(NAME) 105 function NAMESelectJS(selector, a, b) {
88 function NAMEReplaceLaneJS(instance, lane, value) { 106 return %NAMESelect(selector, a, b);
Dan Ehrenberg 2015/08/06 00:12:25 The spec v0.7.3 defines select only on numeric typ
bbudge 2015/08/06 14:07:32 No, select on boolean types doesn't seem useful. D
89 return %NAMEReplaceLane(instance, lane, TO_NUMBER_INLINE(value));
90 } 107 }
91 endmacro 108 endmacro
92 109
93 SIMD_NUMERIC_TYPES(DECLARE_NUMERIC_FUNCTIONS) 110 SIMD_ALL_TYPES(DECLARE_COMMON_FUNCTIONS)
94 111
95 macro SIMD_BOOL_TYPES(FUNCTION) 112 macro DECLARE_INT_FUNCTIONS(NAME, TYPE, LANES)
96 FUNCTION(Bool32x4) 113 function NAMEShiftLeftByScalarJS(instance, shift) {
97 FUNCTION(Bool16x8) 114 return %NAMEShiftLeftByScalar(instance, shift);
98 FUNCTION(Bool8x16) 115 }
116
117 function NAMEShiftRightLogicalByScalarJS(instance, shift) {
118 return %NAMEShiftRightLogicalByScalar(instance, shift);
119 }
120
121 function NAMEShiftRightArithmeticByScalarJS(instance, shift) {
122 return %NAMEShiftRightArithmeticByScalar(instance, shift);
123 }
99 endmacro 124 endmacro
100 125
101 macro DECLARE_BOOL_FUNCTIONS(NAME) 126 SIMD_INT_TYPES(DECLARE_INT_FUNCTIONS)
127
128 macro DECLARE_BOOL_FUNCTIONS(NAME, TYPE, LANES)
102 function NAMEReplaceLaneJS(instance, lane, value) { 129 function NAMEReplaceLaneJS(instance, lane, value) {
103 return %NAMEReplaceLane(instance, lane, value); 130 return %NAMEReplaceLane(instance, lane, value);
104 } 131 }
132
133 function NAMEAnyTrueJS(s) {
134 return %NAMEAnyTrue(s);
135 }
136
137 function NAMEAllTrueJS(s) {
138 return %NAMEAllTrue(s);
139 }
105 endmacro 140 endmacro
106 141
107 SIMD_BOOL_TYPES(DECLARE_BOOL_FUNCTIONS) 142 SIMD_BOOL_TYPES(DECLARE_BOOL_FUNCTIONS)
108 143
109 macro SIMD_UNSIGNED_INT_TYPES(FUNCTION) 144 macro SIMD_UNSIGNED_INT_TYPES(FUNCTION)
110 FUNCTION(Int16x8) 145 FUNCTION(Int16x8)
111 FUNCTION(Int8x16) 146 FUNCTION(Int8x16)
112 endmacro 147 endmacro
113 148
114 macro DECLARE_UNSIGNED_INT_FUNCTIONS(NAME) 149 macro DECLARE_UNSIGNED_INT_FUNCTIONS(NAME)
115 function NAMEUnsignedExtractLaneJS(instance, lane) { 150 function NAMEUnsignedExtractLaneJS(instance, lane) {
116 return %NAMEUnsignedExtractLane(instance, lane); 151 return %NAMEUnsignedExtractLane(instance, lane);
117 } 152 }
118 endmacro 153 endmacro
119 154
120 SIMD_UNSIGNED_INT_TYPES(DECLARE_UNSIGNED_INT_FUNCTIONS) 155 SIMD_UNSIGNED_INT_TYPES(DECLARE_UNSIGNED_INT_FUNCTIONS)
121 156
157 macro SIMD_NUMERIC_TYPES(FUNCTION)
158 SIMD_FLOAT_TYPES(FUNCTION)
159 SIMD_INT_TYPES(FUNCTION)
160 endmacro
161
162 macro DECLARE_NUMERIC_FUNCTIONS(NAME, TYPE, LANES)
163 function NAMEReplaceLaneJS(instance, lane, value) {
164 return %NAMEReplaceLane(instance, lane, TO_NUMBER_INLINE(value));
165 }
166
167 function NAMENegJS(a) {
168 return %NAMENeg(a);
169 }
170
171 function NAMEAddJS(a, b) {
172 return %NAMEAdd(a, b);
173 }
174
175 function NAMESubJS(a, b) {
176 return %NAMESub(a, b);
177 }
178
179 function NAMEMulJS(a, b) {
180 return %NAMEMul(a, b);
181 }
182
183 function NAMEMinJS(a, b) {
184 return %NAMEMin(a, b);
185 }
186
187 function NAMEMaxJS(a, b) {
188 return %NAMEMax(a, b);
189 }
190
191 function NAMELessThanJS(a, b) {
192 return %NAMELessThan(a, b);
193 }
194
195 function NAMELessThanOrEqualJS(a, b) {
196 return %NAMELessThanOrEqual(a, b);
197 }
198
199 function NAMEGreaterThanJS(a, b) {
200 return %NAMEGreaterThan(a, b);
201 }
202
203 function NAMEGreaterThanOrEqualJS(a, b) {
204 return %NAMEGreaterThanOrEqual(a, b);
205 }
206 endmacro
207
208 SIMD_NUMERIC_TYPES(DECLARE_NUMERIC_FUNCTIONS)
209
210 macro SIMD_LOGICAL_TYPES(FUNCTION)
211 SIMD_INT_TYPES(FUNCTION)
212 SIMD_BOOL_TYPES(FUNCTION)
213 endmacro
214
215 macro DECLARE_LOGICAL_FUNCTIONS(NAME, TYPE, LANES)
216 function NAMEAndJS(a, b) {
217 return %NAMEAnd(a, b);
218 }
219
220 function NAMEOrJS(a, b) {
221 return %NAMEOr(a, b);
222 }
223
224 function NAMEXorJS(a, b) {
225 return %NAMEXor(a, b);
226 }
227
228 function NAMENotJS(a) {
229 return %NAMENot(a);
230 }
231 endmacro
232
233 SIMD_LOGICAL_TYPES(DECLARE_LOGICAL_FUNCTIONS)
234
235 macro SIMD_FROM_TYPES(FUNCTION)
236 FUNCTION(Float32x4, Int32x4)
237 FUNCTION(Int32x4, Float32x4)
238 endmacro
239
240 macro DECLARE_FROM_FUNCTIONS(TO, FROM)
241 function TOFromFROMJS(a) {
242 return %TOFromFROM(a);
243 }
244 endmacro
245
246 SIMD_FROM_TYPES(DECLARE_FROM_FUNCTIONS)
247
248 macro SIMD_FROM_BITS_TYPES(FUNCTION)
249 FUNCTION(Float32x4, Int32x4)
250 FUNCTION(Float32x4, Int16x8)
251 FUNCTION(Float32x4, Int8x16)
252 FUNCTION(Int32x4, Float32x4)
253 FUNCTION(Int32x4, Int16x8)
254 FUNCTION(Int32x4, Int8x16)
255 FUNCTION(Int16x8, Float32x4)
256 FUNCTION(Int16x8, Int32x4)
257 FUNCTION(Int16x8, Int8x16)
258 FUNCTION(Int8x16, Float32x4)
259 FUNCTION(Int8x16, Int32x4)
260 FUNCTION(Int8x16, Int16x8)
261 endmacro
262
263 macro DECLARE_FROM_BITS_FUNCTIONS(TO, FROM)
264 function TOFromFROMBitsJS(a) {
265 return %TOFromFROMBits(a);
266 }
267 endmacro
268
269 SIMD_FROM_BITS_TYPES(DECLARE_FROM_BITS_FUNCTIONS)
270
122 //------------------------------------------------------------------- 271 //-------------------------------------------------------------------
123 272
124 function Float32x4Constructor(c0, c1, c2, c3) { 273 function Float32x4Constructor(c0, c1, c2, c3) {
125 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Float32x4"); 274 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Float32x4");
126 return %CreateFloat32x4(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1), 275 return %CreateFloat32x4(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
127 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3)); 276 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3));
128 } 277 }
129 278
130 279
131 function Float32x4Splat(s) { 280 function Float32x4Splat(s) {
132 return %CreateFloat32x4(s, s, s, s); 281 return %CreateFloat32x4(s, s, s, s);
133 } 282 }
134 283
135 284
285 function Float32x4AbsJS(a) {
286 return %Float32x4Abs(a);
287 }
288
289
290 function Float32x4SqrtJS(a) {
291 return %Float32x4Sqrt(a);
292 }
293
294
295 function Float32x4RecipApproxJS(a) {
296 return %Float32x4RecipApprox(a);
297 }
298
299
300 function Float32x4RecipSqrtApproxJS(a) {
301 return %Float32x4RecipSqrtApprox(a);
302 }
303
304
305 function Float32x4DivJS(a, b) {
306 return %Float32x4Div(a, b);
307 }
308
309
310 function Float32x4MinNumJS(a, b) {
311 return %Float32x4MinNum(a, b);
312 }
313
314
315 function Float32x4MaxNumJS(a, b) {
316 return %Float32x4MaxNum(a, b);
317 }
318
319
320 function Float32x4SwizzleJS(a, c0, c1, c2, c3) {
321 return %Float32x4Swizzle(a, c0, c1, c2, c3);
322 }
323
324
325 function Float32x4ShuffleJS(a, b, c0, c1, c2, c3) {
326 return %Float32x4Shuffle(a, b, c0, c1, c2, c3);
327 }
328
329
136 function Int32x4Constructor(c0, c1, c2, c3) { 330 function Int32x4Constructor(c0, c1, c2, c3) {
137 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int32x4"); 331 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int32x4");
138 return %CreateInt32x4(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1), 332 return %CreateInt32x4(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
139 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3)); 333 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3));
140 } 334 }
141 335
142 336
143 function Int32x4Splat(s) { 337 function Int32x4Splat(s) {
144 return %CreateInt32x4(s, s, s, s); 338 return %CreateInt32x4(s, s, s, s);
145 } 339 }
146 340
147 341
342 function Int32x4SwizzleJS(a, c0, c1, c2, c3) {
343 return %Int32x4Swizzle(a, c0, c1, c2, c3);
344 }
345
346
347 function Int32x4ShuffleJS(a, b, c0, c1, c2, c3) {
348 return %Int32x4Shuffle(a, b, c0, c1, c2, c3);
349 }
350
351
148 function Bool32x4Constructor(c0, c1, c2, c3) { 352 function Bool32x4Constructor(c0, c1, c2, c3) {
149 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool32x4"); 353 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool32x4");
150 return %CreateBool32x4(c0, c1, c2, c3); 354 return %CreateBool32x4(c0, c1, c2, c3);
151 } 355 }
152 356
153 357
154 function Bool32x4Splat(s) { 358 function Bool32x4Splat(s) {
155 return %CreateBool32x4(s, s, s, s); 359 return %CreateBool32x4(s, s, s, s);
156 } 360 }
157 361
362 function Bool32x4SwizzleJS(a, c0, c1, c2, c3) {
363 return %Bool32x4Swizzle(a, c0, c1, c2, c3);
364 }
365
366
367 function Bool32x4ShuffleJS(a, b, c0, c1, c2, c3) {
368 return %Bool32x4Shuffle(a, b, c0, c1, c2, c3);
369 }
370
158 371
159 function Int16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) { 372 function Int16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) {
160 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int16x8"); 373 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int16x8");
161 return %CreateInt16x8(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1), 374 return %CreateInt16x8(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
162 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3), 375 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3),
163 TO_NUMBER_INLINE(c4), TO_NUMBER_INLINE(c5), 376 TO_NUMBER_INLINE(c4), TO_NUMBER_INLINE(c5),
164 TO_NUMBER_INLINE(c6), TO_NUMBER_INLINE(c7)); 377 TO_NUMBER_INLINE(c6), TO_NUMBER_INLINE(c7));
165 } 378 }
166 379
167 380
168 function Int16x8Splat(s) { 381 function Int16x8Splat(s) {
169 return %CreateInt16x8(s, s, s, s, s, s, s, s); 382 return %CreateInt16x8(s, s, s, s, s, s, s, s);
170 } 383 }
171 384
172 385
386 function Int16x8SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7) {
387 return %Int16x8Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7);
388 }
389
390
391 function Int16x8ShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7) {
392 return %Int16x8Shuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7);
393 }
394
395
173 function Bool16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) { 396 function Bool16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) {
174 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool16x8"); 397 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool16x8");
175 return %CreateBool16x8(c0, c1, c2, c3, c4, c5, c6, c7); 398 return %CreateBool16x8(c0, c1, c2, c3, c4, c5, c6, c7);
176 } 399 }
177 400
178 401
179 function Bool16x8Splat(s) { 402 function Bool16x8Splat(s) {
180 return %CreateBool16x8(s, s, s, s, s, s, s, s); 403 return %CreateBool16x8(s, s, s, s, s, s, s, s);
181 } 404 }
182 405
183 406
407 function Bool16x8SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7) {
408 return %Bool16x8Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7);
409 }
410
411
412 function Bool16x8ShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7) {
413 return %Bool16x8Shuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7);
414 }
415
416
184 function Int8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, 417 function Int8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
185 c12, c13, c14, c15) { 418 c12, c13, c14, c15) {
186 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int8x16"); 419 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int8x16");
187 return %CreateInt8x16(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1), 420 return %CreateInt8x16(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
188 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3), 421 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3),
189 TO_NUMBER_INLINE(c4), TO_NUMBER_INLINE(c5), 422 TO_NUMBER_INLINE(c4), TO_NUMBER_INLINE(c5),
190 TO_NUMBER_INLINE(c6), TO_NUMBER_INLINE(c7), 423 TO_NUMBER_INLINE(c6), TO_NUMBER_INLINE(c7),
191 TO_NUMBER_INLINE(c8), TO_NUMBER_INLINE(c9), 424 TO_NUMBER_INLINE(c8), TO_NUMBER_INLINE(c9),
192 TO_NUMBER_INLINE(c10), TO_NUMBER_INLINE(c11), 425 TO_NUMBER_INLINE(c10), TO_NUMBER_INLINE(c11),
193 TO_NUMBER_INLINE(c12), TO_NUMBER_INLINE(c13), 426 TO_NUMBER_INLINE(c12), TO_NUMBER_INLINE(c13),
194 TO_NUMBER_INLINE(c14), TO_NUMBER_INLINE(c15)); 427 TO_NUMBER_INLINE(c14), TO_NUMBER_INLINE(c15));
195 } 428 }
196 429
197 430
198 function Int8x16Splat(s) { 431 function Int8x16Splat(s) {
199 return %CreateInt8x16(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s); 432 return %CreateInt8x16(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s);
200 } 433 }
201 434
202 435
436 function Int8x16SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
437 c12, c13, c14, c15) {
438 return %Int8x16Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
439 c12, c13, c14, c15);
440 }
441
442
443 function Int8x16ShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
444 c11, c12, c13, c14, c15) {
445 return %Int8x16Shuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
446 c11, c12, c13, c14, c15);
447 }
448
449
203 function Bool8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, 450 function Bool8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
204 c12, c13, c14, c15) { 451 c12, c13, c14, c15) {
205 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool8x16"); 452 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool8x16");
206 return %CreateBool8x16(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, 453 return %CreateBool8x16(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
207 c13, c14, c15); 454 c13, c14, c15);
208 } 455 }
209 456
210 457
211 function Bool8x16Splat(s) { 458 function Bool8x16Splat(s) {
212 return %CreateBool8x16(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s); 459 return %CreateBool8x16(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s);
213 } 460 }
214 461
215 462
463 function Bool8x16SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
464 c12, c13, c14, c15) {
465 return %Bool8x16Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
466 c12, c13, c14, c15);
467 }
468
469
470 function Bool8x16ShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
471 c11, c12, c13, c14, c15) {
472 return %Bool8x16Shuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
473 c11, c12, c13, c14, c15);
474 }
475
476
216 %AddNamedProperty(GlobalSIMD, symbolToStringTag, 'SIMD', READ_ONLY | DONT_ENUM); 477 %AddNamedProperty(GlobalSIMD, symbolToStringTag, 'SIMD', READ_ONLY | DONT_ENUM);
217 478
218 macro SETUP_SIMD_TYPE(NAME, TYPE, LANES) 479 macro SETUP_SIMD_TYPE(NAME, TYPE, LANES)
219 %SetCode(GlobalNAME, NAMEConstructor); 480 %SetCode(GlobalNAME, NAMEConstructor);
220 %FunctionSetPrototype(GlobalNAME, {}); 481 %FunctionSetPrototype(GlobalNAME, {});
221 %AddNamedProperty(GlobalNAME.prototype, 'constructor', GlobalNAME, 482 %AddNamedProperty(GlobalNAME.prototype, 'constructor', GlobalNAME,
222 DONT_ENUM); 483 DONT_ENUM);
223 %AddNamedProperty(GlobalNAME.prototype, symbolToStringTag, 'NAME', 484 %AddNamedProperty(GlobalNAME.prototype, symbolToStringTag, 'NAME',
224 DONT_ENUM | READ_ONLY); 485 DONT_ENUM | READ_ONLY);
225 utils.InstallFunctions(GlobalNAME.prototype, DONT_ENUM, [ 486 utils.InstallFunctions(GlobalNAME.prototype, DONT_ENUM, [
226 'toLocaleString', NAMEToLocaleString, 487 'toLocaleString', NAMEToLocaleString,
227 'toString', NAMEToString, 488 'toString', NAMEToString,
228 'valueOf', NAMEValueOf, 489 'valueOf', NAMEValueOf,
229 ]); 490 ]);
230 endmacro 491 endmacro
231 492
232 SIMD_TYPES(SETUP_SIMD_TYPE) 493 SIMD_ALL_TYPES(SETUP_SIMD_TYPE)
233 494
234 //------------------------------------------------------------------- 495 //-------------------------------------------------------------------
235 496
236 utils.InstallFunctions(GlobalFloat32x4, DONT_ENUM, [ 497 utils.InstallFunctions(GlobalFloat32x4, DONT_ENUM, [
237 'splat', Float32x4Splat, 498 'splat', Float32x4Splat,
238 'check', Float32x4CheckJS, 499 'check', Float32x4CheckJS,
239 'extractLane', Float32x4ExtractLaneJS, 500 'extractLane', Float32x4ExtractLaneJS,
240 'replaceLane', Float32x4ReplaceLaneJS, 501 'replaceLane', Float32x4ReplaceLaneJS,
502 'neg', Float32x4NegJS,
503 'abs', Float32x4AbsJS,
504 'sqrt', Float32x4SqrtJS,
505 'reciprocalApproximation', Float32x4RecipApproxJS,
506 'reciprocalSqrtApproximation', Float32x4RecipSqrtApproxJS,
507 'add', Float32x4AddJS,
508 'sub', Float32x4SubJS,
509 'mul', Float32x4MulJS,
510 'div', Float32x4DivJS,
511 'min', Float32x4MinJS,
512 'max', Float32x4MaxJS,
513 'minNum', Float32x4MinNumJS,
514 'maxNum', Float32x4MaxNumJS,
515 'lessThan', Float32x4LessThanJS,
516 'lessThanOrEqual', Float32x4LessThanOrEqualJS,
517 'greaterThan', Float32x4GreaterThanJS,
518 'greaterThanOrEqual', Float32x4GreaterThanOrEqualJS,
519 'equal', Float32x4EqualJS,
520 'notEqual', Float32x4NotEqualJS,
521 'select', Float32x4SelectJS,
522 'swizzle', Float32x4SwizzleJS,
523 'shuffle', Float32x4ShuffleJS,
524 'fromInt32x4', Float32x4FromInt32x4JS,
525 'fromInt32x4Bits', Float32x4FromInt32x4BitsJS,
526 'fromInt16x8Bits', Float32x4FromInt16x8BitsJS,
527 'fromInt8x16Bits', Float32x4FromInt8x16BitsJS,
241 ]); 528 ]);
242 529
243 utils.InstallFunctions(GlobalInt32x4, DONT_ENUM, [ 530 utils.InstallFunctions(GlobalInt32x4, DONT_ENUM, [
244 'splat', Int32x4Splat, 531 'splat', Int32x4Splat,
245 'check', Int32x4CheckJS, 532 'check', Int32x4CheckJS,
246 'extractLane', Int32x4ExtractLaneJS, 533 'extractLane', Int32x4ExtractLaneJS,
247 'replaceLane', Int32x4ReplaceLaneJS, 534 'replaceLane', Int32x4ReplaceLaneJS,
535 'neg', Int32x4NegJS,
536 'add', Int32x4AddJS,
537 'sub', Int32x4SubJS,
538 'mul', Int32x4MulJS,
539 'min', Int32x4MinJS,
540 'max', Int32x4MaxJS,
541 'and', Int32x4AndJS,
542 'or', Int32x4OrJS,
543 'xor', Int32x4XorJS,
544 'not', Int32x4NotJS,
545 'shiftLeftByScalar', Int32x4ShiftLeftByScalarJS,
546 'shiftRightLogicalByScalar', Int32x4ShiftRightLogicalByScalarJS,
547 'shiftRightArithmeticByScalar', Int32x4ShiftRightArithmeticByScalarJS,
548 'lessThan', Int32x4LessThanJS,
549 'lessThanOrEqual', Int32x4LessThanOrEqualJS,
550 'greaterThan', Int32x4GreaterThanJS,
551 'greaterThanOrEqual', Int32x4GreaterThanOrEqualJS,
552 'equal', Int32x4EqualJS,
553 'notEqual', Int32x4NotEqualJS,
554 'select', Int32x4SelectJS,
555 'swizzle', Int32x4SwizzleJS,
556 'shuffle', Int32x4ShuffleJS,
557 'fromFloat32x4', Int32x4FromFloat32x4JS,
558 'fromFloat32x4Bits', Int32x4FromFloat32x4BitsJS,
559 'fromInt16x8Bits', Int32x4FromInt16x8BitsJS,
560 'fromInt8x16Bits', Int32x4FromInt8x16BitsJS,
248 ]); 561 ]);
249 562
250 utils.InstallFunctions(GlobalBool32x4, DONT_ENUM, [ 563 utils.InstallFunctions(GlobalBool32x4, DONT_ENUM, [
251 'splat', Bool32x4Splat, 564 'splat', Bool32x4Splat,
252 'check', Bool32x4CheckJS, 565 'check', Bool32x4CheckJS,
253 'extractLane', Bool32x4ExtractLaneJS, 566 'extractLane', Bool32x4ExtractLaneJS,
254 'replaceLane', Bool32x4ReplaceLaneJS, 567 'replaceLane', Bool32x4ReplaceLaneJS,
568 'and', Bool32x4AndJS,
569 'or', Bool32x4OrJS,
570 'xor', Bool32x4XorJS,
571 'not', Bool32x4NotJS,
572 'anyTrue', Bool32x4AnyTrueJS,
573 'allTrue', Bool32x4AllTrueJS,
574 'equal', Bool32x4EqualJS,
575 'notEqual', Bool32x4NotEqualJS,
576 'select', Bool32x4SelectJS,
577 'swizzle', Bool32x4SwizzleJS,
578 'shuffle', Bool32x4ShuffleJS,
255 ]); 579 ]);
256 580
257 utils.InstallFunctions(GlobalInt16x8, DONT_ENUM, [ 581 utils.InstallFunctions(GlobalInt16x8, DONT_ENUM, [
258 'splat', Int16x8Splat, 582 'splat', Int16x8Splat,
259 'check', Int16x8CheckJS, 583 'check', Int16x8CheckJS,
260 'extractLane', Int16x8ExtractLaneJS, 584 'extractLane', Int16x8ExtractLaneJS,
261 'unsignedExtractLane', Int16x8UnsignedExtractLaneJS, 585 'unsignedExtractLane', Int16x8UnsignedExtractLaneJS,
262 'replaceLane', Int16x8ReplaceLaneJS, 586 'replaceLane', Int16x8ReplaceLaneJS,
587 'neg', Int16x8NegJS,
588 'add', Int16x8AddJS,
589 'sub', Int16x8SubJS,
590 'mul', Int16x8MulJS,
591 'min', Int16x8MinJS,
592 'max', Int16x8MaxJS,
593 'and', Int16x8AndJS,
594 'or', Int16x8OrJS,
595 'xor', Int16x8XorJS,
596 'not', Int16x8NotJS,
597 'shiftLeftByScalar', Int16x8ShiftLeftByScalarJS,
598 'shiftRightLogicalByScalar', Int16x8ShiftRightLogicalByScalarJS,
599 'shiftRightArithmeticByScalar', Int16x8ShiftRightArithmeticByScalarJS,
600 'lessThan', Int16x8LessThanJS,
601 'lessThanOrEqual', Int16x8LessThanOrEqualJS,
602 'greaterThan', Int16x8GreaterThanJS,
603 'greaterThanOrEqual', Int16x8GreaterThanOrEqualJS,
604 'equal', Int16x8EqualJS,
605 'notEqual', Int16x8NotEqualJS,
606 'select', Int16x8SelectJS,
607 'swizzle', Int16x8SwizzleJS,
608 'shuffle', Int16x8ShuffleJS,
609 'fromFloat32x4Bits', Int16x8FromFloat32x4BitsJS,
610 'fromInt32x4Bits', Int16x8FromInt32x4BitsJS,
611 'fromInt8x16Bits', Int16x8FromInt8x16BitsJS,
263 ]); 612 ]);
264 613
265 utils.InstallFunctions(GlobalBool16x8, DONT_ENUM, [ 614 utils.InstallFunctions(GlobalBool16x8, DONT_ENUM, [
266 'splat', Bool16x8Splat, 615 'splat', Bool16x8Splat,
267 'check', Bool16x8CheckJS, 616 'check', Bool16x8CheckJS,
268 'extractLane', Bool16x8ExtractLaneJS, 617 'extractLane', Bool16x8ExtractLaneJS,
269 'replaceLane', Bool16x8ReplaceLaneJS, 618 'replaceLane', Bool16x8ReplaceLaneJS,
619 'and', Bool16x8AndJS,
620 'or', Bool16x8OrJS,
621 'xor', Bool16x8XorJS,
622 'not', Bool16x8NotJS,
623 'anyTrue', Bool16x8AnyTrueJS,
624 'allTrue', Bool16x8AllTrueJS,
625 'equal', Bool16x8EqualJS,
626 'notEqual', Bool16x8NotEqualJS,
627 'select', Bool16x8SelectJS,
628 'swizzle', Bool16x8SwizzleJS,
629 'shuffle', Bool16x8ShuffleJS,
270 ]); 630 ]);
271 631
272 utils.InstallFunctions(GlobalInt8x16, DONT_ENUM, [ 632 utils.InstallFunctions(GlobalInt8x16, DONT_ENUM, [
273 'splat', Int8x16Splat, 633 'splat', Int8x16Splat,
274 'check', Int8x16CheckJS, 634 'check', Int8x16CheckJS,
275 'extractLane', Int8x16ExtractLaneJS, 635 'extractLane', Int8x16ExtractLaneJS,
276 'unsignedExtractLane', Int8x16UnsignedExtractLaneJS, 636 'unsignedExtractLane', Int8x16UnsignedExtractLaneJS,
277 'replaceLane', Int8x16ReplaceLaneJS, 637 'replaceLane', Int8x16ReplaceLaneJS,
638 'neg', Int8x16NegJS,
639 'add', Int8x16AddJS,
640 'sub', Int8x16SubJS,
641 'mul', Int8x16MulJS,
642 'min', Int8x16MinJS,
643 'max', Int8x16MaxJS,
644 'and', Int8x16AndJS,
645 'or', Int8x16OrJS,
646 'xor', Int8x16XorJS,
647 'not', Int8x16NotJS,
648 'shiftLeftByScalar', Int8x16ShiftLeftByScalarJS,
649 'shiftRightLogicalByScalar', Int8x16ShiftRightLogicalByScalarJS,
650 'shiftRightArithmeticByScalar', Int8x16ShiftRightArithmeticByScalarJS,
651 'lessThan', Int8x16LessThanJS,
652 'lessThanOrEqual', Int8x16LessThanOrEqualJS,
653 'greaterThan', Int8x16GreaterThanJS,
654 'greaterThanOrEqual', Int8x16GreaterThanOrEqualJS,
655 'equal', Int8x16EqualJS,
656 'notEqual', Int8x16NotEqualJS,
657 'select', Int8x16SelectJS,
658 'swizzle', Int8x16SwizzleJS,
659 'shuffle', Int8x16ShuffleJS,
660 'fromFloat32x4Bits', Int8x16FromFloat32x4BitsJS,
661 'fromInt32x4Bits', Int8x16FromInt32x4BitsJS,
662 'fromInt16x8Bits', Int8x16FromInt16x8BitsJS,
278 ]); 663 ]);
279 664
280 utils.InstallFunctions(GlobalBool8x16, DONT_ENUM, [ 665 utils.InstallFunctions(GlobalBool8x16, DONT_ENUM, [
281 'splat', Bool8x16Splat, 666 'splat', Bool8x16Splat,
282 'check', Bool8x16CheckJS, 667 'check', Bool8x16CheckJS,
283 'extractLane', Bool8x16ExtractLaneJS, 668 'extractLane', Bool8x16ExtractLaneJS,
284 'replaceLane', Bool8x16ReplaceLaneJS, 669 'replaceLane', Bool8x16ReplaceLaneJS,
670 'and', Bool8x16AndJS,
671 'or', Bool8x16OrJS,
672 'xor', Bool8x16XorJS,
673 'not', Bool8x16NotJS,
674 'anyTrue', Bool8x16AnyTrueJS,
675 'allTrue', Bool8x16AllTrueJS,
676 'equal', Bool8x16EqualJS,
677 'notEqual', Bool8x16NotEqualJS,
678 'select', Bool8x16SelectJS,
679 'swizzle', Bool8x16SwizzleJS,
680 'shuffle', Bool8x16ShuffleJS,
285 ]); 681 ]);
286 682
683 $float32x4ToString = Float32x4ToString;
684 $int32x4ToString = Int32x4ToString;
685 $bool32x4ToString = Bool32x4ToString;
686 $int16x8ToString = Int16x8ToString;
687 $bool16x8ToString = Bool16x8ToString;
688 $int8x16ToString = Int8x16ToString;
689 $bool8x16ToString = Bool8x16ToString;
690
287 }) 691 })
OLDNEW
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | src/runtime/runtime-simd.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698