OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
11 // ------------------------------------------------------------------- | 11 // ------------------------------------------------------------------- |
12 // Imports | 12 // Imports |
13 | 13 |
| 14 var ArrayFrom; |
| 15 var ArrayToString; |
14 var ArrayValues; | 16 var ArrayValues; |
15 var GlobalArray = global.Array; | 17 var GlobalArray = global.Array; |
16 var GlobalArrayBuffer = global.ArrayBuffer; | 18 var GlobalArrayBuffer = global.ArrayBuffer; |
17 var GlobalDataView = global.DataView; | 19 var GlobalDataView = global.DataView; |
18 var GlobalObject = global.Object; | 20 var GlobalObject = global.Object; |
| 21 var InnerArrayCopyWithin; |
| 22 var InnerArrayEvery; |
| 23 var InnerArrayFill; |
| 24 var InnerArrayFilter; |
| 25 var InnerArrayFind; |
| 26 var InnerArrayFindIndex; |
| 27 var InnerArrayForEach; |
| 28 var InnerArrayIndexOf; |
| 29 var InnerArrayJoin; |
| 30 var InnerArrayLastIndexOf; |
| 31 var InnerArrayMap; |
| 32 var InnerArrayReduce; |
| 33 var InnerArrayReduceRight; |
| 34 var InnerArraySome; |
| 35 var InnerArraySort; |
| 36 var InnerArrayToLocaleString; |
19 var InternalArray = utils.InternalArray; | 37 var InternalArray = utils.InternalArray; |
20 var iteratorSymbol = utils.ImportNow("iterator_symbol"); | 38 var IsNaN; |
21 var MakeRangeError; | 39 var MakeRangeError; |
22 var MakeTypeError; | 40 var MakeTypeError; |
23 var MaxSimple; | 41 var MaxSimple; |
24 var MinSimple; | 42 var MinSimple; |
| 43 var PackedArrayReverse; |
25 var ToPositiveInteger; | 44 var ToPositiveInteger; |
| 45 var iteratorSymbol = utils.ImportNow("iterator_symbol"); |
26 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); | 46 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); |
27 | 47 |
28 macro TYPED_ARRAYS(FUNCTION) | 48 macro TYPED_ARRAYS(FUNCTION) |
29 // arrayIds below should be synchronized with Runtime_TypedArrayInitialize. | 49 // arrayIds below should be synchronized with Runtime_TypedArrayInitialize. |
30 FUNCTION(1, Uint8Array, 1) | 50 FUNCTION(1, Uint8Array, 1) |
31 FUNCTION(2, Int8Array, 1) | 51 FUNCTION(2, Int8Array, 1) |
32 FUNCTION(3, Uint16Array, 2) | 52 FUNCTION(3, Uint16Array, 2) |
33 FUNCTION(4, Int16Array, 2) | 53 FUNCTION(4, Int16Array, 2) |
34 FUNCTION(5, Uint32Array, 4) | 54 FUNCTION(5, Uint32Array, 4) |
35 FUNCTION(6, Int32Array, 4) | 55 FUNCTION(6, Int32Array, 4) |
36 FUNCTION(7, Float32Array, 4) | 56 FUNCTION(7, Float32Array, 4) |
37 FUNCTION(8, Float64Array, 8) | 57 FUNCTION(8, Float64Array, 8) |
38 FUNCTION(9, Uint8ClampedArray, 1) | 58 FUNCTION(9, Uint8ClampedArray, 1) |
39 endmacro | 59 endmacro |
40 | 60 |
41 macro DECLARE_GLOBALS(INDEX, NAME, SIZE) | 61 macro DECLARE_GLOBALS(INDEX, NAME, SIZE) |
42 var GlobalNAME = global.NAME; | 62 var GlobalNAME = global.NAME; |
43 endmacro | 63 endmacro |
44 | 64 |
45 TYPED_ARRAYS(DECLARE_GLOBALS) | 65 TYPED_ARRAYS(DECLARE_GLOBALS) |
46 | 66 |
47 utils.Import(function(from) { | 67 utils.Import(function(from) { |
| 68 ArrayFrom = from.ArrayFrom; |
| 69 ArrayToString = from.ArrayToString; |
48 ArrayValues = from.ArrayValues; | 70 ArrayValues = from.ArrayValues; |
| 71 InnerArrayCopyWithin = from.InnerArrayCopyWithin; |
| 72 InnerArrayEvery = from.InnerArrayEvery; |
| 73 InnerArrayFill = from.InnerArrayFill; |
| 74 InnerArrayFilter = from.InnerArrayFilter; |
| 75 InnerArrayFind = from.InnerArrayFind; |
| 76 InnerArrayFindIndex = from.InnerArrayFindIndex; |
| 77 InnerArrayForEach = from.InnerArrayForEach; |
| 78 InnerArrayIndexOf = from.InnerArrayIndexOf; |
| 79 InnerArrayJoin = from.InnerArrayJoin; |
| 80 InnerArrayLastIndexOf = from.InnerArrayLastIndexOf; |
| 81 InnerArrayMap = from.InnerArrayMap; |
| 82 InnerArrayReduce = from.InnerArrayReduce; |
| 83 InnerArrayReduceRight = from.InnerArrayReduceRight; |
| 84 InnerArraySome = from.InnerArraySome; |
| 85 InnerArraySort = from.InnerArraySort; |
| 86 InnerArrayToLocaleString = from.InnerArrayToLocaleString; |
| 87 IsNaN = from.IsNaN; |
49 MakeRangeError = from.MakeRangeError; | 88 MakeRangeError = from.MakeRangeError; |
50 MakeTypeError = from.MakeTypeError; | 89 MakeTypeError = from.MakeTypeError; |
| 90 MakeTypeError = from.MakeTypeError; |
| 91 MaxSimple = from.MaxSimple; |
51 MaxSimple = from.MaxSimple; | 92 MaxSimple = from.MaxSimple; |
52 MinSimple = from.MinSimple; | 93 MinSimple = from.MinSimple; |
| 94 MinSimple = from.MinSimple; |
| 95 PackedArrayReverse = from.PackedArrayReverse; |
53 ToPositiveInteger = from.ToPositiveInteger; | 96 ToPositiveInteger = from.ToPositiveInteger; |
54 }); | 97 }); |
55 | 98 |
56 // --------------- Typed Arrays --------------------- | 99 // --------------- Typed Arrays --------------------- |
57 | 100 |
58 macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE) | 101 macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE) |
59 function NAMEConstructByArrayBuffer(obj, buffer, byteOffset, length) { | 102 function NAMEConstructByArrayBuffer(obj, buffer, byteOffset, length) { |
60 if (!IS_UNDEFINED(byteOffset)) { | 103 if (!IS_UNDEFINED(byteOffset)) { |
61 byteOffset = ToPositiveInteger(byteOffset, kInvalidTypedArrayLength); | 104 byteOffset = ToPositiveInteger(byteOffset, kInvalidTypedArrayLength); |
62 } | 105 } |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 } | 393 } |
351 } | 394 } |
352 | 395 |
353 function TypedArrayGetToStringTag() { | 396 function TypedArrayGetToStringTag() { |
354 if (!%_IsTypedArray(this)) return; | 397 if (!%_IsTypedArray(this)) return; |
355 var name = %_ClassOf(this); | 398 var name = %_ClassOf(this); |
356 if (IS_UNDEFINED(name)) return; | 399 if (IS_UNDEFINED(name)) return; |
357 return name; | 400 return name; |
358 } | 401 } |
359 | 402 |
| 403 |
| 404 function ConstructTypedArray(constructor, arg) { |
| 405 // TODO(littledan): This is an approximation of the spec, which requires |
| 406 // that only real TypedArray classes should be accepted (22.2.2.1.1) |
| 407 if (!%IsConstructor(constructor) || IS_UNDEFINED(constructor.prototype) || |
| 408 !%HasOwnProperty(constructor.prototype, "BYTES_PER_ELEMENT")) { |
| 409 throw MakeTypeError(kNotTypedArray); |
| 410 } |
| 411 |
| 412 // TODO(littledan): The spec requires that, rather than directly calling |
| 413 // the constructor, a TypedArray is created with the proper proto and |
| 414 // underlying size and element size, and elements are put in one by one. |
| 415 // By contrast, this would allow subclasses to make a radically different |
| 416 // constructor with different semantics. |
| 417 return new constructor(arg); |
| 418 } |
| 419 |
| 420 |
| 421 function ConstructTypedArrayLike(typedArray, arg) { |
| 422 // TODO(littledan): The spec requires that we actuallly use |
| 423 // typedArray.constructor[Symbol.species] (bug v8:4093) |
| 424 // Also, it should default to the default constructor from |
| 425 // table 49 if typedArray.constructor doesn't exist. |
| 426 return ConstructTypedArray(typedArray.constructor, arg); |
| 427 } |
| 428 |
| 429 |
| 430 function TypedArrayCopyWithin(target, start, end) { |
| 431 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 432 |
| 433 var length = %_TypedArrayGetLength(this); |
| 434 |
| 435 // TODO(littledan): Replace with a memcpy for better performance |
| 436 return InnerArrayCopyWithin(target, start, end, this, length); |
| 437 } |
| 438 %FunctionSetLength(TypedArrayCopyWithin, 2); |
| 439 |
| 440 |
| 441 // ES6 draft 05-05-15, section 22.2.3.7 |
| 442 function TypedArrayEvery(f, receiver) { |
| 443 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 444 |
| 445 var length = %_TypedArrayGetLength(this); |
| 446 |
| 447 return InnerArrayEvery(f, receiver, this, length); |
| 448 } |
| 449 %FunctionSetLength(TypedArrayEvery, 1); |
| 450 |
| 451 |
| 452 // ES6 draft 08-24-14, section 22.2.3.12 |
| 453 function TypedArrayForEach(f, receiver) { |
| 454 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 455 |
| 456 var length = %_TypedArrayGetLength(this); |
| 457 |
| 458 InnerArrayForEach(f, receiver, this, length); |
| 459 } |
| 460 %FunctionSetLength(TypedArrayForEach, 1); |
| 461 |
| 462 |
| 463 // ES6 draft 04-05-14 section 22.2.3.8 |
| 464 function TypedArrayFill(value, start, end) { |
| 465 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 466 |
| 467 var length = %_TypedArrayGetLength(this); |
| 468 |
| 469 return InnerArrayFill(value, start, end, this, length); |
| 470 } |
| 471 %FunctionSetLength(TypedArrayFill, 1); |
| 472 |
| 473 |
| 474 // ES6 draft 07-15-13, section 22.2.3.9 |
| 475 function TypedArrayFilter(predicate, thisArg) { |
| 476 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 477 |
| 478 var length = %_TypedArrayGetLength(this); |
| 479 var array = InnerArrayFilter(predicate, thisArg, this, length); |
| 480 return ConstructTypedArrayLike(this, array); |
| 481 } |
| 482 %FunctionSetLength(TypedArrayFilter, 1); |
| 483 |
| 484 |
| 485 // ES6 draft 07-15-13, section 22.2.3.10 |
| 486 function TypedArrayFind(predicate, thisArg) { |
| 487 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 488 |
| 489 var length = %_TypedArrayGetLength(this); |
| 490 |
| 491 return InnerArrayFind(predicate, thisArg, this, length); |
| 492 } |
| 493 %FunctionSetLength(TypedArrayFind, 1); |
| 494 |
| 495 |
| 496 // ES6 draft 07-15-13, section 22.2.3.11 |
| 497 function TypedArrayFindIndex(predicate, thisArg) { |
| 498 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 499 |
| 500 var length = %_TypedArrayGetLength(this); |
| 501 |
| 502 return InnerArrayFindIndex(predicate, thisArg, this, length); |
| 503 } |
| 504 %FunctionSetLength(TypedArrayFindIndex, 1); |
| 505 |
| 506 |
| 507 // ES6 draft 05-18-15, section 22.2.3.21 |
| 508 function TypedArrayReverse() { |
| 509 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 510 |
| 511 var length = %_TypedArrayGetLength(this); |
| 512 |
| 513 return PackedArrayReverse(this, length); |
| 514 } |
| 515 |
| 516 |
| 517 function TypedArrayComparefn(x, y) { |
| 518 if (IsNaN(x) && IsNaN(y)) { |
| 519 return IsNaN(y) ? 0 : 1; |
| 520 } |
| 521 if (IsNaN(x)) { |
| 522 return 1; |
| 523 } |
| 524 if (x === 0 && x === y) { |
| 525 if (%_IsMinusZero(x)) { |
| 526 if (!%_IsMinusZero(y)) { |
| 527 return -1; |
| 528 } |
| 529 } else if (%_IsMinusZero(y)) { |
| 530 return 1; |
| 531 } |
| 532 } |
| 533 return x - y; |
| 534 } |
| 535 |
| 536 |
| 537 // ES6 draft 05-18-15, section 22.2.3.25 |
| 538 function TypedArraySort(comparefn) { |
| 539 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 540 |
| 541 var length = %_TypedArrayGetLength(this); |
| 542 |
| 543 if (IS_UNDEFINED(comparefn)) { |
| 544 comparefn = TypedArrayComparefn; |
| 545 } |
| 546 |
| 547 return InnerArraySort(this, length, comparefn); |
| 548 } |
| 549 |
| 550 |
| 551 // ES6 section 22.2.3.13 |
| 552 function TypedArrayIndexOf(element, index) { |
| 553 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 554 |
| 555 var length = %_TypedArrayGetLength(this); |
| 556 return InnerArrayIndexOf(this, element, index, length); |
| 557 } |
| 558 %FunctionSetLength(TypedArrayIndexOf, 1); |
| 559 |
| 560 |
| 561 // ES6 section 22.2.3.16 |
| 562 function TypedArrayLastIndexOf(element, index) { |
| 563 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 564 |
| 565 var length = %_TypedArrayGetLength(this); |
| 566 |
| 567 return InnerArrayLastIndexOf(this, element, index, length, |
| 568 %_ArgumentsLength()); |
| 569 } |
| 570 %FunctionSetLength(TypedArrayLastIndexOf, 1); |
| 571 |
| 572 |
| 573 // ES6 draft 07-15-13, section 22.2.3.18 |
| 574 function TypedArrayMap(predicate, thisArg) { |
| 575 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 576 |
| 577 // TODO(littledan): Preallocate rather than making an intermediate |
| 578 // InternalArray, for better performance. |
| 579 var length = %_TypedArrayGetLength(this); |
| 580 var array = InnerArrayMap(predicate, thisArg, this, length); |
| 581 return ConstructTypedArrayLike(this, array); |
| 582 } |
| 583 %FunctionSetLength(TypedArrayMap, 1); |
| 584 |
| 585 |
| 586 // ES6 draft 05-05-15, section 22.2.3.24 |
| 587 function TypedArraySome(f, receiver) { |
| 588 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 589 |
| 590 var length = %_TypedArrayGetLength(this); |
| 591 |
| 592 return InnerArraySome(f, receiver, this, length); |
| 593 } |
| 594 %FunctionSetLength(TypedArraySome, 1); |
| 595 |
| 596 |
| 597 // ES6 section 22.2.3.27 |
| 598 function TypedArrayToLocaleString() { |
| 599 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 600 |
| 601 var length = %_TypedArrayGetLength(this); |
| 602 |
| 603 return InnerArrayToLocaleString(this, length); |
| 604 } |
| 605 |
| 606 |
| 607 // ES6 section 22.2.3.28 |
| 608 function TypedArrayToString() { |
| 609 return %_Call(ArrayToString, this); |
| 610 } |
| 611 |
| 612 |
| 613 // ES6 section 22.2.3.14 |
| 614 function TypedArrayJoin(separator) { |
| 615 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 616 |
| 617 var length = %_TypedArrayGetLength(this); |
| 618 |
| 619 return InnerArrayJoin(separator, this, length); |
| 620 } |
| 621 |
| 622 |
| 623 // ES6 draft 07-15-13, section 22.2.3.19 |
| 624 function TypedArrayReduce(callback, current) { |
| 625 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 626 |
| 627 var length = %_TypedArrayGetLength(this); |
| 628 return InnerArrayReduce(callback, current, this, length, |
| 629 %_ArgumentsLength()); |
| 630 } |
| 631 %FunctionSetLength(TypedArrayReduce, 1); |
| 632 |
| 633 |
| 634 // ES6 draft 07-15-13, section 22.2.3.19 |
| 635 function TypedArrayReduceRight(callback, current) { |
| 636 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 637 |
| 638 var length = %_TypedArrayGetLength(this); |
| 639 return InnerArrayReduceRight(callback, current, this, length, |
| 640 %_ArgumentsLength()); |
| 641 } |
| 642 %FunctionSetLength(TypedArrayReduceRight, 1); |
| 643 |
| 644 |
| 645 function TypedArraySlice(start, end) { |
| 646 if (!%_IsTypedArray(this)) throw MakeTypeError(kNotTypedArray); |
| 647 var len = %_TypedArrayGetLength(this); |
| 648 |
| 649 var relativeStart = TO_INTEGER(start); |
| 650 |
| 651 var k; |
| 652 if (relativeStart < 0) { |
| 653 k = MaxSimple(len + relativeStart, 0); |
| 654 } else { |
| 655 k = MinSimple(relativeStart, len); |
| 656 } |
| 657 |
| 658 var relativeEnd; |
| 659 if (IS_UNDEFINED(end)) { |
| 660 relativeEnd = len; |
| 661 } else { |
| 662 relativeEnd = TO_INTEGER(end); |
| 663 } |
| 664 |
| 665 var final; |
| 666 if (relativeEnd < 0) { |
| 667 final = MaxSimple(len + relativeEnd, 0); |
| 668 } else { |
| 669 final = MinSimple(relativeEnd, len); |
| 670 } |
| 671 |
| 672 var count = MaxSimple(final - k, 0); |
| 673 var array = ConstructTypedArrayLike(this, count); |
| 674 // The code below is the 'then' branch; the 'else' branch species |
| 675 // a memcpy. Because V8 doesn't canonicalize NaN, the difference is |
| 676 // unobservable. |
| 677 var n = 0; |
| 678 while (k < final) { |
| 679 var kValue = this[k]; |
| 680 // TODO(littledan): The spec says to throw on an error in setting; |
| 681 // does this throw? |
| 682 array[n] = kValue; |
| 683 k++; |
| 684 n++; |
| 685 } |
| 686 return array; |
| 687 } |
| 688 |
| 689 |
| 690 // ES6 draft 08-24-14, section 22.2.2.2 |
| 691 function TypedArrayOf() { |
| 692 var length = %_ArgumentsLength(); |
| 693 var array = new this(length); |
| 694 for (var i = 0; i < length; i++) { |
| 695 array[i] = %_Arguments(i); |
| 696 } |
| 697 return array; |
| 698 } |
| 699 |
| 700 |
| 701 function TypedArrayFrom(source, mapfn, thisArg) { |
| 702 // TODO(littledan): Investigate if there is a receiver which could be |
| 703 // faster to accumulate on than Array, e.g., a TypedVector. |
| 704 var array = %_Call(ArrayFrom, GlobalArray, source, mapfn, thisArg); |
| 705 return ConstructTypedArray(this, array); |
| 706 } |
| 707 %FunctionSetLength(TypedArrayFrom, 1); |
| 708 |
360 // ------------------------------------------------------------------- | 709 // ------------------------------------------------------------------- |
361 | 710 |
| 711 // TODO(littledan): Fix the TypedArray proto chain (bug v8:4085). |
362 macro SETUP_TYPED_ARRAY(ARRAY_ID, NAME, ELEMENT_SIZE) | 712 macro SETUP_TYPED_ARRAY(ARRAY_ID, NAME, ELEMENT_SIZE) |
363 %SetCode(GlobalNAME, NAMEConstructor); | 713 %SetCode(GlobalNAME, NAMEConstructor); |
364 %FunctionSetPrototype(GlobalNAME, new GlobalObject()); | 714 %FunctionSetPrototype(GlobalNAME, new GlobalObject()); |
365 | 715 |
366 %AddNamedProperty(GlobalNAME, "BYTES_PER_ELEMENT", ELEMENT_SIZE, | 716 %AddNamedProperty(GlobalNAME, "BYTES_PER_ELEMENT", ELEMENT_SIZE, |
367 READ_ONLY | DONT_ENUM | DONT_DELETE); | 717 READ_ONLY | DONT_ENUM | DONT_DELETE); |
| 718 |
| 719 utils.InstallFunctions(GlobalNAME, DONT_ENUM | DONT_DELETE | READ_ONLY, [ |
| 720 "from", TypedArrayFrom, |
| 721 "of", TypedArrayOf |
| 722 ]); |
| 723 |
368 %AddNamedProperty(GlobalNAME.prototype, | 724 %AddNamedProperty(GlobalNAME.prototype, |
369 "constructor", global.NAME, DONT_ENUM); | 725 "constructor", global.NAME, DONT_ENUM); |
370 %AddNamedProperty(GlobalNAME.prototype, | 726 %AddNamedProperty(GlobalNAME.prototype, |
371 "BYTES_PER_ELEMENT", ELEMENT_SIZE, | 727 "BYTES_PER_ELEMENT", ELEMENT_SIZE, |
372 READ_ONLY | DONT_ENUM | DONT_DELETE); | 728 READ_ONLY | DONT_ENUM | DONT_DELETE); |
373 utils.InstallGetter(GlobalNAME.prototype, "buffer", NAME_GetBuffer); | 729 utils.InstallGetter(GlobalNAME.prototype, "buffer", NAME_GetBuffer); |
374 utils.InstallGetter(GlobalNAME.prototype, "byteOffset", NAME_GetByteOffset, | 730 utils.InstallGetter(GlobalNAME.prototype, "byteOffset", NAME_GetByteOffset, |
375 DONT_ENUM | DONT_DELETE); | 731 DONT_ENUM | DONT_DELETE); |
376 utils.InstallGetter(GlobalNAME.prototype, "byteLength", NAME_GetByteLength, | 732 utils.InstallGetter(GlobalNAME.prototype, "byteLength", NAME_GetByteLength, |
377 DONT_ENUM | DONT_DELETE); | 733 DONT_ENUM | DONT_DELETE); |
378 utils.InstallGetter(GlobalNAME.prototype, "length", NAME_GetLength, | 734 utils.InstallGetter(GlobalNAME.prototype, "length", NAME_GetLength, |
379 DONT_ENUM | DONT_DELETE); | 735 DONT_ENUM | DONT_DELETE); |
380 utils.InstallGetter(GlobalNAME.prototype, toStringTagSymbol, | 736 utils.InstallGetter(GlobalNAME.prototype, toStringTagSymbol, |
381 TypedArrayGetToStringTag); | 737 TypedArrayGetToStringTag); |
382 utils.InstallFunctions(GlobalNAME.prototype, DONT_ENUM, [ | 738 utils.InstallFunctions(GlobalNAME.prototype, DONT_ENUM, [ |
383 "subarray", NAMESubArray, | 739 "subarray", NAMESubArray, |
384 "set", TypedArraySet | 740 "set", TypedArraySet, |
| 741 "copyWithin", TypedArrayCopyWithin, |
| 742 "every", TypedArrayEvery, |
| 743 "fill", TypedArrayFill, |
| 744 "filter", TypedArrayFilter, |
| 745 "find", TypedArrayFind, |
| 746 "findIndex", TypedArrayFindIndex, |
| 747 "indexOf", TypedArrayIndexOf, |
| 748 "join", TypedArrayJoin, |
| 749 "lastIndexOf", TypedArrayLastIndexOf, |
| 750 "forEach", TypedArrayForEach, |
| 751 "map", TypedArrayMap, |
| 752 "reduce", TypedArrayReduce, |
| 753 "reduceRight", TypedArrayReduceRight, |
| 754 "reverse", TypedArrayReverse, |
| 755 "slice", TypedArraySlice, |
| 756 "some", TypedArraySome, |
| 757 "sort", TypedArraySort, |
| 758 "toString", TypedArrayToString, |
| 759 "toLocaleString", TypedArrayToLocaleString |
385 ]); | 760 ]); |
386 endmacro | 761 endmacro |
387 | 762 |
388 TYPED_ARRAYS(SETUP_TYPED_ARRAY) | 763 TYPED_ARRAYS(SETUP_TYPED_ARRAY) |
389 | 764 |
390 // --------------------------- DataView ----------------------------- | 765 // --------------------------- DataView ----------------------------- |
391 | 766 |
392 function DataViewConstructor(buffer, byteOffset, byteLength) { // length = 3 | 767 function DataViewConstructor(buffer, byteOffset, byteLength) { // length = 3 |
393 if (%_IsConstructCall()) { | 768 if (%_IsConstructCall()) { |
394 // TODO(binji): support SharedArrayBuffers? | 769 // TODO(binji): support SharedArrayBuffers? |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 "setUint32", DataViewSetUint32JS, | 887 "setUint32", DataViewSetUint32JS, |
513 | 888 |
514 "getFloat32", DataViewGetFloat32JS, | 889 "getFloat32", DataViewGetFloat32JS, |
515 "setFloat32", DataViewSetFloat32JS, | 890 "setFloat32", DataViewSetFloat32JS, |
516 | 891 |
517 "getFloat64", DataViewGetFloat64JS, | 892 "getFloat64", DataViewGetFloat64JS, |
518 "setFloat64", DataViewSetFloat64JS | 893 "setFloat64", DataViewSetFloat64JS |
519 ]); | 894 ]); |
520 | 895 |
521 }) | 896 }) |
OLD | NEW |