Chromium Code Reviews| 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 keys.sort(function(a, b) { return a - b; }); | 65 ArraySort.call(keys, function(a, b) { return a - b; }); |
|
Vyacheslav Egorov (Google)
2012/10/19 12:11:51
What happens here if I overwrite Function.prototyp
| |
| 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 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1524 // exposed to user code. | 1524 // exposed to user code. |
| 1525 // Adding only the functions that are actually used. | 1525 // Adding only the functions that are actually used. |
| 1526 SetUpLockedPrototype(InternalArray, $Array(), $Array( | 1526 SetUpLockedPrototype(InternalArray, $Array(), $Array( |
| 1527 "join", getFunction("join", ArrayJoin), | 1527 "join", getFunction("join", ArrayJoin), |
| 1528 "pop", getFunction("pop", ArrayPop), | 1528 "pop", getFunction("pop", ArrayPop), |
| 1529 "push", getFunction("push", ArrayPush) | 1529 "push", getFunction("push", ArrayPush) |
| 1530 )); | 1530 )); |
| 1531 } | 1531 } |
| 1532 | 1532 |
| 1533 SetUpArray(); | 1533 SetUpArray(); |
| OLD | NEW |