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

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: 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/heap/heap.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;
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);
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 NAMEAddJS(a, b) {
168 return %NAMEAdd(a, b);
169 }
170
171 function NAMESubJS(a, b) {
172 return %NAMESub(a, b);
173 }
174
175 function NAMEMulJS(a, b) {
176 return %NAMEMul(a, b);
177 }
178
179 function NAMEMinJS(a, b) {
180 return %NAMEMin(a, b);
181 }
182
183 function NAMEMaxJS(a, b) {
184 return %NAMEMax(a, b);
185 }
186
187 function NAMELessThanJS(a, b) {
188 return %NAMELessThan(a, b);
189 }
190
191 function NAMELessThanOrEqualJS(a, b) {
192 return %NAMELessThanOrEqual(a, b);
193 }
194
195 function NAMEGreaterThanJS(a, b) {
196 return %NAMEGreaterThan(a, b);
197 }
198
199 function NAMEGreaterThanOrEqualJS(a, b) {
200 return %NAMEGreaterThanOrEqual(a, b);
201 }
202 endmacro
203
204 SIMD_NUMERIC_TYPES(DECLARE_NUMERIC_FUNCTIONS)
205
206 macro SIMD_LOGICAL_TYPES(FUNCTION)
207 SIMD_INT_TYPES(FUNCTION)
208 SIMD_BOOL_TYPES(FUNCTION)
209 endmacro
210
211 macro DECLARE_LOGICAL_FUNCTIONS(NAME, TYPE, LANES)
212 function NAMEAndJS(a, b) {
213 return %NAMEAnd(a, b);
214 }
215
216 function NAMEOrJS(a, b) {
217 return %NAMEOr(a, b);
218 }
219
220 function NAMEXorJS(a, b) {
221 return %NAMEXor(a, b);
222 }
223
224 function NAMENotJS(a) {
225 return %NAMENot(a);
226 }
227 endmacro
228
229 SIMD_LOGICAL_TYPES(DECLARE_LOGICAL_FUNCTIONS)
230
231 macro SIMD_FROM_TYPES(FUNCTION)
232 FUNCTION(Float32x4, Int32x4)
233 FUNCTION(Int32x4, Float32x4)
234 endmacro
235
236 macro DECLARE_FROM_FUNCTIONS(TO, FROM)
237 function TOFromFROMJS(a) {
238 return %TOFromFROM(a);
239 }
240 endmacro
241
242 SIMD_FROM_TYPES(DECLARE_FROM_FUNCTIONS)
243
244 macro SIMD_FROM_BITS_TYPES(FUNCTION)
245 FUNCTION(Float32x4, Int32x4)
246 FUNCTION(Float32x4, Int16x8)
247 FUNCTION(Float32x4, Int8x16)
248 FUNCTION(Int32x4, Float32x4)
249 FUNCTION(Int32x4, Int16x8)
250 FUNCTION(Int32x4, Int8x16)
251 FUNCTION(Int16x8, Float32x4)
252 FUNCTION(Int16x8, Int32x4)
253 FUNCTION(Int16x8, Int8x16)
254 FUNCTION(Int8x16, Float32x4)
255 FUNCTION(Int8x16, Int32x4)
256 FUNCTION(Int8x16, Int16x8)
257 endmacro
258
259 macro DECLARE_FROM_BITS_FUNCTIONS(TO, FROM)
260 function TOFromFROMBitsJS(a) {
261 return %TOFromFROMBits(a);
262 }
263 endmacro
264
265 SIMD_FROM_BITS_TYPES(DECLARE_FROM_BITS_FUNCTIONS)
266
122 //------------------------------------------------------------------- 267 //-------------------------------------------------------------------
123 268
124 function Float32x4Constructor(c0, c1, c2, c3) { 269 function Float32x4Constructor(c0, c1, c2, c3) {
125 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Float32x4"); 270 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Float32x4");
126 return %CreateFloat32x4(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1), 271 return %CreateFloat32x4(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
127 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3)); 272 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3));
128 } 273 }
129 274
130 275
131 function Float32x4Splat(s) { 276 function Float32x4Splat(s) {
132 return %CreateFloat32x4(s, s, s, s); 277 return %CreateFloat32x4(s, s, s, s);
133 } 278 }
134 279
135 280
281 function Float32x4AbsJS(a) {
282 return %Float32x4Abs(a);
283 }
284
285
286 function Float32x4NegJS(a) {
287 return %Float32x4Neg(a);
288 }
289
290
291 function Float32x4SqrtJS(a) {
292 return %Float32x4Sqrt(a);
293 }
294
295
296 function Float32x4RecipApproxJS(a) {
297 return %Float32x4RecipApprox(a);
298 }
299
300
301 function Float32x4RecipSqrtApproxJS(a) {
302 return %Float32x4RecipSqrtApprox(a);
303 }
304
305
306 function Float32x4DivJS(a, b) {
307 return %Float32x4Div(a, b);
308 }
309
310
311 function Float32x4MinNumJS(a, b) {
312 return %Float32x4MinNum(a, b);
313 }
314
315
316 function Float32x4MaxNumJS(a, b) {
317 return %Float32x4MaxNum(a, b);
318 }
319
320
321 function Float32x4SwizzleJS(a, c0, c1, c2, c3) {
322 return %Float32x4Swizzle(a, c0, c1, c2, c3);
323 }
324
325
326 function Float32x4ShuffleJS(a, b, c0, c1, c2, c3) {
327 return %Float32x4Shuffle(a, b, c0, c1, c2, c3);
328 }
329
330
136 function Int32x4Constructor(c0, c1, c2, c3) { 331 function Int32x4Constructor(c0, c1, c2, c3) {
137 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int32x4"); 332 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int32x4");
138 return %CreateInt32x4(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1), 333 return %CreateInt32x4(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
139 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3)); 334 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3));
140 } 335 }
141 336
142 337
143 function Int32x4Splat(s) { 338 function Int32x4Splat(s) {
144 return %CreateInt32x4(s, s, s, s); 339 return %CreateInt32x4(s, s, s, s);
145 } 340 }
146 341
147 342
343 function Int32x4SwizzleJS(a, c0, c1, c2, c3) {
344 return %Int32x4Swizzle(a, c0, c1, c2, c3);
345 }
346
347
348 function Int32x4ShuffleJS(a, b, c0, c1, c2, c3) {
349 return %Int32x4Shuffle(a, b, c0, c1, c2, c3);
350 }
351
352
148 function Bool32x4Constructor(c0, c1, c2, c3) { 353 function Bool32x4Constructor(c0, c1, c2, c3) {
149 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool32x4"); 354 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool32x4");
150 return %CreateBool32x4(c0, c1, c2, c3); 355 return %CreateBool32x4(c0, c1, c2, c3);
151 } 356 }
152 357
153 358
154 function Bool32x4Splat(s) { 359 function Bool32x4Splat(s) {
155 return %CreateBool32x4(s, s, s, s); 360 return %CreateBool32x4(s, s, s, s);
156 } 361 }
157 362
363 function Bool32x4SwizzleJS(a, c0, c1, c2, c3) {
364 return %Bool32x4Swizzle(a, c0, c1, c2, c3);
365 }
366
367
368 function Bool32x4ShuffleJS(a, b, c0, c1, c2, c3) {
369 return %Bool32x4Shuffle(a, b, c0, c1, c2, c3);
370 }
371
158 372
159 function Int16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) { 373 function Int16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) {
160 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int16x8"); 374 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int16x8");
161 return %CreateInt16x8(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1), 375 return %CreateInt16x8(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
162 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3), 376 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3),
163 TO_NUMBER_INLINE(c4), TO_NUMBER_INLINE(c5), 377 TO_NUMBER_INLINE(c4), TO_NUMBER_INLINE(c5),
164 TO_NUMBER_INLINE(c6), TO_NUMBER_INLINE(c7)); 378 TO_NUMBER_INLINE(c6), TO_NUMBER_INLINE(c7));
165 } 379 }
166 380
167 381
168 function Int16x8Splat(s) { 382 function Int16x8Splat(s) {
169 return %CreateInt16x8(s, s, s, s, s, s, s, s); 383 return %CreateInt16x8(s, s, s, s, s, s, s, s);
170 } 384 }
171 385
172 386
387 function Int16x8SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7) {
388 return %Int16x8Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7);
389 }
390
391
392 function Int16x8ShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7) {
393 return %Int16x8Shuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7);
394 }
395
396
173 function Bool16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) { 397 function Bool16x8Constructor(c0, c1, c2, c3, c4, c5, c6, c7) {
174 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool16x8"); 398 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool16x8");
175 return %CreateBool16x8(c0, c1, c2, c3, c4, c5, c6, c7); 399 return %CreateBool16x8(c0, c1, c2, c3, c4, c5, c6, c7);
176 } 400 }
177 401
178 402
179 function Bool16x8Splat(s) { 403 function Bool16x8Splat(s) {
180 return %CreateBool16x8(s, s, s, s, s, s, s, s); 404 return %CreateBool16x8(s, s, s, s, s, s, s, s);
181 } 405 }
182 406
183 407
408 function Bool16x8SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7) {
409 return %Bool16x8Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7);
410 }
411
412
413 function Bool16x8ShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7) {
414 return %Bool16x8Shuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7);
415 }
416
417
184 function Int8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, 418 function Int8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
185 c12, c13, c14, c15) { 419 c12, c13, c14, c15) {
186 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int8x16"); 420 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Int8x16");
187 return %CreateInt8x16(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1), 421 return %CreateInt8x16(TO_NUMBER_INLINE(c0), TO_NUMBER_INLINE(c1),
188 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3), 422 TO_NUMBER_INLINE(c2), TO_NUMBER_INLINE(c3),
189 TO_NUMBER_INLINE(c4), TO_NUMBER_INLINE(c5), 423 TO_NUMBER_INLINE(c4), TO_NUMBER_INLINE(c5),
190 TO_NUMBER_INLINE(c6), TO_NUMBER_INLINE(c7), 424 TO_NUMBER_INLINE(c6), TO_NUMBER_INLINE(c7),
191 TO_NUMBER_INLINE(c8), TO_NUMBER_INLINE(c9), 425 TO_NUMBER_INLINE(c8), TO_NUMBER_INLINE(c9),
192 TO_NUMBER_INLINE(c10), TO_NUMBER_INLINE(c11), 426 TO_NUMBER_INLINE(c10), TO_NUMBER_INLINE(c11),
193 TO_NUMBER_INLINE(c12), TO_NUMBER_INLINE(c13), 427 TO_NUMBER_INLINE(c12), TO_NUMBER_INLINE(c13),
194 TO_NUMBER_INLINE(c14), TO_NUMBER_INLINE(c15)); 428 TO_NUMBER_INLINE(c14), TO_NUMBER_INLINE(c15));
195 } 429 }
196 430
197 431
198 function Int8x16Splat(s) { 432 function Int8x16Splat(s) {
199 return %CreateInt8x16(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s); 433 return %CreateInt8x16(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s);
200 } 434 }
201 435
202 436
437 function Int8x16SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
438 c12, c13, c14, c15) {
439 return %Int8x16Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
440 c12, c13, c14, c15);
441 }
442
443
444 function Int8x16ShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
445 c11, c12, c13, c14, c15) {
446 return %Int8x16Shuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
447 c11, c12, c13, c14, c15);
448 }
449
450
203 function Bool8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, 451 function Bool8x16Constructor(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
204 c12, c13, c14, c15) { 452 c12, c13, c14, c15) {
205 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool8x16"); 453 if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Bool8x16");
206 return %CreateBool8x16(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, 454 return %CreateBool8x16(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
207 c13, c14, c15); 455 c13, c14, c15);
208 } 456 }
209 457
210 458
211 function Bool8x16Splat(s) { 459 function Bool8x16Splat(s) {
212 return %CreateBool8x16(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s); 460 return %CreateBool8x16(s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s);
213 } 461 }
214 462
215 463
464 function Bool8x16SwizzleJS(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
465 c12, c13, c14, c15) {
466 return %Bool8x16Swizzle(a, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11,
467 c12, c13, c14, c15);
468 }
469
470
471 function Bool8x16ShuffleJS(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
472 c11, c12, c13, c14, c15) {
473 return %Bool8x16Shuffle(a, b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10,
474 c11, c12, c13, c14, c15);
475 }
476
477
216 %AddNamedProperty(GlobalSIMD, symbolToStringTag, 'SIMD', READ_ONLY | DONT_ENUM); 478 %AddNamedProperty(GlobalSIMD, symbolToStringTag, 'SIMD', READ_ONLY | DONT_ENUM);
217 479
218 macro SETUP_SIMD_TYPE(NAME, TYPE, LANES) 480 macro SETUP_SIMD_TYPE(NAME, TYPE, LANES)
219 %SetCode(GlobalNAME, NAMEConstructor); 481 %SetCode(GlobalNAME, NAMEConstructor);
220 %FunctionSetPrototype(GlobalNAME, {}); 482 %FunctionSetPrototype(GlobalNAME, {});
221 %AddNamedProperty(GlobalNAME.prototype, 'constructor', GlobalNAME, 483 %AddNamedProperty(GlobalNAME.prototype, 'constructor', GlobalNAME,
222 DONT_ENUM); 484 DONT_ENUM);
223 %AddNamedProperty(GlobalNAME.prototype, symbolToStringTag, 'NAME', 485 %AddNamedProperty(GlobalNAME.prototype, symbolToStringTag, 'NAME',
224 DONT_ENUM | READ_ONLY); 486 DONT_ENUM | READ_ONLY);
225 utils.InstallFunctions(GlobalNAME.prototype, DONT_ENUM, [ 487 utils.InstallFunctions(GlobalNAME.prototype, DONT_ENUM, [
226 'toLocaleString', NAMEToLocaleString, 488 'toLocaleString', NAMEToLocaleString,
227 'toString', NAMEToString, 489 'toString', NAMEToString,
228 'valueOf', NAMEValueOf, 490 'valueOf', NAMEValueOf,
229 ]); 491 ]);
230 endmacro 492 endmacro
231 493
232 SIMD_TYPES(SETUP_SIMD_TYPE) 494 SIMD_ALL_TYPES(SETUP_SIMD_TYPE)
233 495
234 //------------------------------------------------------------------- 496 //-------------------------------------------------------------------
235 497
236 utils.InstallFunctions(GlobalFloat32x4, DONT_ENUM, [ 498 utils.InstallFunctions(GlobalFloat32x4, DONT_ENUM, [
237 'splat', Float32x4Splat, 499 'splat', Float32x4Splat,
238 'check', Float32x4CheckJS, 500 'check', Float32x4CheckJS,
239 'extractLane', Float32x4ExtractLaneJS, 501 'extractLane', Float32x4ExtractLaneJS,
240 'replaceLane', Float32x4ReplaceLaneJS, 502 'replaceLane', Float32x4ReplaceLaneJS,
503 'abs', Float32x4AbsJS,
504 'neg', Float32x4NegJS,
505 'sqrt', Float32x4SqrtJS,
506 'reciprocalApproximation', Float32x4RecipApproxJS,
507 'reciprocalSqrtApproximation', Float32x4RecipSqrtApproxJS,
508 'add', Float32x4AddJS,
509 'sub', Float32x4SubJS,
510 'mul', Float32x4MulJS,
511 'div', Float32x4DivJS,
512 'min', Float32x4MinJS,
513 'max', Float32x4MaxJS,
514 'minNum', Float32x4MinNumJS,
515 'maxNum', Float32x4MaxNumJS,
516 'lessThan', Float32x4LessThanJS,
517 'lessThanOrEqual', Float32x4LessThanOrEqualJS,
518 'greaterThan', Float32x4GreaterThanJS,
519 'greaterThanOrEqual', Float32x4GreaterThanOrEqualJS,
520 'equal', Float32x4EqualJS,
521 'notEqual', Float32x4NotEqualJS,
522 'select', Float32x4SelectJS,
523 'swizzle', Float32x4SwizzleJS,
524 'shuffle', Float32x4ShuffleJS,
525 'fromInt32x4', Float32x4FromInt32x4JS,
526 'fromInt32x4Bits', Float32x4FromInt32x4BitsJS,
527 'fromInt16x8Bits', Float32x4FromInt16x8BitsJS,
528 'fromInt8x16Bits', Float32x4FromInt8x16BitsJS,
241 ]); 529 ]);
242 530
243 utils.InstallFunctions(GlobalInt32x4, DONT_ENUM, [ 531 utils.InstallFunctions(GlobalInt32x4, DONT_ENUM, [
244 'splat', Int32x4Splat, 532 'splat', Int32x4Splat,
245 'check', Int32x4CheckJS, 533 'check', Int32x4CheckJS,
246 'extractLane', Int32x4ExtractLaneJS, 534 'extractLane', Int32x4ExtractLaneJS,
247 'replaceLane', Int32x4ReplaceLaneJS, 535 'replaceLane', Int32x4ReplaceLaneJS,
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 'add', Int16x8AddJS,
588 'sub', Int16x8SubJS,
589 'mul', Int16x8MulJS,
590 'min', Int16x8MinJS,
591 'max', Int16x8MaxJS,
592 'and', Int16x8AndJS,
593 'or', Int16x8OrJS,
594 'xor', Int16x8XorJS,
595 'not', Int16x8NotJS,
596 'shiftLeftByScalar', Int16x8ShiftLeftByScalarJS,
597 'shiftRightLogicalByScalar', Int16x8ShiftRightLogicalByScalarJS,
598 'shiftRightArithmeticByScalar', Int16x8ShiftRightArithmeticByScalarJS,
599 'lessThan', Int16x8LessThanJS,
600 'lessThanOrEqual', Int16x8LessThanOrEqualJS,
601 'greaterThan', Int16x8GreaterThanJS,
602 'greaterThanOrEqual', Int16x8GreaterThanOrEqualJS,
603 'equal', Int16x8EqualJS,
604 'notEqual', Int16x8NotEqualJS,
605 'select', Int16x8SelectJS,
606 'swizzle', Int16x8SwizzleJS,
607 'shuffle', Int16x8ShuffleJS,
608 'fromFloat32x4Bits', Int16x8FromFloat32x4BitsJS,
609 'fromInt32x4Bits', Int16x8FromInt32x4BitsJS,
610 'fromInt8x16Bits', Int16x8FromInt8x16BitsJS,
263 ]); 611 ]);
264 612
265 utils.InstallFunctions(GlobalBool16x8, DONT_ENUM, [ 613 utils.InstallFunctions(GlobalBool16x8, DONT_ENUM, [
266 'splat', Bool16x8Splat, 614 'splat', Bool16x8Splat,
267 'check', Bool16x8CheckJS, 615 'check', Bool16x8CheckJS,
268 'extractLane', Bool16x8ExtractLaneJS, 616 'extractLane', Bool16x8ExtractLaneJS,
269 'replaceLane', Bool16x8ReplaceLaneJS, 617 'replaceLane', Bool16x8ReplaceLaneJS,
618 'and', Bool16x8AndJS,
619 'or', Bool16x8OrJS,
620 'xor', Bool16x8XorJS,
621 'not', Bool16x8NotJS,
622 'anyTrue', Bool16x8AnyTrueJS,
623 'allTrue', Bool16x8AllTrueJS,
624 'equal', Bool16x8EqualJS,
625 'notEqual', Bool16x8NotEqualJS,
626 'select', Bool16x8SelectJS,
627 'swizzle', Bool16x8SwizzleJS,
628 'shuffle', Bool16x8ShuffleJS,
270 ]); 629 ]);
271 630
272 utils.InstallFunctions(GlobalInt8x16, DONT_ENUM, [ 631 utils.InstallFunctions(GlobalInt8x16, DONT_ENUM, [
273 'splat', Int8x16Splat, 632 'splat', Int8x16Splat,
274 'check', Int8x16CheckJS, 633 'check', Int8x16CheckJS,
275 'extractLane', Int8x16ExtractLaneJS, 634 'extractLane', Int8x16ExtractLaneJS,
276 'unsignedExtractLane', Int8x16UnsignedExtractLaneJS, 635 'unsignedExtractLane', Int8x16UnsignedExtractLaneJS,
277 'replaceLane', Int8x16ReplaceLaneJS, 636 'replaceLane', Int8x16ReplaceLaneJS,
637 'add', Int8x16AddJS,
638 'sub', Int8x16SubJS,
639 'mul', Int8x16MulJS,
640 'min', Int8x16MinJS,
641 'max', Int8x16MaxJS,
642 'and', Int8x16AndJS,
643 'or', Int8x16OrJS,
644 'xor', Int8x16XorJS,
645 'not', Int8x16NotJS,
646 'shiftLeftByScalar', Int8x16ShiftLeftByScalarJS,
647 'shiftRightLogicalByScalar', Int8x16ShiftRightLogicalByScalarJS,
648 'shiftRightArithmeticByScalar', Int8x16ShiftRightArithmeticByScalarJS,
649 'lessThan', Int8x16LessThanJS,
650 'lessThanOrEqual', Int8x16LessThanOrEqualJS,
651 'greaterThan', Int8x16GreaterThanJS,
652 'greaterThanOrEqual', Int8x16GreaterThanOrEqualJS,
653 'equal', Int8x16EqualJS,
654 'notEqual', Int8x16NotEqualJS,
655 'select', Int8x16SelectJS,
656 'swizzle', Int8x16SwizzleJS,
657 'shuffle', Int8x16ShuffleJS,
658 'fromFloat32x4Bits', Int8x16FromFloat32x4BitsJS,
659 'fromInt32x4Bits', Int8x16FromInt32x4BitsJS,
660 'fromInt16x8Bits', Int8x16FromInt16x8BitsJS,
278 ]); 661 ]);
279 662
280 utils.InstallFunctions(GlobalBool8x16, DONT_ENUM, [ 663 utils.InstallFunctions(GlobalBool8x16, DONT_ENUM, [
281 'splat', Bool8x16Splat, 664 'splat', Bool8x16Splat,
282 'check', Bool8x16CheckJS, 665 'check', Bool8x16CheckJS,
283 'extractLane', Bool8x16ExtractLaneJS, 666 'extractLane', Bool8x16ExtractLaneJS,
284 'replaceLane', Bool8x16ReplaceLaneJS, 667 'replaceLane', Bool8x16ReplaceLaneJS,
668 'and', Bool8x16AndJS,
669 'or', Bool8x16OrJS,
670 'xor', Bool8x16XorJS,
671 'not', Bool8x16NotJS,
672 'anyTrue', Bool8x16AnyTrueJS,
673 'allTrue', Bool8x16AllTrueJS,
674 'equal', Bool8x16EqualJS,
675 'notEqual', Bool8x16NotEqualJS,
676 'select', Bool8x16SelectJS,
677 'swizzle', Bool8x16SwizzleJS,
678 'shuffle', Bool8x16ShuffleJS,
285 ]); 679 ]);
286 680
681 $float32x4ToString = Float32x4ToString;
682 $int32x4ToString = Int32x4ToString;
683 $bool32x4ToString = Bool32x4ToString;
684 $int16x8ToString = Int16x8ToString;
685 $bool16x8ToString = Bool16x8ToString;
686 $int8x16ToString = Int8x16ToString;
687 $bool8x16ToString = Bool8x16ToString;
688
287 }) 689 })
OLDNEW
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | src/heap/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698