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

Unified Diff: test/mjsunit/element-kind.js

Issue 7901016: Basic support for tracking smi-only arrays on ia32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: deactivate by default Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
« test/cctest/test-heap.cc ('K') | « test/cctest/test-heap.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/element-kind.js
diff --git a/test/mjsunit/element-kind.js b/test/mjsunit/element-kind.js
index 48a029f27e8852eb4dde4d57ec4ffa8c0680e501..40eca6173bc49e3cb83f3efd58815fbf15222fcc 100644
--- a/test/mjsunit/element-kind.js
+++ b/test/mjsunit/element-kind.js
@@ -25,10 +25,11 @@
// (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
+// Flags: --allow-natives-syntax --smi-only-arrays
// Test element kind of objects
var element_kind = {
+ fast_smi_only_elements : 0,
fast_elements : 1,
fast_double_elements : 2,
dictionary_elements : 3,
@@ -45,6 +46,8 @@ var element_kind = {
// We expect an object to only be of one element kind.
function assertKind(expected, obj){
+ assertEquals(expected == element_kind.fast_smi_only_elements,
+ %HasFastSmiOnlyElements(obj));
assertEquals(expected == element_kind.fast_elements,
%HasFastElements(obj));
assertEquals(expected == element_kind.fast_double_elements,
@@ -80,9 +83,21 @@ me.dance = 0xD15C0;
me.drink = 0xC0C0A;
assertKind(element_kind.fast_elements, me);
+var too = [1,2,3];
+assertKind(element_kind.fast_elements, too);
Jakob Kummerow 2011/09/16 16:30:34 Why fast_elements? Don't all arrays start off with
danno 2011/09/21 14:32:04 Done.
+too.dance = 0xD15C0;
+too.drink = 0xC0C0A;
+assertKind(element_kind.fast_elements, too);
+
+// Make sure the element kind transitions from smionly when a non-smi is stored.
var you = new Array();
for(i = 0; i < 1337; i++) {
- you[i] = i;
+ var val = i;
+ if (i == 1336) {
+ assertKind(element_kind.fast_smi_only_elements, you);
Yang 2011/09/19 14:00:15 This assert does not pass for me when using the ra
danno 2011/09/21 14:32:04 I just ran the test on my machine, and it works fo
+ val = new Object();
+ }
+ you[i] = val;
}
assertKind(element_kind.fast_elements, you);
« test/cctest/test-heap.cc ('K') | « test/cctest/test-heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698