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

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

Issue 177683002: Mode clean-up pt 1: rename classic/non-strict mode to sloppy mode (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
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, kNonStrictMode); 278 JSReceiver::SetProperty(global, name, function, NONE, kSloppyMode);
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, kNonStrictMode); 281 JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kSloppyMode);
282 JSReceiver::SetProperty(obj, prop_namex, twenty_four, NONE, kNonStrictMode); 282 JSReceiver::SetProperty(obj, prop_namex, twenty_four, NONE, kSloppyMode);
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, kNonStrictMode); 302 JSReceiver::SetProperty(global, obj_name, obj, NONE, kSloppyMode);
303 JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kNonStrictMode); 303 JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kSloppyMode);
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, kNonStrictMode); 638 JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kSloppyMode);
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,
642 kNonStrictMode); 642 kSloppyMode);
643 CHECK_EQ(Smi::FromInt(24), function->GetProperty(*prop_name)); 643 CHECK_EQ(Smi::FromInt(24), function->GetProperty(*prop_name));
644 } 644 }
645 645
646 646
647 TEST(ObjectProperties) { 647 TEST(ObjectProperties) {
648 CcTest::InitializeVM(); 648 CcTest::InitializeVM();
649 Isolate* isolate = CcTest::i_isolate(); 649 Isolate* isolate = CcTest::i_isolate();
650 Factory* factory = isolate->factory(); 650 Factory* factory = isolate->factory();
651 651
652 v8::HandleScope sc(CcTest::isolate()); 652 v8::HandleScope sc(CcTest::isolate());
653 String* object_string = String::cast(CcTest::heap()->Object_string()); 653 String* object_string = String::cast(CcTest::heap()->Object_string());
654 Object* raw_object = CcTest::i_isolate()->context()->global_object()-> 654 Object* raw_object = CcTest::i_isolate()->context()->global_object()->
655 GetProperty(object_string)->ToObjectChecked(); 655 GetProperty(object_string)->ToObjectChecked();
656 JSFunction* object_function = JSFunction::cast(raw_object); 656 JSFunction* object_function = JSFunction::cast(raw_object);
657 Handle<JSFunction> constructor(object_function); 657 Handle<JSFunction> constructor(object_function);
658 Handle<JSObject> obj = factory->NewJSObject(constructor); 658 Handle<JSObject> obj = factory->NewJSObject(constructor);
659 Handle<String> first = factory->InternalizeUtf8String("first"); 659 Handle<String> first = factory->InternalizeUtf8String("first");
660 Handle<String> second = factory->InternalizeUtf8String("second"); 660 Handle<String> second = factory->InternalizeUtf8String("second");
661 661
662 Handle<Smi> one(Smi::FromInt(1), isolate); 662 Handle<Smi> one(Smi::FromInt(1), isolate);
663 Handle<Smi> two(Smi::FromInt(2), isolate); 663 Handle<Smi> two(Smi::FromInt(2), isolate);
664 664
665 // check for empty 665 // check for empty
666 CHECK(!JSReceiver::HasLocalProperty(obj, first)); 666 CHECK(!JSReceiver::HasLocalProperty(obj, first));
667 667
668 // add first 668 // add first
669 JSReceiver::SetProperty(obj, first, one, NONE, kNonStrictMode); 669 JSReceiver::SetProperty(obj, first, one, NONE, kSloppyMode);
670 CHECK(JSReceiver::HasLocalProperty(obj, first)); 670 CHECK(JSReceiver::HasLocalProperty(obj, first));
671 671
672 // delete first 672 // delete first
673 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION); 673 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION);
674 CHECK(!JSReceiver::HasLocalProperty(obj, first)); 674 CHECK(!JSReceiver::HasLocalProperty(obj, first));
675 675
676 // add first and then second 676 // add first and then second
677 JSReceiver::SetProperty(obj, first, one, NONE, kNonStrictMode); 677 JSReceiver::SetProperty(obj, first, one, NONE, kSloppyMode);
678 JSReceiver::SetProperty(obj, second, two, NONE, kNonStrictMode); 678 JSReceiver::SetProperty(obj, second, two, NONE, kSloppyMode);
679 CHECK(JSReceiver::HasLocalProperty(obj, first)); 679 CHECK(JSReceiver::HasLocalProperty(obj, first));
680 CHECK(JSReceiver::HasLocalProperty(obj, second)); 680 CHECK(JSReceiver::HasLocalProperty(obj, second));
681 681
682 // delete first and then second 682 // delete first and then second
683 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION); 683 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION);
684 CHECK(JSReceiver::HasLocalProperty(obj, second)); 684 CHECK(JSReceiver::HasLocalProperty(obj, second));
685 JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION); 685 JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION);
686 CHECK(!JSReceiver::HasLocalProperty(obj, first)); 686 CHECK(!JSReceiver::HasLocalProperty(obj, first));
687 CHECK(!JSReceiver::HasLocalProperty(obj, second)); 687 CHECK(!JSReceiver::HasLocalProperty(obj, second));
688 688
689 // add first and then second 689 // add first and then second
690 JSReceiver::SetProperty(obj, first, one, NONE, kNonStrictMode); 690 JSReceiver::SetProperty(obj, first, one, NONE, kSloppyMode);
691 JSReceiver::SetProperty(obj, second, two, NONE, kNonStrictMode); 691 JSReceiver::SetProperty(obj, second, two, NONE, kSloppyMode);
692 CHECK(JSReceiver::HasLocalProperty(obj, first)); 692 CHECK(JSReceiver::HasLocalProperty(obj, first));
693 CHECK(JSReceiver::HasLocalProperty(obj, second)); 693 CHECK(JSReceiver::HasLocalProperty(obj, second));
694 694
695 // delete second and then first 695 // delete second and then first
696 JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION); 696 JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION);
697 CHECK(JSReceiver::HasLocalProperty(obj, first)); 697 CHECK(JSReceiver::HasLocalProperty(obj, first));
698 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION); 698 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION);
699 CHECK(!JSReceiver::HasLocalProperty(obj, first)); 699 CHECK(!JSReceiver::HasLocalProperty(obj, first));
700 CHECK(!JSReceiver::HasLocalProperty(obj, second)); 700 CHECK(!JSReceiver::HasLocalProperty(obj, second));
701 701
702 // check string and internalized string match 702 // check string and internalized string match
703 const char* string1 = "fisk"; 703 const char* string1 = "fisk";
704 Handle<String> s1 = factory->NewStringFromAscii(CStrVector(string1)); 704 Handle<String> s1 = factory->NewStringFromAscii(CStrVector(string1));
705 JSReceiver::SetProperty(obj, s1, one, NONE, kNonStrictMode); 705 JSReceiver::SetProperty(obj, s1, one, NONE, kSloppyMode);
706 Handle<String> s1_string = factory->InternalizeUtf8String(string1); 706 Handle<String> s1_string = factory->InternalizeUtf8String(string1);
707 CHECK(JSReceiver::HasLocalProperty(obj, s1_string)); 707 CHECK(JSReceiver::HasLocalProperty(obj, s1_string));
708 708
709 // check internalized string and string match 709 // check internalized string and string match
710 const char* string2 = "fugl"; 710 const char* string2 = "fugl";
711 Handle<String> s2_string = factory->InternalizeUtf8String(string2); 711 Handle<String> s2_string = factory->InternalizeUtf8String(string2);
712 JSReceiver::SetProperty(obj, s2_string, one, NONE, kNonStrictMode); 712 JSReceiver::SetProperty(obj, s2_string, one, NONE, kSloppyMode);
713 Handle<String> s2 = factory->NewStringFromAscii(CStrVector(string2)); 713 Handle<String> s2 = factory->NewStringFromAscii(CStrVector(string2));
714 CHECK(JSReceiver::HasLocalProperty(obj, s2)); 714 CHECK(JSReceiver::HasLocalProperty(obj, s2));
715 } 715 }
716 716
717 717
718 TEST(JSObjectMaps) { 718 TEST(JSObjectMaps) {
719 CcTest::InitializeVM(); 719 CcTest::InitializeVM();
720 Isolate* isolate = CcTest::i_isolate(); 720 Isolate* isolate = CcTest::i_isolate();
721 Factory* factory = isolate->factory(); 721 Factory* factory = isolate->factory();
722 722
723 v8::HandleScope sc(CcTest::isolate()); 723 v8::HandleScope sc(CcTest::isolate());
724 Handle<String> name = factory->InternalizeUtf8String("theFunction"); 724 Handle<String> name = factory->InternalizeUtf8String("theFunction");
725 Handle<JSFunction> function = 725 Handle<JSFunction> function =
726 factory->NewFunction(name, factory->undefined_value()); 726 factory->NewFunction(name, factory->undefined_value());
727 Handle<Map> initial_map = 727 Handle<Map> initial_map =
728 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); 728 factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
729 function->set_initial_map(*initial_map); 729 function->set_initial_map(*initial_map);
730 730
731 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot"); 731 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
732 Handle<JSObject> obj = factory->NewJSObject(function); 732 Handle<JSObject> obj = factory->NewJSObject(function);
733 733
734 // Set a propery 734 // Set a propery
735 Handle<Smi> twenty_three(Smi::FromInt(23), isolate); 735 Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
736 JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kNonStrictMode); 736 JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kSloppyMode);
737 CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name)); 737 CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
738 738
739 // Check the map has changed 739 // Check the map has changed
740 CHECK(*initial_map != obj->map()); 740 CHECK(*initial_map != obj->map());
741 } 741 }
742 742
743 743
744 TEST(JSArray) { 744 TEST(JSArray) {
745 CcTest::InitializeVM(); 745 CcTest::InitializeVM();
746 Isolate* isolate = CcTest::i_isolate(); 746 Isolate* isolate = CcTest::i_isolate();
(...skipping 12 matching lines...) Expand all
759 // We just initialized the VM, no heap allocation failure yet. 759 // We just initialized the VM, no heap allocation failure yet.
760 array->Initialize(0)->ToObjectChecked(); 760 array->Initialize(0)->ToObjectChecked();
761 761
762 // Set array length to 0. 762 // Set array length to 0.
763 array->SetElementsLength(Smi::FromInt(0))->ToObjectChecked(); 763 array->SetElementsLength(Smi::FromInt(0))->ToObjectChecked();
764 CHECK_EQ(Smi::FromInt(0), array->length()); 764 CHECK_EQ(Smi::FromInt(0), array->length());
765 // Must be in fast mode. 765 // Must be in fast mode.
766 CHECK(array->HasFastSmiOrObjectElements()); 766 CHECK(array->HasFastSmiOrObjectElements());
767 767
768 // array[length] = name. 768 // array[length] = name.
769 JSReceiver::SetElement(array, 0, name, NONE, kNonStrictMode); 769 JSReceiver::SetElement(array, 0, name, NONE, kSloppyMode);
770 CHECK_EQ(Smi::FromInt(1), array->length()); 770 CHECK_EQ(Smi::FromInt(1), array->length());
771 CHECK_EQ(array->GetElement(isolate, 0), *name); 771 CHECK_EQ(array->GetElement(isolate, 0), *name);
772 772
773 // Set array length with larger than smi value. 773 // Set array length with larger than smi value.
774 Handle<Object> length = 774 Handle<Object> length =
775 factory->NewNumberFromUint(static_cast<uint32_t>(Smi::kMaxValue) + 1); 775 factory->NewNumberFromUint(static_cast<uint32_t>(Smi::kMaxValue) + 1);
776 array->SetElementsLength(*length)->ToObjectChecked(); 776 array->SetElementsLength(*length)->ToObjectChecked();
777 777
778 uint32_t int_length = 0; 778 uint32_t int_length = 0;
779 CHECK(length->ToArrayIndex(&int_length)); 779 CHECK(length->ToArrayIndex(&int_length));
780 CHECK_EQ(*length, array->length()); 780 CHECK_EQ(*length, array->length());
781 CHECK(array->HasDictionaryElements()); // Must be in slow mode. 781 CHECK(array->HasDictionaryElements()); // Must be in slow mode.
782 782
783 // array[length] = name. 783 // array[length] = name.
784 JSReceiver::SetElement(array, int_length, name, NONE, kNonStrictMode); 784 JSReceiver::SetElement(array, int_length, name, NONE, kSloppyMode);
785 uint32_t new_int_length = 0; 785 uint32_t new_int_length = 0;
786 CHECK(array->length()->ToArrayIndex(&new_int_length)); 786 CHECK(array->length()->ToArrayIndex(&new_int_length));
787 CHECK_EQ(static_cast<double>(int_length), new_int_length - 1); 787 CHECK_EQ(static_cast<double>(int_length), new_int_length - 1);
788 CHECK_EQ(array->GetElement(isolate, int_length), *name); 788 CHECK_EQ(array->GetElement(isolate, int_length), *name);
789 CHECK_EQ(array->GetElement(isolate, 0), *name); 789 CHECK_EQ(array->GetElement(isolate, 0), *name);
790 } 790 }
791 791
792 792
793 TEST(JSObjectCopy) { 793 TEST(JSObjectCopy) {
794 CcTest::InitializeVM(); 794 CcTest::InitializeVM();
795 Isolate* isolate = CcTest::i_isolate(); 795 Isolate* isolate = CcTest::i_isolate();
796 Factory* factory = isolate->factory(); 796 Factory* factory = isolate->factory();
797 797
798 v8::HandleScope sc(CcTest::isolate()); 798 v8::HandleScope sc(CcTest::isolate());
799 String* object_string = String::cast(CcTest::heap()->Object_string()); 799 String* object_string = String::cast(CcTest::heap()->Object_string());
800 Object* raw_object = CcTest::i_isolate()->context()->global_object()-> 800 Object* raw_object = CcTest::i_isolate()->context()->global_object()->
801 GetProperty(object_string)->ToObjectChecked(); 801 GetProperty(object_string)->ToObjectChecked();
802 JSFunction* object_function = JSFunction::cast(raw_object); 802 JSFunction* object_function = JSFunction::cast(raw_object);
803 Handle<JSFunction> constructor(object_function); 803 Handle<JSFunction> constructor(object_function);
804 Handle<JSObject> obj = factory->NewJSObject(constructor); 804 Handle<JSObject> obj = factory->NewJSObject(constructor);
805 Handle<String> first = factory->InternalizeUtf8String("first"); 805 Handle<String> first = factory->InternalizeUtf8String("first");
806 Handle<String> second = factory->InternalizeUtf8String("second"); 806 Handle<String> second = factory->InternalizeUtf8String("second");
807 807
808 Handle<Smi> one(Smi::FromInt(1), isolate); 808 Handle<Smi> one(Smi::FromInt(1), isolate);
809 Handle<Smi> two(Smi::FromInt(2), isolate); 809 Handle<Smi> two(Smi::FromInt(2), isolate);
810 810
811 JSReceiver::SetProperty(obj, first, one, NONE, kNonStrictMode); 811 JSReceiver::SetProperty(obj, first, one, NONE, kSloppyMode);
812 JSReceiver::SetProperty(obj, second, two, NONE, kNonStrictMode); 812 JSReceiver::SetProperty(obj, second, two, NONE, kSloppyMode);
813 813
814 JSReceiver::SetElement(obj, 0, first, NONE, kNonStrictMode); 814 JSReceiver::SetElement(obj, 0, first, NONE, kSloppyMode);
815 JSReceiver::SetElement(obj, 1, second, NONE, kNonStrictMode); 815 JSReceiver::SetElement(obj, 1, second, NONE, kSloppyMode);
816 816
817 // Make the clone. 817 // Make the clone.
818 Handle<JSObject> clone = JSObject::Copy(obj); 818 Handle<JSObject> clone = JSObject::Copy(obj);
819 CHECK(!clone.is_identical_to(obj)); 819 CHECK(!clone.is_identical_to(obj));
820 820
821 CHECK_EQ(obj->GetElement(isolate, 0), clone->GetElement(isolate, 0)); 821 CHECK_EQ(obj->GetElement(isolate, 0), clone->GetElement(isolate, 0));
822 CHECK_EQ(obj->GetElement(isolate, 1), clone->GetElement(isolate, 1)); 822 CHECK_EQ(obj->GetElement(isolate, 1), clone->GetElement(isolate, 1));
823 823
824 CHECK_EQ(obj->GetProperty(*first), clone->GetProperty(*first)); 824 CHECK_EQ(obj->GetProperty(*first), clone->GetProperty(*first));
825 CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*second)); 825 CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*second));
826 826
827 // Flip the values. 827 // Flip the values.
828 JSReceiver::SetProperty(clone, first, two, NONE, kNonStrictMode); 828 JSReceiver::SetProperty(clone, first, two, NONE, kSloppyMode);
829 JSReceiver::SetProperty(clone, second, one, NONE, kNonStrictMode); 829 JSReceiver::SetProperty(clone, second, one, NONE, kSloppyMode);
830 830
831 JSReceiver::SetElement(clone, 0, second, NONE, kNonStrictMode); 831 JSReceiver::SetElement(clone, 0, second, NONE, kSloppyMode);
832 JSReceiver::SetElement(clone, 1, first, NONE, kNonStrictMode); 832 JSReceiver::SetElement(clone, 1, first, NONE, kSloppyMode);
833 833
834 CHECK_EQ(obj->GetElement(isolate, 1), clone->GetElement(isolate, 0)); 834 CHECK_EQ(obj->GetElement(isolate, 1), clone->GetElement(isolate, 0));
835 CHECK_EQ(obj->GetElement(isolate, 0), clone->GetElement(isolate, 1)); 835 CHECK_EQ(obj->GetElement(isolate, 0), clone->GetElement(isolate, 1));
836 836
837 CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*first)); 837 CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*first));
838 CHECK_EQ(obj->GetProperty(*first), clone->GetProperty(*second)); 838 CHECK_EQ(obj->GetProperty(*first), clone->GetProperty(*second));
839 } 839 }
840 840
841 841
842 TEST(StringAllocation) { 842 TEST(StringAllocation) {
(...skipping 2838 matching lines...) Expand 10 before | Expand all | Expand 10 after
3681 code = scope.CloseAndEscape(Handle<Code>(bar->code())); 3681 code = scope.CloseAndEscape(Handle<Code>(bar->code()));
3682 } 3682 }
3683 3683
3684 // Now make sure that a gc should get rid of the function 3684 // Now make sure that a gc should get rid of the function
3685 for (int i = 0; i < 4; i++) { 3685 for (int i = 0; i < 4; i++) {
3686 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); 3686 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
3687 } 3687 }
3688 3688
3689 ASSERT(code->marked_for_deoptimization()); 3689 ASSERT(code->marked_for_deoptimization());
3690 } 3690 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698