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

Side by Side Diff: test/mjsunit/unbox-double-arrays.js

Issue 7461018: Implement for..in for FastDoubleArrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback 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 | « src/objects.cc ('k') | 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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 assertTrue(%HasFastDoubleElements(large_array3)); 410 assertTrue(%HasFastDoubleElements(large_array3));
411 assertEquals(undefined, large_array3[100]); 411 assertEquals(undefined, large_array3[100]);
412 assertEquals(95, large_array3[95]); 412 assertEquals(95, large_array3[95]);
413 assertEquals(expected_array_value(5), large_array3[5]); 413 assertEquals(expected_array_value(5), large_array3[5]);
414 assertEquals(expected_array_value(6), large_array3[6]); 414 assertEquals(expected_array_value(6), large_array3[6]);
415 assertEquals(expected_array_value(7), large_array3[7]); 415 assertEquals(expected_array_value(7), large_array3[7]);
416 assertEquals(undefined, large_array3[large_array3.length-1]); 416 assertEquals(undefined, large_array3[large_array3.length-1]);
417 assertEquals(undefined, large_array3[large_array_size-1]); 417 assertEquals(undefined, large_array3[large_array_size-1]);
418 assertEquals(undefined, large_array3[-1]); 418 assertEquals(undefined, large_array3[-1]);
419 gc(); 419 gc();
420
421 // Test apply on arrays backed by double elements.
422 function called_by_apply(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
423 assertEquals(expected_array_value(0), arg0);
424 assertEquals(NaN, arg1);
425 assertEquals(-NaN, arg2);
426 assertEquals(Infinity, arg3);
427 assertEquals(-Infinity, arg4);
428 assertEquals(expected_array_value(5), arg5);
429 }
430
431 large_array3[1] = NaN;
432 large_array3[2] = -NaN;
433 large_array3[3] = Infinity;
434 large_array3[4] = -Infinity;
435
436 function call_apply() {
437 assertTrue(%HasFastDoubleElements(large_array3));
438 called_by_apply.apply({}, large_array3);
439 }
440
441 call_apply();
442 call_apply();
443 call_apply();
444 %OptimizeFunctionOnNextCall(call_apply);
445 call_apply();
446 call_apply();
447 call_apply();
448
449 function test_for_in() {
450 // Due to previous tests, keys 0..25 and 95 should be present.
451 next_expected = 0;
452 assertTrue(%HasFastDoubleElements(large_array3));
453 for (x in large_array3) {
454 assertTrue(next_expected++ == x);
455 if (next_expected == 25) {
456 next_expected = 95;
457 }
458 }
459 assertTrue(next_expected == 96);
460 }
461
462 test_for_in();
463 test_for_in();
464 test_for_in();
465 %OptimizeFunctionOnNextCall(test_for_in);
466 test_for_in();
467 test_for_in();
468 test_for_in();
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698