OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 assertEquals(expected, fcc2(0x20)); | 96 assertEquals(expected, fcc2(0x20)); |
97 assertEquals(expected, fcc2(0x20 - 0x10000)); | 97 assertEquals(expected, fcc2(0x20 - 0x10000)); |
98 assertEquals(expected, fcc2(0x20 + 0.5)); | 98 assertEquals(expected, fcc2(0x20 + 0.5)); |
99 } | 99 } |
100 | 100 |
101 // Use loop to test the custom IC. | 101 // Use loop to test the custom IC. |
102 for (var i = 0; i < 10; i++) { | 102 for (var i = 0; i < 10; i++) { |
103 test(i); | 103 test(i); |
104 } | 104 } |
105 | 105 |
106 assertEquals("AAAA", String.fromCharCode(65, 65, 65, 65)); | |
107 assertEquals("AAAA", String.fromCharCode(65, 65, 65, 65)); | |
108 %OptimizeFunctionOnNextCall(String.fromCharCode); | |
109 assertEquals("AAAA", String.fromCharCode(65, 65, 65, 65)); | |
110 | |
111 // Test the custom IC works correctly when the map changes. | 106 // Test the custom IC works correctly when the map changes. |
112 for (var i = 0; i < 10; i++) { | 107 for (var i = 0; i < 10; i++) { |
113 var expected = (i < 5) ? " " : 42; | 108 var expected = (i < 5) ? " " : 42; |
114 if (i == 5) String.fromCharCode = function() { return 42; }; | 109 if (i == 5) String.fromCharCode = function() { return 42; }; |
115 assertEquals(expected, String.fromCharCode(0x20)); | 110 assertEquals(expected, String.fromCharCode(0x20)); |
116 } | 111 } |
OLD | NEW |