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

Unified Diff: test/mjsunit/large-object-literal.js

Issue 17308: Allocate as many object-literal properties as possible inobject.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 11 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
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/object-literal-gc.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/large-object-literal.js
===================================================================
--- test/mjsunit/large-object-literal.js (revision 1049)
+++ test/mjsunit/large-object-literal.js (working copy)
@@ -25,25 +25,32 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Make sure that we can create large object literals.
-var nofProperties = 150;
+// Test that we can create object literals of various sizes.
+function testLiteral(size) {
-// Build large object literal string.
-var literal = "var o = { ";
+ // Build object-literal string.
+ var literal = "var o = { ";
-for (var i = 0; i < nofProperties; i++) {
- if (i > 0) literal += ",";
- literal += ("a" + i + ":" + i);
+ for (var i = 0; i < size; i++) {
+ if (i > 0) literal += ",";
+ literal += ("a" + i + ":" + i);
+ }
+ literal += "}";
+
+ // Create the object literal.
+ eval(literal);
+
+ // Check that the properties have the expected values.
+ for (var i = 0; i < size; i++) {
+ assertEquals(i, o["a"+i]);
+ }
}
-literal += "}";
+// The sizes to test.
+var sizes = [0, 1, 2, 100, 200, 400, 1000];
-// Create the large object literal
-eval(literal);
-
-// Check that the properties have the expected values.
-for (var i = 0; i < nofProperties; i++) {
- assertEquals(o["a"+i], i);
+// Run the test.
+for (var i = 0; i < sizes.length; i++) {
+ testLiteral(sizes[i]);
}
-
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/object-literal-gc.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698