| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 function create0() { | 172 function create0() { |
| 173 return Array(); | 173 return Array(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 create0(); | 176 create0(); |
| 177 create0(); | 177 create0(); |
| 178 a = create0(); | 178 a = create0(); |
| 179 a[0] = 3.5; | 179 a[0] = 3.5; |
| 180 %OptimizeFunctionOnNextCall(create0); | 180 %OptimizeFunctionOnNextCall(create0); |
| 181 create0(); | 181 create0(); |
| 182 create0(); | 182 // This test only makes sense if crankshaft is allowed |
| 183 b = create0(); | 183 if (4 != %GetOptimizationStatus(create0)) { |
| 184 assertKind(elements_kind.fast_smi_only, b); | 184 create0(); |
| 185 b[0] = 3.5; | 185 b = create0(); |
| 186 c = create0(); | 186 assertKind(elements_kind.fast_smi_only, b); |
| 187 assertKind(elements_kind.fast_double, c); | 187 b[0] = 3.5; |
| 188 assertTrue(2 != %GetOptimizationStatus(create0)); | 188 c = create0(); |
| 189 assertKind(elements_kind.fast_double, c); |
| 190 assertTrue(2 != %GetOptimizationStatus(create0)); |
| 191 } |
| 189 })(); | 192 })(); |
| 190 | 193 |
| 191 | 194 |
| 192 // Verify that cross context calls work | 195 // Verify that cross context calls work |
| 193 (function (){ | 196 (function (){ |
| 194 var realmA = Realm.current(); | 197 var realmA = Realm.current(); |
| 195 var realmB = Realm.create(); | 198 var realmB = Realm.create(); |
| 196 assertEquals(0, realmA); | 199 assertEquals(0, realmA); |
| 197 assertEquals(1, realmB); | 200 assertEquals(1, realmB); |
| 198 | 201 |
| 199 function instanceof_check(type) { | 202 function instanceof_check(type) { |
| 200 assertTrue(type() instanceof type); | 203 assertTrue(type() instanceof type); |
| 201 assertTrue(type(5) instanceof type); | 204 assertTrue(type(5) instanceof type); |
| 202 assertTrue(type(1,2,3) instanceof type); | 205 assertTrue(type(1,2,3) instanceof type); |
| 203 } | 206 } |
| 204 | 207 |
| 205 var realmBArray = Realm.eval(realmB, "Array"); | 208 var realmBArray = Realm.eval(realmB, "Array"); |
| 206 instanceof_check(Array); | 209 instanceof_check(Array); |
| 207 instanceof_check(Array); | 210 instanceof_check(Array); |
| 208 instanceof_check(Array); | 211 instanceof_check(Array); |
| 209 instanceof_check(realmBArray); | 212 instanceof_check(realmBArray); |
| 210 instanceof_check(realmBArray); | 213 instanceof_check(realmBArray); |
| 211 instanceof_check(realmBArray); | 214 instanceof_check(realmBArray); |
| 212 })(); | 215 })(); |
| 213 } | 216 } |
| OLD | NEW |