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

Unified Diff: test/mjsunit/elements-transition.js

Issue 8241003: Elements kind conversion in generated code (ia32). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Flag definition to default (false). Created 9 years, 2 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/mjsunit/elements-kind.js ('K') | « test/mjsunit/elements-kind.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/elements-transition.js
diff --git a/test/mjsunit/elements-transition.js b/test/mjsunit/elements-transition.js
new file mode 100644
index 0000000000000000000000000000000000000000..77c2aa2c8873f14332dc7641f0d97fd7d4b31c7b
--- /dev/null
+++ b/test/mjsunit/elements-transition.js
@@ -0,0 +1,71 @@
+// Copyright 2011 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (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 --smi-only-arrays
+
+function test(test_double, test_object, set) {
+ var length = 10000;
+ var you = new Array(length);
+ var me = new Array(length);
Jakob Kummerow 2011/10/13 09:15:59 As discussed, please add a comment explaining why
+
+ assertTrue(%HasFastSmiOnlyElements(you));
+ assertTrue(%HasFastSmiOnlyElements(me));
+ for (var i = 0; i < length; i++) {
+ if (i == (length*0.7 | 0) && test_double) {
+ set(you, i, 0.5);
+ set(me, i, 0.5);
+ assertTrue(%HasFastDoubleElements(you));
+ assertTrue(%HasFastDoubleElements(me));
+ } else if (i == (length*0.8 | 0) && test_object) {
+ set(you, i, 'object');
+ set(me, i, 'object');
+ assertTrue(%HasFastElements(you));
+ assertTrue(%HasFastElements(me));
+ } else {
+ set(you, i, 2*i);
+ set(me, i, 2*i);
+ }
+ }
+
+ for (var i = 0; i < length; i++) {
+ if (i == (length*0.7 | 0) && test_double) {
+ assertEquals(0.5, you[i]);
+ assertEquals(0.5, me[i]);
+ } else if (i == (length*0.8 | 0) && test_object) {
+ assertEquals('object', you[i]);
+ assertEquals('object', me[i]);
+ } else {
+ assertEquals(2*i, me[i]);
+ assertEquals(2*i, you[i]);
+ }
+ }
+}
+
+test(false, false, function(a,i,v){ a[i] = v; });
+test(true, false, function(a,i,v){ a[i] = v; });
+test(false, true, function(a,i,v){ a[i] = v; });
+test(true, true, function(a,i,v){ a[i] = v; });
« test/mjsunit/elements-kind.js ('K') | « test/mjsunit/elements-kind.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698