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

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: ready to land 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
« src/bootstrapper.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..1949857fd8b0214c9fc3d117725f629c59c63723 100644
--- a/test/mjsunit/element-kind.js
+++ b/test/mjsunit/element-kind.js
@@ -28,7 +28,10 @@
// Flags: --allow-natives-syntax
// Test element kind of objects
+support_smi_only_arrays = %HasFastSmiOnlyElements([]);
+
var element_kind = {
+ fast_smi_only_elements : 0,
fast_elements : 1,
fast_double_elements : 2,
dictionary_elements : 3,
@@ -45,8 +48,16 @@ var element_kind = {
// We expect an object to only be of one element kind.
function assertKind(expected, obj){
- assertEquals(expected == element_kind.fast_elements,
- %HasFastElements(obj));
+ if (support_smi_only_arrays) {
+ assertEquals(expected == element_kind.fast_smi_only_elements,
+ %HasFastSmiOnlyElements(obj));
+ assertEquals(expected == element_kind.fast_elements,
+ %HasFastElements(obj));
+ } else {
+ assertEquals(expected == element_kind.fast_elements ||
+ expected == element_kind.fast_smi_only_elements,
+ %HasFastElements(obj));
+ }
assertEquals(expected == element_kind.fast_double_elements,
%HasFastDoubleElements(obj));
assertEquals(expected == element_kind.dictionary_elements,
@@ -80,9 +91,22 @@ me.dance = 0xD15C0;
me.drink = 0xC0C0A;
assertKind(element_kind.fast_elements, me);
+var too = [1,2,3];
+assertKind(element_kind.fast_smi_only_elements, too);
+too.dance = 0xD15C0;
+too.drink = 0xC0C0A;
+assertKind(element_kind.fast_smi_only_elements, too);
+
+// Make sure the element kind transitions from smionly when a non-smi is stored.
var you = new Array();
+assertKind(element_kind.fast_smi_only_elements, you);
for(i = 0; i < 1337; i++) {
- you[i] = i;
+ var val = i;
+ if (i == 1336) {
+ assertKind(element_kind.fast_smi_only_elements, you);
+ val = new Object();
+ }
+ you[i] = val;
}
assertKind(element_kind.fast_elements, you);
« src/bootstrapper.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