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

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

Issue 181543002: Eliminate extended mode, and other modes clean-up (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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-debug.cc ('k') | test/cctest/test-mark-compact.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 Handle<Smi> twenty_four(Smi::FromInt(24), isolate); 268 Handle<Smi> twenty_four(Smi::FromInt(24), isolate);
269 269
270 { 270 {
271 HandleScope inner_scope(isolate); 271 HandleScope inner_scope(isolate);
272 // Allocate a function and keep it in global object's property. 272 // Allocate a function and keep it in global object's property.
273 Handle<JSFunction> function = 273 Handle<JSFunction> function =
274 factory->NewFunction(name, factory->undefined_value()); 274 factory->NewFunction(name, factory->undefined_value());
275 Handle<Map> initial_map = 275 Handle<Map> initial_map =
276 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); 276 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
277 function->set_initial_map(*initial_map); 277 function->set_initial_map(*initial_map);
278 JSReceiver::SetProperty(global, name, function, NONE, kSloppyMode); 278 JSReceiver::SetProperty(global, name, function, NONE, SLOPPY);
279 // Allocate an object. Unrooted after leaving the scope. 279 // Allocate an object. Unrooted after leaving the scope.
280 Handle<JSObject> obj = factory->NewJSObject(function); 280 Handle<JSObject> obj = factory->NewJSObject(function);
281 JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kSloppyMode); 281 JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY);
282 JSReceiver::SetProperty(obj, prop_namex, twenty_four, NONE, kSloppyMode); 282 JSReceiver::SetProperty(obj, prop_namex, twenty_four, NONE, SLOPPY);
283 283
284 CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name)); 284 CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
285 CHECK_EQ(Smi::FromInt(24), obj->GetProperty(*prop_namex)); 285 CHECK_EQ(Smi::FromInt(24), obj->GetProperty(*prop_namex));
286 } 286 }
287 287
288 heap->CollectGarbage(NEW_SPACE); 288 heap->CollectGarbage(NEW_SPACE);
289 289
290 // Function should be alive. 290 // Function should be alive.
291 CHECK(JSReceiver::HasLocalProperty(global, name)); 291 CHECK(JSReceiver::HasLocalProperty(global, name));
292 // Check function is retained. 292 // Check function is retained.
293 Object* func_value = CcTest::i_isolate()->context()->global_object()-> 293 Object* func_value = CcTest::i_isolate()->context()->global_object()->
294 GetProperty(*name)->ToObjectChecked(); 294 GetProperty(*name)->ToObjectChecked();
295 CHECK(func_value->IsJSFunction()); 295 CHECK(func_value->IsJSFunction());
296 Handle<JSFunction> function(JSFunction::cast(func_value)); 296 Handle<JSFunction> function(JSFunction::cast(func_value));
297 297
298 { 298 {
299 HandleScope inner_scope(isolate); 299 HandleScope inner_scope(isolate);
300 // Allocate another object, make it reachable from global. 300 // Allocate another object, make it reachable from global.
301 Handle<JSObject> obj = factory->NewJSObject(function); 301 Handle<JSObject> obj = factory->NewJSObject(function);
302 JSReceiver::SetProperty(global, obj_name, obj, NONE, kSloppyMode); 302 JSReceiver::SetProperty(global, obj_name, obj, NONE, SLOPPY);
303 JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kSloppyMode); 303 JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY);
304 } 304 }
305 305
306 // After gc, it should survive. 306 // After gc, it should survive.
307 heap->CollectGarbage(NEW_SPACE); 307 heap->CollectGarbage(NEW_SPACE);
308 308
309 CHECK(JSReceiver::HasLocalProperty(global, obj_name)); 309 CHECK(JSReceiver::HasLocalProperty(global, obj_name));
310 CHECK(CcTest::i_isolate()->context()->global_object()-> 310 CHECK(CcTest::i_isolate()->context()->global_object()->
311 GetProperty(*obj_name)->ToObjectChecked()->IsJSObject()); 311 GetProperty(*obj_name)->ToObjectChecked()->IsJSObject());
312 Object* obj = CcTest::i_isolate()->context()->global_object()-> 312 Object* obj = CcTest::i_isolate()->context()->global_object()->
313 GetProperty(*obj_name)->ToObjectChecked(); 313 GetProperty(*obj_name)->ToObjectChecked();
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 factory->NewFunction(name, factory->undefined_value()); 628 factory->NewFunction(name, factory->undefined_value());
629 Handle<Map> initial_map = 629 Handle<Map> initial_map =
630 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); 630 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
631 function->set_initial_map(*initial_map); 631 function->set_initial_map(*initial_map);
632 632
633 Handle<Smi> twenty_three(Smi::FromInt(23), isolate); 633 Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
634 Handle<Smi> twenty_four(Smi::FromInt(24), isolate); 634 Handle<Smi> twenty_four(Smi::FromInt(24), isolate);
635 635
636 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot"); 636 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
637 Handle<JSObject> obj = factory->NewJSObject(function); 637 Handle<JSObject> obj = factory->NewJSObject(function);
638 JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kSloppyMode); 638 JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY);
639 CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name)); 639 CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
640 // Check that we can add properties to function objects. 640 // Check that we can add properties to function objects.
641 JSReceiver::SetProperty(function, prop_name, twenty_four, NONE, 641 JSReceiver::SetProperty(function, prop_name, twenty_four, NONE, SLOPPY);
642 kSloppyMode);
643 CHECK_EQ(Smi::FromInt(24), function->GetProperty(*prop_name)); 642 CHECK_EQ(Smi::FromInt(24), function->GetProperty(*prop_name));
644 } 643 }
645 644
646 645
647 TEST(ObjectProperties) { 646 TEST(ObjectProperties) {
648 CcTest::InitializeVM(); 647 CcTest::InitializeVM();
649 Isolate* isolate = CcTest::i_isolate(); 648 Isolate* isolate = CcTest::i_isolate();
650 Factory* factory = isolate->factory(); 649 Factory* factory = isolate->factory();
651 650
652 v8::HandleScope sc(CcTest::isolate()); 651 v8::HandleScope sc(CcTest::isolate());
653 String* object_string = String::cast(CcTest::heap()->Object_string()); 652 String* object_string = String::cast(CcTest::heap()->Object_string());
654 Object* raw_object = CcTest::i_isolate()->context()->global_object()-> 653 Object* raw_object = CcTest::i_isolate()->context()->global_object()->
655 GetProperty(object_string)->ToObjectChecked(); 654 GetProperty(object_string)->ToObjectChecked();
656 JSFunction* object_function = JSFunction::cast(raw_object); 655 JSFunction* object_function = JSFunction::cast(raw_object);
657 Handle<JSFunction> constructor(object_function); 656 Handle<JSFunction> constructor(object_function);
658 Handle<JSObject> obj = factory->NewJSObject(constructor); 657 Handle<JSObject> obj = factory->NewJSObject(constructor);
659 Handle<String> first = factory->InternalizeUtf8String("first"); 658 Handle<String> first = factory->InternalizeUtf8String("first");
660 Handle<String> second = factory->InternalizeUtf8String("second"); 659 Handle<String> second = factory->InternalizeUtf8String("second");
661 660
662 Handle<Smi> one(Smi::FromInt(1), isolate); 661 Handle<Smi> one(Smi::FromInt(1), isolate);
663 Handle<Smi> two(Smi::FromInt(2), isolate); 662 Handle<Smi> two(Smi::FromInt(2), isolate);
664 663
665 // check for empty 664 // check for empty
666 CHECK(!JSReceiver::HasLocalProperty(obj, first)); 665 CHECK(!JSReceiver::HasLocalProperty(obj, first));
667 666
668 // add first 667 // add first
669 JSReceiver::SetProperty(obj, first, one, NONE, kSloppyMode); 668 JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY);
670 CHECK(JSReceiver::HasLocalProperty(obj, first)); 669 CHECK(JSReceiver::HasLocalProperty(obj, first));
671 670
672 // delete first 671 // delete first
673 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION); 672 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION);
674 CHECK(!JSReceiver::HasLocalProperty(obj, first)); 673 CHECK(!JSReceiver::HasLocalProperty(obj, first));
675 674
676 // add first and then second 675 // add first and then second
677 JSReceiver::SetProperty(obj, first, one, NONE, kSloppyMode); 676 JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY);
678 JSReceiver::SetProperty(obj, second, two, NONE, kSloppyMode); 677 JSReceiver::SetProperty(obj, second, two, NONE, SLOPPY);
679 CHECK(JSReceiver::HasLocalProperty(obj, first)); 678 CHECK(JSReceiver::HasLocalProperty(obj, first));
680 CHECK(JSReceiver::HasLocalProperty(obj, second)); 679 CHECK(JSReceiver::HasLocalProperty(obj, second));
681 680
682 // delete first and then second 681 // delete first and then second
683 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION); 682 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION);
684 CHECK(JSReceiver::HasLocalProperty(obj, second)); 683 CHECK(JSReceiver::HasLocalProperty(obj, second));
685 JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION); 684 JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION);
686 CHECK(!JSReceiver::HasLocalProperty(obj, first)); 685 CHECK(!JSReceiver::HasLocalProperty(obj, first));
687 CHECK(!JSReceiver::HasLocalProperty(obj, second)); 686 CHECK(!JSReceiver::HasLocalProperty(obj, second));
688 687
689 // add first and then second 688 // add first and then second
690 JSReceiver::SetProperty(obj, first, one, NONE, kSloppyMode); 689 JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY);
691 JSReceiver::SetProperty(obj, second, two, NONE, kSloppyMode); 690 JSReceiver::SetProperty(obj, second, two, NONE, SLOPPY);
692 CHECK(JSReceiver::HasLocalProperty(obj, first)); 691 CHECK(JSReceiver::HasLocalProperty(obj, first));
693 CHECK(JSReceiver::HasLocalProperty(obj, second)); 692 CHECK(JSReceiver::HasLocalProperty(obj, second));
694 693
695 // delete second and then first 694 // delete second and then first
696 JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION); 695 JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION);
697 CHECK(JSReceiver::HasLocalProperty(obj, first)); 696 CHECK(JSReceiver::HasLocalProperty(obj, first));
698 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION); 697 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION);
699 CHECK(!JSReceiver::HasLocalProperty(obj, first)); 698 CHECK(!JSReceiver::HasLocalProperty(obj, first));
700 CHECK(!JSReceiver::HasLocalProperty(obj, second)); 699 CHECK(!JSReceiver::HasLocalProperty(obj, second));
701 700
702 // check string and internalized string match 701 // check string and internalized string match
703 const char* string1 = "fisk"; 702 const char* string1 = "fisk";
704 Handle<String> s1 = factory->NewStringFromAscii(CStrVector(string1)); 703 Handle<String> s1 = factory->NewStringFromAscii(CStrVector(string1));
705 JSReceiver::SetProperty(obj, s1, one, NONE, kSloppyMode); 704 JSReceiver::SetProperty(obj, s1, one, NONE, SLOPPY);
706 Handle<String> s1_string = factory->InternalizeUtf8String(string1); 705 Handle<String> s1_string = factory->InternalizeUtf8String(string1);
707 CHECK(JSReceiver::HasLocalProperty(obj, s1_string)); 706 CHECK(JSReceiver::HasLocalProperty(obj, s1_string));
708 707
709 // check internalized string and string match 708 // check internalized string and string match
710 const char* string2 = "fugl"; 709 const char* string2 = "fugl";
711 Handle<String> s2_string = factory->InternalizeUtf8String(string2); 710 Handle<String> s2_string = factory->InternalizeUtf8String(string2);
712 JSReceiver::SetProperty(obj, s2_string, one, NONE, kSloppyMode); 711 JSReceiver::SetProperty(obj, s2_string, one, NONE, SLOPPY);
713 Handle<String> s2 = factory->NewStringFromAscii(CStrVector(string2)); 712 Handle<String> s2 = factory->NewStringFromAscii(CStrVector(string2));
714 CHECK(JSReceiver::HasLocalProperty(obj, s2)); 713 CHECK(JSReceiver::HasLocalProperty(obj, s2));
715 } 714 }
716 715
717 716
718 TEST(JSObjectMaps) { 717 TEST(JSObjectMaps) {
719 CcTest::InitializeVM(); 718 CcTest::InitializeVM();
720 Isolate* isolate = CcTest::i_isolate(); 719 Isolate* isolate = CcTest::i_isolate();
721 Factory* factory = isolate->factory(); 720 Factory* factory = isolate->factory();
722 721
723 v8::HandleScope sc(CcTest::isolate()); 722 v8::HandleScope sc(CcTest::isolate());
724 Handle<String> name = factory->InternalizeUtf8String("theFunction"); 723 Handle<String> name = factory->InternalizeUtf8String("theFunction");
725 Handle<JSFunction> function = 724 Handle<JSFunction> function =
726 factory->NewFunction(name, factory->undefined_value()); 725 factory->NewFunction(name, factory->undefined_value());
727 Handle<Map> initial_map = 726 Handle<Map> initial_map =
728 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); 727 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
729 function->set_initial_map(*initial_map); 728 function->set_initial_map(*initial_map);
730 729
731 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot"); 730 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
732 Handle<JSObject> obj = factory->NewJSObject(function); 731 Handle<JSObject> obj = factory->NewJSObject(function);
733 732
734 // Set a propery 733 // Set a propery
735 Handle<Smi> twenty_three(Smi::FromInt(23), isolate); 734 Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
736 JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kSloppyMode); 735 JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY);
737 CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name)); 736 CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
738 737
739 // Check the map has changed 738 // Check the map has changed
740 CHECK(*initial_map != obj->map()); 739 CHECK(*initial_map != obj->map());
741 } 740 }
742 741
743 742
744 TEST(JSArray) { 743 TEST(JSArray) {
745 CcTest::InitializeVM(); 744 CcTest::InitializeVM();
746 Isolate* isolate = CcTest::i_isolate(); 745 Isolate* isolate = CcTest::i_isolate();
(...skipping 12 matching lines...) Expand all
759 // We just initialized the VM, no heap allocation failure yet. 758 // We just initialized the VM, no heap allocation failure yet.
760 array->Initialize(0)->ToObjectChecked(); 759 array->Initialize(0)->ToObjectChecked();
761 760
762 // Set array length to 0. 761 // Set array length to 0.
763 array->SetElementsLength(Smi::FromInt(0))->ToObjectChecked(); 762 array->SetElementsLength(Smi::FromInt(0))->ToObjectChecked();
764 CHECK_EQ(Smi::FromInt(0), array->length()); 763 CHECK_EQ(Smi::FromInt(0), array->length());
765 // Must be in fast mode. 764 // Must be in fast mode.
766 CHECK(array->HasFastSmiOrObjectElements()); 765 CHECK(array->HasFastSmiOrObjectElements());
767 766
768 // array[length] = name. 767 // array[length] = name.
769 JSReceiver::SetElement(array, 0, name, NONE, kSloppyMode); 768 JSReceiver::SetElement(array, 0, name, NONE, SLOPPY);
770 CHECK_EQ(Smi::FromInt(1), array->length()); 769 CHECK_EQ(Smi::FromInt(1), array->length());
771 CHECK_EQ(array->GetElement(isolate, 0), *name); 770 CHECK_EQ(array->GetElement(isolate, 0), *name);
772 771
773 // Set array length with larger than smi value. 772 // Set array length with larger than smi value.
774 Handle<Object> length = 773 Handle<Object> length =
775 factory->NewNumberFromUint(static_cast<uint32_t>(Smi::kMaxValue) + 1); 774 factory->NewNumberFromUint(static_cast<uint32_t>(Smi::kMaxValue) + 1);
776 array->SetElementsLength(*length)->ToObjectChecked(); 775 array->SetElementsLength(*length)->ToObjectChecked();
777 776
778 uint32_t int_length = 0; 777 uint32_t int_length = 0;
779 CHECK(length->ToArrayIndex(&int_length)); 778 CHECK(length->ToArrayIndex(&int_length));
780 CHECK_EQ(*length, array->length()); 779 CHECK_EQ(*length, array->length());
781 CHECK(array->HasDictionaryElements()); // Must be in slow mode. 780 CHECK(array->HasDictionaryElements()); // Must be in slow mode.
782 781
783 // array[length] = name. 782 // array[length] = name.
784 JSReceiver::SetElement(array, int_length, name, NONE, kSloppyMode); 783 JSReceiver::SetElement(array, int_length, name, NONE, SLOPPY);
785 uint32_t new_int_length = 0; 784 uint32_t new_int_length = 0;
786 CHECK(array->length()->ToArrayIndex(&new_int_length)); 785 CHECK(array->length()->ToArrayIndex(&new_int_length));
787 CHECK_EQ(static_cast<double>(int_length), new_int_length - 1); 786 CHECK_EQ(static_cast<double>(int_length), new_int_length - 1);
788 CHECK_EQ(array->GetElement(isolate, int_length), *name); 787 CHECK_EQ(array->GetElement(isolate, int_length), *name);
789 CHECK_EQ(array->GetElement(isolate, 0), *name); 788 CHECK_EQ(array->GetElement(isolate, 0), *name);
790 } 789 }
791 790
792 791
793 TEST(JSObjectCopy) { 792 TEST(JSObjectCopy) {
794 CcTest::InitializeVM(); 793 CcTest::InitializeVM();
795 Isolate* isolate = CcTest::i_isolate(); 794 Isolate* isolate = CcTest::i_isolate();
796 Factory* factory = isolate->factory(); 795 Factory* factory = isolate->factory();
797 796
798 v8::HandleScope sc(CcTest::isolate()); 797 v8::HandleScope sc(CcTest::isolate());
799 String* object_string = String::cast(CcTest::heap()->Object_string()); 798 String* object_string = String::cast(CcTest::heap()->Object_string());
800 Object* raw_object = CcTest::i_isolate()->context()->global_object()-> 799 Object* raw_object = CcTest::i_isolate()->context()->global_object()->
801 GetProperty(object_string)->ToObjectChecked(); 800 GetProperty(object_string)->ToObjectChecked();
802 JSFunction* object_function = JSFunction::cast(raw_object); 801 JSFunction* object_function = JSFunction::cast(raw_object);
803 Handle<JSFunction> constructor(object_function); 802 Handle<JSFunction> constructor(object_function);
804 Handle<JSObject> obj = factory->NewJSObject(constructor); 803 Handle<JSObject> obj = factory->NewJSObject(constructor);
805 Handle<String> first = factory->InternalizeUtf8String("first"); 804 Handle<String> first = factory->InternalizeUtf8String("first");
806 Handle<String> second = factory->InternalizeUtf8String("second"); 805 Handle<String> second = factory->InternalizeUtf8String("second");
807 806
808 Handle<Smi> one(Smi::FromInt(1), isolate); 807 Handle<Smi> one(Smi::FromInt(1), isolate);
809 Handle<Smi> two(Smi::FromInt(2), isolate); 808 Handle<Smi> two(Smi::FromInt(2), isolate);
810 809
811 JSReceiver::SetProperty(obj, first, one, NONE, kSloppyMode); 810 JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY);
812 JSReceiver::SetProperty(obj, second, two, NONE, kSloppyMode); 811 JSReceiver::SetProperty(obj, second, two, NONE, SLOPPY);
813 812
814 JSReceiver::SetElement(obj, 0, first, NONE, kSloppyMode); 813 JSReceiver::SetElement(obj, 0, first, NONE, SLOPPY);
815 JSReceiver::SetElement(obj, 1, second, NONE, kSloppyMode); 814 JSReceiver::SetElement(obj, 1, second, NONE, SLOPPY);
816 815
817 // Make the clone. 816 // Make the clone.
818 Handle<JSObject> clone = JSObject::Copy(obj); 817 Handle<JSObject> clone = JSObject::Copy(obj);
819 CHECK(!clone.is_identical_to(obj)); 818 CHECK(!clone.is_identical_to(obj));
820 819
821 CHECK_EQ(obj->GetElement(isolate, 0), clone->GetElement(isolate, 0)); 820 CHECK_EQ(obj->GetElement(isolate, 0), clone->GetElement(isolate, 0));
822 CHECK_EQ(obj->GetElement(isolate, 1), clone->GetElement(isolate, 1)); 821 CHECK_EQ(obj->GetElement(isolate, 1), clone->GetElement(isolate, 1));
823 822
824 CHECK_EQ(obj->GetProperty(*first), clone->GetProperty(*first)); 823 CHECK_EQ(obj->GetProperty(*first), clone->GetProperty(*first));
825 CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*second)); 824 CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*second));
826 825
827 // Flip the values. 826 // Flip the values.
828 JSReceiver::SetProperty(clone, first, two, NONE, kSloppyMode); 827 JSReceiver::SetProperty(clone, first, two, NONE, SLOPPY);
829 JSReceiver::SetProperty(clone, second, one, NONE, kSloppyMode); 828 JSReceiver::SetProperty(clone, second, one, NONE, SLOPPY);
830 829
831 JSReceiver::SetElement(clone, 0, second, NONE, kSloppyMode); 830 JSReceiver::SetElement(clone, 0, second, NONE, SLOPPY);
832 JSReceiver::SetElement(clone, 1, first, NONE, kSloppyMode); 831 JSReceiver::SetElement(clone, 1, first, NONE, SLOPPY);
833 832
834 CHECK_EQ(obj->GetElement(isolate, 1), clone->GetElement(isolate, 0)); 833 CHECK_EQ(obj->GetElement(isolate, 1), clone->GetElement(isolate, 0));
835 CHECK_EQ(obj->GetElement(isolate, 0), clone->GetElement(isolate, 1)); 834 CHECK_EQ(obj->GetElement(isolate, 0), clone->GetElement(isolate, 1));
836 835
837 CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*first)); 836 CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*first));
838 CHECK_EQ(obj->GetProperty(*first), clone->GetProperty(*second)); 837 CHECK_EQ(obj->GetProperty(*first), clone->GetProperty(*second));
839 } 838 }
840 839
841 840
842 TEST(StringAllocation) { 841 TEST(StringAllocation) {
(...skipping 2838 matching lines...) Expand 10 before | Expand all | Expand 10 after
3681 code = scope.CloseAndEscape(Handle<Code>(bar->code())); 3680 code = scope.CloseAndEscape(Handle<Code>(bar->code()));
3682 } 3681 }
3683 3682
3684 // Now make sure that a gc should get rid of the function 3683 // Now make sure that a gc should get rid of the function
3685 for (int i = 0; i < 4; i++) { 3684 for (int i = 0; i < 4; i++) {
3686 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); 3685 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
3687 } 3686 }
3688 3687
3689 ASSERT(code->marked_for_deoptimization()); 3688 ASSERT(code->marked_for_deoptimization());
3690 } 3689 }
OLDNEW
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698