OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 assertTrue(%HaveSameMap(o6, o7)); | 92 assertTrue(%HaveSameMap(o6, o7)); |
93 // Smi, double, smi. | 93 // Smi, double, smi. |
94 o6.b = 1.5; | 94 o6.b = 1.5; |
95 assertFalse(%HaveSameMap(o6, o7)); | 95 assertFalse(%HaveSameMap(o6, o7)); |
96 // Smi, double, object. | 96 // Smi, double, object. |
97 o7.c = {}; | 97 o7.c = {}; |
98 assertFalse(%HaveSameMap(o6, o7)); | 98 assertFalse(%HaveSameMap(o6, o7)); |
99 // Smi, double, object. | 99 // Smi, double, object. |
100 o6.c = {}; | 100 o6.c = {}; |
101 assertTrue(%HaveSameMap(o6, o7)); | 101 assertTrue(%HaveSameMap(o6, o7)); |
| 102 |
| 103 function poly_load(o, b) { |
| 104 var v = o.field; |
| 105 if (b) { |
| 106 return v + 10; |
| 107 } |
| 108 return o; |
| 109 } |
| 110 |
| 111 var of1 = {a:0}; |
| 112 of1.field = {}; |
| 113 var of2 = {b:0}; |
| 114 of2.field = 10; |
| 115 |
| 116 poly_load(of1, false); |
| 117 poly_load(of1, false); |
| 118 poly_load(of2, true); |
| 119 %OptimizeFunctionOnNextCall(poly_load); |
| 120 assertEquals("[object Object]10", poly_load(of1, true)); |
OLD | NEW |