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

Side by Side Diff: test/cctest/test-serialize.cc

Issue 844006: Merge changes up to V8 version 2.1.3 into the partial snapshots (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: Created 10 years, 9 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 | « test/cctest/test-log.cc ('k') | test/cctest/test-thread-termination.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2010 the V8 project authors. All rights reserved. 1 // Copyright 2007-2010 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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 const int kSmallStringSize = 576 const int kSmallStringSize =
577 SeqAsciiString::kHeaderSize + kSmallStringLength; 577 SeqAsciiString::kHeaderSize + kSmallStringLength;
578 const int kMapSize = Map::kSize; 578 const int kMapSize = Map::kSize;
579 579
580 Object* new_last = NULL; 580 Object* new_last = NULL;
581 for (int i = 0; 581 for (int i = 0;
582 i + kSmallFixedArraySize <= new_space_size; 582 i + kSmallFixedArraySize <= new_space_size;
583 i += kSmallFixedArraySize) { 583 i += kSmallFixedArraySize) {
584 Object* obj = Heap::AllocateFixedArray(kSmallFixedArrayLength); 584 Object* obj = Heap::AllocateFixedArray(kSmallFixedArrayLength);
585 if (new_last != NULL) { 585 if (new_last != NULL) {
586 CHECK_EQ(reinterpret_cast<char*>(obj), 586 CHECK(reinterpret_cast<char*>(obj) ==
587 reinterpret_cast<char*>(new_last) + kSmallFixedArraySize); 587 reinterpret_cast<char*>(new_last) + kSmallFixedArraySize);
588 } 588 }
589 new_last = obj; 589 new_last = obj;
590 } 590 }
591 591
592 Object* pointer_last = NULL; 592 Object* pointer_last = NULL;
593 for (int i = 0; 593 for (int i = 0;
594 i + kSmallFixedArraySize <= size; 594 i + kSmallFixedArraySize <= size;
595 i += kSmallFixedArraySize) { 595 i += kSmallFixedArraySize) {
596 Object* obj = Heap::AllocateFixedArray(kSmallFixedArrayLength, TENURED); 596 Object* obj = Heap::AllocateFixedArray(kSmallFixedArrayLength, TENURED);
597 int old_page_fullness = i % Page::kPageSize; 597 int old_page_fullness = i % Page::kPageSize;
598 int page_fullness = (i + kSmallFixedArraySize) % Page::kPageSize; 598 int page_fullness = (i + kSmallFixedArraySize) % Page::kPageSize;
599 if (page_fullness < old_page_fullness || 599 if (page_fullness < old_page_fullness ||
600 page_fullness > Page::kObjectAreaSize) { 600 page_fullness > Page::kObjectAreaSize) {
601 i = RoundUp(i, Page::kPageSize); 601 i = RoundUp(i, Page::kPageSize);
602 pointer_last = NULL; 602 pointer_last = NULL;
603 } 603 }
604 if (pointer_last != NULL) { 604 if (pointer_last != NULL) {
605 CHECK_EQ(reinterpret_cast<char*>(obj), 605 CHECK(reinterpret_cast<char*>(obj) ==
606 reinterpret_cast<char*>(pointer_last) + kSmallFixedArraySize); 606 reinterpret_cast<char*>(pointer_last) + kSmallFixedArraySize);
607 } 607 }
608 pointer_last = obj; 608 pointer_last = obj;
609 } 609 }
610 610
611 Object* data_last = NULL; 611 Object* data_last = NULL;
612 for (int i = 0; i + kSmallStringSize <= size; i += kSmallStringSize) { 612 for (int i = 0; i + kSmallStringSize <= size; i += kSmallStringSize) {
613 Object* obj = Heap::AllocateRawAsciiString(kSmallStringLength, TENURED); 613 Object* obj = Heap::AllocateRawAsciiString(kSmallStringLength, TENURED);
614 int old_page_fullness = i % Page::kPageSize; 614 int old_page_fullness = i % Page::kPageSize;
615 int page_fullness = (i + kSmallStringSize) % Page::kPageSize; 615 int page_fullness = (i + kSmallStringSize) % Page::kPageSize;
616 if (page_fullness < old_page_fullness || 616 if (page_fullness < old_page_fullness ||
617 page_fullness > Page::kObjectAreaSize) { 617 page_fullness > Page::kObjectAreaSize) {
618 i = RoundUp(i, Page::kPageSize); 618 i = RoundUp(i, Page::kPageSize);
619 data_last = NULL; 619 data_last = NULL;
620 } 620 }
621 if (data_last != NULL) { 621 if (data_last != NULL) {
622 CHECK_EQ(reinterpret_cast<char*>(obj), 622 CHECK(reinterpret_cast<char*>(obj) ==
623 reinterpret_cast<char*>(data_last) + kSmallStringSize); 623 reinterpret_cast<char*>(data_last) + kSmallStringSize);
624 } 624 }
625 data_last = obj; 625 data_last = obj;
626 } 626 }
627 627
628 Object* map_last = NULL; 628 Object* map_last = NULL;
629 for (int i = 0; i + kMapSize <= size; i += kMapSize) { 629 for (int i = 0; i + kMapSize <= size; i += kMapSize) {
630 Object* obj = Heap::AllocateMap(JS_OBJECT_TYPE, 42 * kPointerSize); 630 Object* obj = Heap::AllocateMap(JS_OBJECT_TYPE, 42 * kPointerSize);
631 int old_page_fullness = i % Page::kPageSize; 631 int old_page_fullness = i % Page::kPageSize;
632 int page_fullness = (i + kMapSize) % Page::kPageSize; 632 int page_fullness = (i + kMapSize) % Page::kPageSize;
633 if (page_fullness < old_page_fullness || 633 if (page_fullness < old_page_fullness ||
634 page_fullness > Page::kObjectAreaSize) { 634 page_fullness > Page::kObjectAreaSize) {
635 i = RoundUp(i, Page::kPageSize); 635 i = RoundUp(i, Page::kPageSize);
636 map_last = NULL; 636 map_last = NULL;
637 } 637 }
638 if (map_last != NULL) { 638 if (map_last != NULL) {
639 CHECK_EQ(reinterpret_cast<char*>(obj), 639 CHECK(reinterpret_cast<char*>(obj) ==
640 reinterpret_cast<char*>(map_last) + kMapSize); 640 reinterpret_cast<char*>(map_last) + kMapSize);
641 } 641 }
642 map_last = obj; 642 map_last = obj;
643 } 643 }
644 644
645 if (size > Page::kObjectAreaSize) { 645 if (size > Page::kObjectAreaSize) {
646 // Support for reserving space in large object space is not there yet, 646 // Support for reserving space in large object space is not there yet,
647 // but using an always-allocate scope is fine for now. 647 // but using an always-allocate scope is fine for now.
648 AlwaysAllocateScope always; 648 AlwaysAllocateScope always;
649 int large_object_array_length = 649 int large_object_array_length =
650 (size - FixedArray::kHeaderSize) / kPointerSize; 650 (size - FixedArray::kHeaderSize) / kPointerSize;
(...skipping 12 matching lines...) Expand all
663 TEST(TestThatAlwaysFails) { 663 TEST(TestThatAlwaysFails) {
664 bool ArtificialFailure = false; 664 bool ArtificialFailure = false;
665 CHECK(ArtificialFailure); 665 CHECK(ArtificialFailure);
666 } 666 }
667 667
668 668
669 DEPENDENT_TEST(DependentTestThatAlwaysFails, TestThatAlwaysSucceeds) { 669 DEPENDENT_TEST(DependentTestThatAlwaysFails, TestThatAlwaysSucceeds) {
670 bool ArtificialFailure2 = false; 670 bool ArtificialFailure2 = false;
671 CHECK(ArtificialFailure2); 671 CHECK(ArtificialFailure2);
672 } 672 }
OLDNEW
« no previous file with comments | « test/cctest/test-log.cc ('k') | test/cctest/test-thread-termination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698