Chromium Code Reviews| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 function F4() { | 73 function F4() { | 
| 74 F3(true, false); | 74 F3(true, false); | 
| 75 return F31(1); | 75 return F31(1); | 
| 76 } | 76 } | 
| 77 | 77 | 
| 78 F4(1); | 78 F4(1); | 
| 79 F4(1); | 79 F4(1); | 
| 80 F4(1); | 80 F4(1); | 
| 81 %OptimizeFunctionOnNextCall(F4); | 81 %OptimizeFunctionOnNextCall(F4); | 
| 82 F4(1); | 82 F4(1); | 
| 83 | |
| 84 | |
| 85 // Test correct adapation of arguments. | |
| 86 (function () { | |
| 87 "use strict"; // Strict mode prevents arguments object from shadowing paramet ers. | |
| 
 
Michael Starzinger
2012/03/20 17:48:41
Line is longer than 80 characters.
 
 | |
| 88 | |
| 89 function G2() { | |
| 90 assertArrayEquals([1,2], arguments); | |
| 91 } | |
| 92 | |
| 93 function G4() { | |
| 94 assertArrayEquals([1,2,3,4], arguments); | |
| 95 } | |
| 96 | |
| 97 function adapt2to4(a, b, c, d) { | |
| 98 G2.apply(this, arguments); | |
| 99 } | |
| 100 | |
| 101 function adapt4to2(a, b) { | |
| 102 G4.apply(this, arguments); | |
| 103 } | |
| 104 | |
| 105 function test_adaptation() { | |
| 106 adapt2to4(1, 2); | |
| 107 adapt4to2(1, 2, 3, 4); | |
| 108 } | |
| 109 | |
| 110 test_adaptation(); | |
| 111 test_adaptation(); | |
| 112 %OptimizeFunctionOnNextCall(test_adaptation); | |
| 113 test_adaptation(); | |
| 114 })(); | |
| OLD | NEW |