| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 var rand = Math.floor(Math.random() * (kArgObjects - i)); | 94 var rand = Math.floor(Math.random() * (kArgObjects - i)); |
| 95 argPool.splice(rand,1); | 95 argPool.splice(rand,1); |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 var current = type; | 98 var current = type; |
| 99 var hasMore = false; | 99 var hasMore = false; |
| 100 var argList = [ ]; | 100 var argList = [ ]; |
| 101 for (var i = 0; i < argc; i++) { | 101 for (var i = 0; i < argc; i++) { |
| 102 var index = current % numArguments; | 102 var index = current % numArguments; |
| 103 current = (current / numArguments) << 0; | 103 current = (current / numArguments) << 0; |
| 104 if (index != (numArguments - 1)) | 104 if (index != (numArguments - 1)) { |
| 105 hasMore = true; | 105 hasMore = true; |
| 106 } |
| 106 argList.push(argPool[index]); | 107 argList.push(argPool[index]); |
| 107 } | 108 } |
| 108 try { | 109 try { |
| 109 func.apply(void 0, argList); | 110 func.apply(void 0, argList); |
| 110 } catch (e) { | 111 } catch (e) { |
| 111 // we don't care what happens as long as we don't crash | 112 // we don't care what happens as long as we don't crash |
| 112 } | 113 } |
| 113 type++; | 114 type++; |
| 114 } | 115 } |
| 115 } | 116 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 var currentlyUncallable = { | 200 var currentlyUncallable = { |
| 200 // We need to find a way to test this without breaking the system. | 201 // We need to find a way to test this without breaking the system. |
| 201 "SystemBreak": true | 202 "SystemBreak": true |
| 202 }; | 203 }; |
| 203 | 204 |
| 204 function testNatives() { | 205 function testNatives() { |
| 205 var allNatives = %ListNatives(); | 206 var allNatives = %ListNatives(); |
| 206 for (var i = 0; i < allNatives.length; i++) { | 207 for (var i = 0; i < allNatives.length; i++) { |
| 207 var nativeInfo = allNatives[i]; | 208 var nativeInfo = allNatives[i]; |
| 208 var name = nativeInfo[0]; | 209 var name = nativeInfo[0]; |
| 209 if (name in knownProblems || name in currentlyUncallable) | 210 if (name in knownProblems || name in currentlyUncallable) { |
| 210 continue; | 211 continue; |
| 212 } |
| 211 print(name); | 213 print(name); |
| 212 var argc = nativeInfo[1]; | 214 var argc = nativeInfo[1]; |
| 213 testArgumentCount(name, argc); | 215 testArgumentCount(name, argc); |
| 214 testArgumentTypes(name, argc); | 216 testArgumentTypes(name, argc); |
| 215 } | 217 } |
| 216 } | 218 } |
| 217 | 219 |
| 218 testNatives(); | 220 testNatives(); |
| OLD | NEW |