Chromium Code Reviews| Index: test/mjsunit/array-store-and-grow.js |
| diff --git a/test/mjsunit/array-store-and-grow.js b/test/mjsunit/array-store-and-grow.js |
| index 88f3db8f646ca93f12676ccd601d0a1372246bc5..53f6a1b17bcb7363d440739dcc3163dd3720ee76 100644 |
| --- a/test/mjsunit/array-store-and-grow.js |
| +++ b/test/mjsunit/array-store-and-grow.js |
| @@ -25,6 +25,8 @@ |
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| +// Flags: --allow-natives-syntax |
| + |
| // Verifies that the KeyedStoreIC correctly handles out-of-bounds stores |
| // to an array that grow it by a single element. Test functions are |
| // called twice to make sure that the IC is used, first call is handled |
| @@ -184,3 +186,49 @@ a = []; |
| array_store_1(a, 0, 0.5); |
| assertEquals(0.5, a[0]); |
| assertEquals(0.5, array_store_1([], 0, 0.5)); |
| + |
| +// Verify that a polymorphic store and grow IC when crankshafted is still |
| +// a grow IC (earlier it would revert to a standard store in the polymorphic |
| +// case. |
|
Jakob Kummerow
2013/07/31 09:43:00
nit: missing ')' after 'case'
mvstanton
2013/08/09 12:14:07
Done.
|
| +(function() { |
| + function f(o, k, v) { |
| + o[k] = v; |
| + } |
| + |
| + a = [3.5]; |
| + f(a, 1, "hi"); // DOUBLE packed array -> tagged packed grow |
| + a = {}; |
| + a.p = "property"; |
| + a[0] = 1; |
| + f(a, 0, 5.4); |
| + |
| + %OptimizeFunctionOnNextCall(f); |
| + // Should be a polymorphic grow stub. If not a grow stub it will deopt. |
| + f(new Array("hi"), 1, 3); |
| + assertOptimized(f); |
| + %ClearFunctionTypeFeedback(f); |
| +}()); |
|
Jakob Kummerow
2013/07/31 09:43:00
nit: AFAIK the outer parentheses aren't even neces
mvstanton
2013/08/09 12:14:07
Done.
|
| + |
| + |
| +// Now verify that a polymorphic store (non-growing) IC when crankshafted WILL |
| +// deopt if you pass an element out of bounds |
|
Jakob Kummerow
2013/07/31 09:43:00
nit: trailing full stop
mvstanton
2013/08/09 12:14:07
Done.
|
| +(function() { |
| + function f(o, k, v) { |
| + o[k] = v; |
| + } |
| + |
| + a = [3.5]; |
| + f(a, 0, "hi"); // DOUBLE packed array -> tagged packed grow |
| + a = {}; |
| + a.p = "property"; |
| + a[0] = 1; |
| + f(a, 0, 5.4); |
| + |
| + %OptimizeFunctionOnNextCall(f); |
| + f(new Array("hi"), 0, 3); |
| + assertOptimized(f); |
| + // An attempt to grow should cause deopt |
| + f(new Array("hi"), 1, 3); |
| + assertUnoptimized(f); |
| + %ClearFunctionTypeFeedback(f); |
| +}()); |