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

Side by Side Diff: src/js/typedarray.js

Issue 2313073002: [builtins] Migrate Number predicates and make them optimizable. (Closed)
Patch Set: Created 4 years, 3 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/js/prologue.js ('k') | src/js/v8natives.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 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
(...skipping 16 matching lines...) Expand all
27 var InnerArrayFind; 27 var InnerArrayFind;
28 var InnerArrayFindIndex; 28 var InnerArrayFindIndex;
29 var InnerArrayForEach; 29 var InnerArrayForEach;
30 var InnerArrayJoin; 30 var InnerArrayJoin;
31 var InnerArrayReduce; 31 var InnerArrayReduce;
32 var InnerArrayReduceRight; 32 var InnerArrayReduceRight;
33 var InnerArraySome; 33 var InnerArraySome;
34 var InnerArraySort; 34 var InnerArraySort;
35 var InnerArrayToLocaleString; 35 var InnerArrayToLocaleString;
36 var InternalArray = utils.InternalArray; 36 var InternalArray = utils.InternalArray;
37 var IsNaN;
38 var MaxSimple; 37 var MaxSimple;
39 var MinSimple; 38 var MinSimple;
40 var PackedArrayReverse; 39 var PackedArrayReverse;
41 var SpeciesConstructor; 40 var SpeciesConstructor;
42 var ToPositiveInteger; 41 var ToPositiveInteger;
43 var ToIndex; 42 var ToIndex;
44 var iteratorSymbol = utils.ImportNow("iterator_symbol"); 43 var iteratorSymbol = utils.ImportNow("iterator_symbol");
45 var speciesSymbol = utils.ImportNow("species_symbol"); 44 var speciesSymbol = utils.ImportNow("species_symbol");
46 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); 45 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
47 46
(...skipping 28 matching lines...) Expand all
76 InnerArrayFilter = from.InnerArrayFilter; 75 InnerArrayFilter = from.InnerArrayFilter;
77 InnerArrayFind = from.InnerArrayFind; 76 InnerArrayFind = from.InnerArrayFind;
78 InnerArrayFindIndex = from.InnerArrayFindIndex; 77 InnerArrayFindIndex = from.InnerArrayFindIndex;
79 InnerArrayForEach = from.InnerArrayForEach; 78 InnerArrayForEach = from.InnerArrayForEach;
80 InnerArrayJoin = from.InnerArrayJoin; 79 InnerArrayJoin = from.InnerArrayJoin;
81 InnerArrayReduce = from.InnerArrayReduce; 80 InnerArrayReduce = from.InnerArrayReduce;
82 InnerArrayReduceRight = from.InnerArrayReduceRight; 81 InnerArrayReduceRight = from.InnerArrayReduceRight;
83 InnerArraySome = from.InnerArraySome; 82 InnerArraySome = from.InnerArraySome;
84 InnerArraySort = from.InnerArraySort; 83 InnerArraySort = from.InnerArraySort;
85 InnerArrayToLocaleString = from.InnerArrayToLocaleString; 84 InnerArrayToLocaleString = from.InnerArrayToLocaleString;
86 IsNaN = from.IsNaN;
87 MaxSimple = from.MaxSimple; 85 MaxSimple = from.MaxSimple;
88 MinSimple = from.MinSimple; 86 MinSimple = from.MinSimple;
89 PackedArrayReverse = from.PackedArrayReverse; 87 PackedArrayReverse = from.PackedArrayReverse;
90 SpeciesConstructor = from.SpeciesConstructor; 88 SpeciesConstructor = from.SpeciesConstructor;
91 ToPositiveInteger = from.ToPositiveInteger; 89 ToPositiveInteger = from.ToPositiveInteger;
92 ToIndex = from.ToIndex; 90 ToIndex = from.ToIndex;
93 }); 91 });
94 92
95 // --------------- Typed Arrays --------------------- 93 // --------------- Typed Arrays ---------------------
96 94
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 535
538 function TypedArrayComparefn(x, y) { 536 function TypedArrayComparefn(x, y) {
539 if (x === 0 && x === y) { 537 if (x === 0 && x === y) {
540 x = 1 / x; 538 x = 1 / x;
541 y = 1 / y; 539 y = 1 / y;
542 } 540 }
543 if (x < y) { 541 if (x < y) {
544 return -1; 542 return -1;
545 } else if (x > y) { 543 } else if (x > y) {
546 return 1; 544 return 1;
547 } else if (IsNaN(x) && IsNaN(y)) { 545 } else if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) {
548 return IsNaN(y) ? 0 : 1; 546 return NUMBER_IS_NAN(y) ? 0 : 1;
549 } else if (IsNaN(x)) { 547 } else if (NUMBER_IS_NAN(x)) {
550 return 1; 548 return 1;
551 } 549 }
552 return 0; 550 return 0;
553 } 551 }
554 552
555 553
556 // ES6 draft 05-18-15, section 22.2.3.25 554 // ES6 draft 05-18-15, section 22.2.3.25
557 function TypedArraySort(comparefn) { 555 function TypedArraySort(comparefn) {
558 if (!IS_TYPEDARRAY(this)) throw %make_type_error(kNotTypedArray); 556 if (!IS_TYPEDARRAY(this)) throw %make_type_error(kNotTypedArray);
559 557
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 %AddNamedProperty(GlobalNAME.prototype, 906 %AddNamedProperty(GlobalNAME.prototype,
909 "constructor", global.NAME, DONT_ENUM); 907 "constructor", global.NAME, DONT_ENUM);
910 %AddNamedProperty(GlobalNAME.prototype, 908 %AddNamedProperty(GlobalNAME.prototype,
911 "BYTES_PER_ELEMENT", ELEMENT_SIZE, 909 "BYTES_PER_ELEMENT", ELEMENT_SIZE,
912 READ_ONLY | DONT_ENUM | DONT_DELETE); 910 READ_ONLY | DONT_ENUM | DONT_DELETE);
913 endmacro 911 endmacro
914 912
915 TYPED_ARRAYS(SETUP_TYPED_ARRAY) 913 TYPED_ARRAYS(SETUP_TYPED_ARRAY)
916 914
917 }) 915 })
OLDNEW
« no previous file with comments | « src/js/prologue.js ('k') | src/js/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698