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

Side by Side Diff: test/mjsunit/fuzz-natives.js

Issue 573056: Add fuzzing support for inline runtime functions (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-log-stack-tracer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 var kArgObjects = makeArguments().length; 50 var kArgObjects = makeArguments().length;
51 51
52 function makeFunction(name, argc) { 52 function makeFunction(name, argc) {
53 var args = []; 53 var args = [];
54 for (var i = 0; i < argc; i++) 54 for (var i = 0; i < argc; i++)
55 args.push("x" + i); 55 args.push("x" + i);
56 var argsStr = args.join(", "); 56 var argsStr = args.join(", ");
57 return new Function(args.join(", "), "return %" + name + "(" + argsStr + ");") ; 57 return new Function(args.join(", "), "return %" + name + "(" + argsStr + ");") ;
58 } 58 }
59 59
60 function testArgumentCount(name) { 60 function testArgumentCount(name, argc) {
61 for (var i = 0; i < 10; i++) { 61 for (var i = 0; i < 10; i++) {
62 var func = makeFunction(name, i); 62 var func = null;
63 try {
64 func = makeFunction(name, i);
65 } catch (e) {
66 if (e != "SyntaxError: illegal access") throw e;
67 }
68 if (func === null && i == argc) {
69 throw "unexpected exception";
70 }
63 var args = [ ]; 71 var args = [ ];
64 for (var j = 0; j < i; j++) 72 for (var j = 0; j < i; j++)
65 args.push(0); 73 args.push(0);
66 try { 74 try {
67 func.apply(void 0, args); 75 func.apply(void 0, args);
68 } catch (e) { 76 } catch (e) {
69 // we don't care what happens as long as we don't crash 77 // we don't care what happens as long as we don't crash
70 } 78 }
71 } 79 }
72 } 80 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 177
170 function testNatives() { 178 function testNatives() {
171 var allNatives = %ListNatives(); 179 var allNatives = %ListNatives();
172 for (var i = 0; i < allNatives.length; i++) { 180 for (var i = 0; i < allNatives.length; i++) {
173 var nativeInfo = allNatives[i]; 181 var nativeInfo = allNatives[i];
174 var name = nativeInfo[0]; 182 var name = nativeInfo[0];
175 if (name in knownProblems || name in currentlyUncallable) 183 if (name in knownProblems || name in currentlyUncallable)
176 continue; 184 continue;
177 print(name); 185 print(name);
178 var argc = nativeInfo[1]; 186 var argc = nativeInfo[1];
179 testArgumentCount(name); 187 testArgumentCount(name, argc);
180 testArgumentTypes(name, argc); 188 testArgumentTypes(name, argc);
181 } 189 }
182 } 190 }
183 191
184 testNatives(); 192 testNatives();
OLDNEW
« no previous file with comments | « test/cctest/test-log-stack-tracer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698