OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } else { | 55 } else { |
56 // The case where key is undefined also ends here. | 56 // The case where key is undefined also ends here. |
57 if (!IS_UNDEFINED(key)) { | 57 if (!IS_UNDEFINED(key)) { |
58 var e = array[key]; | 58 var e = array[key]; |
59 if (!IS_UNDEFINED(e) || key in array) { | 59 if (!IS_UNDEFINED(e) || key in array) { |
60 keys.push(key); | 60 keys.push(key); |
61 } | 61 } |
62 } | 62 } |
63 } | 63 } |
64 } | 64 } |
65 ArraySort.call(keys, function(a, b) { return a - b; }); | 65 %_CallFunction(keys, function(a, b) { return a - b; }, ArraySort); |
66 return keys; | 66 return keys; |
67 } | 67 } |
68 | 68 |
69 | 69 |
70 function SparseJoinWithSeparator(array, len, convert, separator) { | 70 function SparseJoinWithSeparator(array, len, convert, separator) { |
71 var keys = GetSortedArrayKeys(array, %GetArrayKeys(array, len)); | 71 var keys = GetSortedArrayKeys(array, %GetArrayKeys(array, len)); |
72 var totalLength = 0; | 72 var totalLength = 0; |
73 var elements = new InternalArray(keys.length * 2); | 73 var elements = new InternalArray(keys.length * 2); |
74 var previousKey = -1; | 74 var previousKey = -1; |
75 for (var i = 0; i < keys.length; i++) { | 75 for (var i = 0; i < keys.length; i++) { |
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 // exposed to user code. | 1549 // exposed to user code. |
1550 // Adding only the functions that are actually used. | 1550 // Adding only the functions that are actually used. |
1551 SetUpLockedPrototype(InternalArray, $Array(), $Array( | 1551 SetUpLockedPrototype(InternalArray, $Array(), $Array( |
1552 "join", getFunction("join", ArrayJoin), | 1552 "join", getFunction("join", ArrayJoin), |
1553 "pop", getFunction("pop", ArrayPop), | 1553 "pop", getFunction("pop", ArrayPop), |
1554 "push", getFunction("push", ArrayPush) | 1554 "push", getFunction("push", ArrayPush) |
1555 )); | 1555 )); |
1556 } | 1556 } |
1557 | 1557 |
1558 SetUpArray(); | 1558 SetUpArray(); |
OLD | NEW |