Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: test/mjsunit/polymorph-arrays.js

Issue 7326009: Fix polymorphic array test (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 var object_array = new Object; 49 var object_array = new Object;
50 var sparse_object_array = new Object; 50 var sparse_object_array = new Object;
51 var js_array = new Array(10); 51 var js_array = new Array(10);
52 var sparse_js_array = new Array(5000001); 52 var sparse_js_array = new Array(5000001);
53 53
54 init_array(object_array); 54 init_array(object_array);
55 init_array(js_array); 55 init_array(js_array);
56 init_sparse_array(sparse_object_array); 56 init_sparse_array(sparse_object_array);
57 init_sparse_array(sparse_js_array); 57 init_sparse_array(sparse_js_array);
58 58
59 assertEquals(1, load(object_array, 1));
60 assertEquals(1, load(js_array, 1));
61 assertEquals(1, load(sparse_object_array, 1));
62 assertEquals(1, load(sparse_js_array, 1));
63
59 return load; 64 return load;
60 } 65 }
61 66
62 var object_array = new Object; 67 var object_array = new Object;
63 var sparse_object_array = new Object; 68 var sparse_object_array = new Object;
64 var js_array = new Array(10); 69 var js_array = new Array(10);
65 var sparse_js_array = new Array(5000001); 70 var sparse_js_array = new Array(5000001);
66 71
67 init_array(object_array); 72 init_array(object_array);
68 init_array(js_array); 73 init_array(js_array);
69 init_sparse_array(sparse_object_array); 74 init_sparse_array(sparse_object_array);
70 init_sparse_array(sparse_js_array); 75 init_sparse_array(sparse_js_array);
71 76
72 // load() should now use polymorphic element loads.
73 load = make_polymorphic_load_function();
74 assertEquals(1, load(object_array, 1));
75 load = make_polymorphic_load_function();
76 assertEquals(1, load(js_array, 1));
77 load = make_polymorphic_load_function();
78 assertEquals(1, load(sparse_object_array, 1));
79 load = make_polymorphic_load_function();
80 assertEquals(1, load(sparse_js_array, 1));
81
82 load = make_polymorphic_load_function(); 77 load = make_polymorphic_load_function();
83 assertEquals(undefined, load(js_array, new Object())); 78 assertEquals(undefined, load(js_array, new Object()));
84 load = make_polymorphic_load_function(); 79 load = make_polymorphic_load_function();
85 assertEquals(undefined, load(object_array, new Object())); 80 assertEquals(undefined, load(object_array, new Object()));
86 load = make_polymorphic_load_function(); 81 load = make_polymorphic_load_function();
87 assertEquals(undefined, load(sparse_js_array, new Object())); 82 assertEquals(undefined, load(sparse_js_array, new Object()));
88 load = make_polymorphic_load_function(); 83 load = make_polymorphic_load_function();
89 assertEquals(undefined, load(sparse_object_array, new Object())); 84 assertEquals(undefined, load(sparse_object_array, new Object()));
90 85
91 // Try with crankshaft. 86 // Try with crankshaft.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 store(sparse_js_array, 3, 258); 168 store(sparse_js_array, 3, 258);
174 169
175 assertEquals(258, object_array[3]); 170 assertEquals(258, object_array[3]);
176 assertEquals(258, js_array[3]); 171 assertEquals(258, js_array[3]);
177 assertEquals(258, sparse_js_array[3]); 172 assertEquals(258, sparse_js_array[3]);
178 assertEquals(258, sparse_object_array[3]); 173 assertEquals(258, sparse_object_array[3]);
179 } 174 }
180 175
181 testPolymorphicLoads(); 176 testPolymorphicLoads();
182 testPolymorphicStores(); 177 testPolymorphicStores();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698