| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } | 146 } |
| 147 a = bar(10); | 147 a = bar(10); |
| 148 a[0] = "a string"; | 148 a[0] = "a string"; |
| 149 a = bar(10); | 149 a = bar(10); |
| 150 assertKind(elements_kind.fast, a); | 150 assertKind(elements_kind.fast, a); |
| 151 %OptimizeFunctionOnNextCall(bar); | 151 %OptimizeFunctionOnNextCall(bar); |
| 152 a = bar(10); | 152 a = bar(10); |
| 153 assertKind(elements_kind.fast, a); | 153 assertKind(elements_kind.fast, a); |
| 154 assertOptimized(bar); | 154 assertOptimized(bar); |
| 155 // The stub bails out, but the method call should be fine. | 155 // The stub bails out, but the method call should be fine. |
| 156 a = bar(100000); | 156 a = bar(100001); |
| 157 assertOptimized(bar); | 157 assertOptimized(bar); |
| 158 assertKind(elements_kind.dictionary, a); | 158 assertKind(elements_kind.dictionary, a); |
| 159 | 159 |
| 160 // If the argument isn't a smi, it bails out as well | 160 // If the argument isn't a smi, it bails out as well |
| 161 a = bar("oops"); | 161 a = bar("oops"); |
| 162 assertOptimized(bar); | 162 assertOptimized(bar); |
| 163 assertKind(elements_kind.fast, a); | 163 assertKind(elements_kind.fast, a); |
| 164 | 164 |
| 165 function barn(one, two, three) { | 165 function barn(one, two, three) { |
| 166 return new Array(one, two, three); | 166 return new Array(one, two, three); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 213 |
| 214 var contextB = Realm.create(); | 214 var contextB = Realm.create(); |
| 215 Realm.eval(contextB, "function bar2() { return new Array(); };"); | 215 Realm.eval(contextB, "function bar2() { return new Array(); };"); |
| 216 Realm.eval(contextB, "bar2(); bar2();"); | 216 Realm.eval(contextB, "bar2(); bar2();"); |
| 217 Realm.eval(contextB, "%OptimizeFunctionOnNextCall(bar2);"); | 217 Realm.eval(contextB, "%OptimizeFunctionOnNextCall(bar2);"); |
| 218 Realm.eval(contextB, "bar2();"); | 218 Realm.eval(contextB, "bar2();"); |
| 219 assertFalse(Realm.eval(contextB, "bar2();") instanceof Array); | 219 assertFalse(Realm.eval(contextB, "bar2();") instanceof Array); |
| 220 assertTrue(Realm.eval(contextB, "bar2() instanceof Array")); | 220 assertTrue(Realm.eval(contextB, "bar2() instanceof Array")); |
| 221 })(); | 221 })(); |
| 222 } | 222 } |
| OLD | NEW |