| OLD | NEW |
| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot"); | 255 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot"); |
| 256 Handle<String> prop_namex = factory->InternalizeUtf8String("theSlotx"); | 256 Handle<String> prop_namex = factory->InternalizeUtf8String("theSlotx"); |
| 257 Handle<String> obj_name = factory->InternalizeUtf8String("theObject"); | 257 Handle<String> obj_name = factory->InternalizeUtf8String("theObject"); |
| 258 Handle<Smi> twenty_three(Smi::FromInt(23), isolate); | 258 Handle<Smi> twenty_three(Smi::FromInt(23), isolate); |
| 259 Handle<Smi> twenty_four(Smi::FromInt(24), isolate); | 259 Handle<Smi> twenty_four(Smi::FromInt(24), isolate); |
| 260 | 260 |
| 261 { | 261 { |
| 262 HandleScope inner_scope(isolate); | 262 HandleScope inner_scope(isolate); |
| 263 // Allocate a function and keep it in global object's property. | 263 // Allocate a function and keep it in global object's property. |
| 264 Handle<JSFunction> function = factory->NewFunction(name); | 264 Handle<JSFunction> function = factory->NewFunction(name); |
| 265 JSReceiver::SetProperty(global, name, function, NONE, SLOPPY).Check(); | 265 JSReceiver::SetProperty(global, name, function, SLOPPY).Check(); |
| 266 // Allocate an object. Unrooted after leaving the scope. | 266 // Allocate an object. Unrooted after leaving the scope. |
| 267 Handle<JSObject> obj = factory->NewJSObject(function); | 267 Handle<JSObject> obj = factory->NewJSObject(function); |
| 268 JSReceiver::SetProperty( | 268 JSReceiver::SetProperty(obj, prop_name, twenty_three, SLOPPY).Check(); |
| 269 obj, prop_name, twenty_three, NONE, SLOPPY).Check(); | 269 JSReceiver::SetProperty(obj, prop_namex, twenty_four, SLOPPY).Check(); |
| 270 JSReceiver::SetProperty( | |
| 271 obj, prop_namex, twenty_four, NONE, SLOPPY).Check(); | |
| 272 | 270 |
| 273 CHECK_EQ(Smi::FromInt(23), | 271 CHECK_EQ(Smi::FromInt(23), |
| 274 *Object::GetProperty(obj, prop_name).ToHandleChecked()); | 272 *Object::GetProperty(obj, prop_name).ToHandleChecked()); |
| 275 CHECK_EQ(Smi::FromInt(24), | 273 CHECK_EQ(Smi::FromInt(24), |
| 276 *Object::GetProperty(obj, prop_namex).ToHandleChecked()); | 274 *Object::GetProperty(obj, prop_namex).ToHandleChecked()); |
| 277 } | 275 } |
| 278 | 276 |
| 279 heap->CollectGarbage(NEW_SPACE); | 277 heap->CollectGarbage(NEW_SPACE); |
| 280 | 278 |
| 281 // Function should be alive. | 279 // Function should be alive. |
| 282 CHECK(JSReceiver::HasOwnProperty(global, name)); | 280 CHECK(JSReceiver::HasOwnProperty(global, name)); |
| 283 // Check function is retained. | 281 // Check function is retained. |
| 284 Handle<Object> func_value = | 282 Handle<Object> func_value = |
| 285 Object::GetProperty(global, name).ToHandleChecked(); | 283 Object::GetProperty(global, name).ToHandleChecked(); |
| 286 CHECK(func_value->IsJSFunction()); | 284 CHECK(func_value->IsJSFunction()); |
| 287 Handle<JSFunction> function = Handle<JSFunction>::cast(func_value); | 285 Handle<JSFunction> function = Handle<JSFunction>::cast(func_value); |
| 288 | 286 |
| 289 { | 287 { |
| 290 HandleScope inner_scope(isolate); | 288 HandleScope inner_scope(isolate); |
| 291 // Allocate another object, make it reachable from global. | 289 // Allocate another object, make it reachable from global. |
| 292 Handle<JSObject> obj = factory->NewJSObject(function); | 290 Handle<JSObject> obj = factory->NewJSObject(function); |
| 293 JSReceiver::SetProperty(global, obj_name, obj, NONE, SLOPPY).Check(); | 291 JSReceiver::SetProperty(global, obj_name, obj, SLOPPY).Check(); |
| 294 JSReceiver::SetProperty( | 292 JSReceiver::SetProperty(obj, prop_name, twenty_three, SLOPPY).Check(); |
| 295 obj, prop_name, twenty_three, NONE, SLOPPY).Check(); | |
| 296 } | 293 } |
| 297 | 294 |
| 298 // After gc, it should survive. | 295 // After gc, it should survive. |
| 299 heap->CollectGarbage(NEW_SPACE); | 296 heap->CollectGarbage(NEW_SPACE); |
| 300 | 297 |
| 301 CHECK(JSReceiver::HasOwnProperty(global, obj_name)); | 298 CHECK(JSReceiver::HasOwnProperty(global, obj_name)); |
| 302 Handle<Object> obj = | 299 Handle<Object> obj = |
| 303 Object::GetProperty(global, obj_name).ToHandleChecked(); | 300 Object::GetProperty(global, obj_name).ToHandleChecked(); |
| 304 CHECK(obj->IsJSObject()); | 301 CHECK(obj->IsJSObject()); |
| 305 CHECK_EQ(Smi::FromInt(23), | 302 CHECK_EQ(Smi::FromInt(23), |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 | 617 |
| 621 v8::HandleScope sc(CcTest::isolate()); | 618 v8::HandleScope sc(CcTest::isolate()); |
| 622 Handle<String> name = factory->InternalizeUtf8String("theFunction"); | 619 Handle<String> name = factory->InternalizeUtf8String("theFunction"); |
| 623 Handle<JSFunction> function = factory->NewFunction(name); | 620 Handle<JSFunction> function = factory->NewFunction(name); |
| 624 | 621 |
| 625 Handle<Smi> twenty_three(Smi::FromInt(23), isolate); | 622 Handle<Smi> twenty_three(Smi::FromInt(23), isolate); |
| 626 Handle<Smi> twenty_four(Smi::FromInt(24), isolate); | 623 Handle<Smi> twenty_four(Smi::FromInt(24), isolate); |
| 627 | 624 |
| 628 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot"); | 625 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot"); |
| 629 Handle<JSObject> obj = factory->NewJSObject(function); | 626 Handle<JSObject> obj = factory->NewJSObject(function); |
| 630 JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY).Check(); | 627 JSReceiver::SetProperty(obj, prop_name, twenty_three, SLOPPY).Check(); |
| 631 CHECK_EQ(Smi::FromInt(23), | 628 CHECK_EQ(Smi::FromInt(23), |
| 632 *Object::GetProperty(obj, prop_name).ToHandleChecked()); | 629 *Object::GetProperty(obj, prop_name).ToHandleChecked()); |
| 633 // Check that we can add properties to function objects. | 630 // Check that we can add properties to function objects. |
| 634 JSReceiver::SetProperty( | 631 JSReceiver::SetProperty(function, prop_name, twenty_four, SLOPPY).Check(); |
| 635 function, prop_name, twenty_four, NONE, SLOPPY).Check(); | |
| 636 CHECK_EQ(Smi::FromInt(24), | 632 CHECK_EQ(Smi::FromInt(24), |
| 637 *Object::GetProperty(function, prop_name).ToHandleChecked()); | 633 *Object::GetProperty(function, prop_name).ToHandleChecked()); |
| 638 } | 634 } |
| 639 | 635 |
| 640 | 636 |
| 641 TEST(ObjectProperties) { | 637 TEST(ObjectProperties) { |
| 642 CcTest::InitializeVM(); | 638 CcTest::InitializeVM(); |
| 643 Isolate* isolate = CcTest::i_isolate(); | 639 Isolate* isolate = CcTest::i_isolate(); |
| 644 Factory* factory = isolate->factory(); | 640 Factory* factory = isolate->factory(); |
| 645 | 641 |
| 646 v8::HandleScope sc(CcTest::isolate()); | 642 v8::HandleScope sc(CcTest::isolate()); |
| 647 Handle<String> object_string(String::cast(CcTest::heap()->Object_string())); | 643 Handle<String> object_string(String::cast(CcTest::heap()->Object_string())); |
| 648 Handle<Object> object = Object::GetProperty( | 644 Handle<Object> object = Object::GetProperty( |
| 649 CcTest::i_isolate()->global_object(), object_string).ToHandleChecked(); | 645 CcTest::i_isolate()->global_object(), object_string).ToHandleChecked(); |
| 650 Handle<JSFunction> constructor = Handle<JSFunction>::cast(object); | 646 Handle<JSFunction> constructor = Handle<JSFunction>::cast(object); |
| 651 Handle<JSObject> obj = factory->NewJSObject(constructor); | 647 Handle<JSObject> obj = factory->NewJSObject(constructor); |
| 652 Handle<String> first = factory->InternalizeUtf8String("first"); | 648 Handle<String> first = factory->InternalizeUtf8String("first"); |
| 653 Handle<String> second = factory->InternalizeUtf8String("second"); | 649 Handle<String> second = factory->InternalizeUtf8String("second"); |
| 654 | 650 |
| 655 Handle<Smi> one(Smi::FromInt(1), isolate); | 651 Handle<Smi> one(Smi::FromInt(1), isolate); |
| 656 Handle<Smi> two(Smi::FromInt(2), isolate); | 652 Handle<Smi> two(Smi::FromInt(2), isolate); |
| 657 | 653 |
| 658 // check for empty | 654 // check for empty |
| 659 CHECK(!JSReceiver::HasOwnProperty(obj, first)); | 655 CHECK(!JSReceiver::HasOwnProperty(obj, first)); |
| 660 | 656 |
| 661 // add first | 657 // add first |
| 662 JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY).Check(); | 658 JSReceiver::SetProperty(obj, first, one, SLOPPY).Check(); |
| 663 CHECK(JSReceiver::HasOwnProperty(obj, first)); | 659 CHECK(JSReceiver::HasOwnProperty(obj, first)); |
| 664 | 660 |
| 665 // delete first | 661 // delete first |
| 666 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION).Check(); | 662 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION).Check(); |
| 667 CHECK(!JSReceiver::HasOwnProperty(obj, first)); | 663 CHECK(!JSReceiver::HasOwnProperty(obj, first)); |
| 668 | 664 |
| 669 // add first and then second | 665 // add first and then second |
| 670 JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY).Check(); | 666 JSReceiver::SetProperty(obj, first, one, SLOPPY).Check(); |
| 671 JSReceiver::SetProperty(obj, second, two, NONE, SLOPPY).Check(); | 667 JSReceiver::SetProperty(obj, second, two, SLOPPY).Check(); |
| 672 CHECK(JSReceiver::HasOwnProperty(obj, first)); | 668 CHECK(JSReceiver::HasOwnProperty(obj, first)); |
| 673 CHECK(JSReceiver::HasOwnProperty(obj, second)); | 669 CHECK(JSReceiver::HasOwnProperty(obj, second)); |
| 674 | 670 |
| 675 // delete first and then second | 671 // delete first and then second |
| 676 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION).Check(); | 672 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION).Check(); |
| 677 CHECK(JSReceiver::HasOwnProperty(obj, second)); | 673 CHECK(JSReceiver::HasOwnProperty(obj, second)); |
| 678 JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION).Check(); | 674 JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION).Check(); |
| 679 CHECK(!JSReceiver::HasOwnProperty(obj, first)); | 675 CHECK(!JSReceiver::HasOwnProperty(obj, first)); |
| 680 CHECK(!JSReceiver::HasOwnProperty(obj, second)); | 676 CHECK(!JSReceiver::HasOwnProperty(obj, second)); |
| 681 | 677 |
| 682 // add first and then second | 678 // add first and then second |
| 683 JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY).Check(); | 679 JSReceiver::SetProperty(obj, first, one, SLOPPY).Check(); |
| 684 JSReceiver::SetProperty(obj, second, two, NONE, SLOPPY).Check(); | 680 JSReceiver::SetProperty(obj, second, two, SLOPPY).Check(); |
| 685 CHECK(JSReceiver::HasOwnProperty(obj, first)); | 681 CHECK(JSReceiver::HasOwnProperty(obj, first)); |
| 686 CHECK(JSReceiver::HasOwnProperty(obj, second)); | 682 CHECK(JSReceiver::HasOwnProperty(obj, second)); |
| 687 | 683 |
| 688 // delete second and then first | 684 // delete second and then first |
| 689 JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION).Check(); | 685 JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION).Check(); |
| 690 CHECK(JSReceiver::HasOwnProperty(obj, first)); | 686 CHECK(JSReceiver::HasOwnProperty(obj, first)); |
| 691 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION).Check(); | 687 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION).Check(); |
| 692 CHECK(!JSReceiver::HasOwnProperty(obj, first)); | 688 CHECK(!JSReceiver::HasOwnProperty(obj, first)); |
| 693 CHECK(!JSReceiver::HasOwnProperty(obj, second)); | 689 CHECK(!JSReceiver::HasOwnProperty(obj, second)); |
| 694 | 690 |
| 695 // check string and internalized string match | 691 // check string and internalized string match |
| 696 const char* string1 = "fisk"; | 692 const char* string1 = "fisk"; |
| 697 Handle<String> s1 = factory->NewStringFromAsciiChecked(string1); | 693 Handle<String> s1 = factory->NewStringFromAsciiChecked(string1); |
| 698 JSReceiver::SetProperty(obj, s1, one, NONE, SLOPPY).Check(); | 694 JSReceiver::SetProperty(obj, s1, one, SLOPPY).Check(); |
| 699 Handle<String> s1_string = factory->InternalizeUtf8String(string1); | 695 Handle<String> s1_string = factory->InternalizeUtf8String(string1); |
| 700 CHECK(JSReceiver::HasOwnProperty(obj, s1_string)); | 696 CHECK(JSReceiver::HasOwnProperty(obj, s1_string)); |
| 701 | 697 |
| 702 // check internalized string and string match | 698 // check internalized string and string match |
| 703 const char* string2 = "fugl"; | 699 const char* string2 = "fugl"; |
| 704 Handle<String> s2_string = factory->InternalizeUtf8String(string2); | 700 Handle<String> s2_string = factory->InternalizeUtf8String(string2); |
| 705 JSReceiver::SetProperty(obj, s2_string, one, NONE, SLOPPY).Check(); | 701 JSReceiver::SetProperty(obj, s2_string, one, SLOPPY).Check(); |
| 706 Handle<String> s2 = factory->NewStringFromAsciiChecked(string2); | 702 Handle<String> s2 = factory->NewStringFromAsciiChecked(string2); |
| 707 CHECK(JSReceiver::HasOwnProperty(obj, s2)); | 703 CHECK(JSReceiver::HasOwnProperty(obj, s2)); |
| 708 } | 704 } |
| 709 | 705 |
| 710 | 706 |
| 711 TEST(JSObjectMaps) { | 707 TEST(JSObjectMaps) { |
| 712 CcTest::InitializeVM(); | 708 CcTest::InitializeVM(); |
| 713 Isolate* isolate = CcTest::i_isolate(); | 709 Isolate* isolate = CcTest::i_isolate(); |
| 714 Factory* factory = isolate->factory(); | 710 Factory* factory = isolate->factory(); |
| 715 | 711 |
| 716 v8::HandleScope sc(CcTest::isolate()); | 712 v8::HandleScope sc(CcTest::isolate()); |
| 717 Handle<String> name = factory->InternalizeUtf8String("theFunction"); | 713 Handle<String> name = factory->InternalizeUtf8String("theFunction"); |
| 718 Handle<JSFunction> function = factory->NewFunction(name); | 714 Handle<JSFunction> function = factory->NewFunction(name); |
| 719 | 715 |
| 720 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot"); | 716 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot"); |
| 721 Handle<JSObject> obj = factory->NewJSObject(function); | 717 Handle<JSObject> obj = factory->NewJSObject(function); |
| 722 Handle<Map> initial_map(function->initial_map()); | 718 Handle<Map> initial_map(function->initial_map()); |
| 723 | 719 |
| 724 // Set a propery | 720 // Set a propery |
| 725 Handle<Smi> twenty_three(Smi::FromInt(23), isolate); | 721 Handle<Smi> twenty_three(Smi::FromInt(23), isolate); |
| 726 JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY).Check(); | 722 JSReceiver::SetProperty(obj, prop_name, twenty_three, SLOPPY).Check(); |
| 727 CHECK_EQ(Smi::FromInt(23), | 723 CHECK_EQ(Smi::FromInt(23), |
| 728 *Object::GetProperty(obj, prop_name).ToHandleChecked()); | 724 *Object::GetProperty(obj, prop_name).ToHandleChecked()); |
| 729 | 725 |
| 730 // Check the map has changed | 726 // Check the map has changed |
| 731 CHECK(*initial_map != obj->map()); | 727 CHECK(*initial_map != obj->map()); |
| 732 } | 728 } |
| 733 | 729 |
| 734 | 730 |
| 735 TEST(JSArray) { | 731 TEST(JSArray) { |
| 736 CcTest::InitializeVM(); | 732 CcTest::InitializeVM(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 Handle<Object> object = Object::GetProperty( | 790 Handle<Object> object = Object::GetProperty( |
| 795 CcTest::i_isolate()->global_object(), object_string).ToHandleChecked(); | 791 CcTest::i_isolate()->global_object(), object_string).ToHandleChecked(); |
| 796 Handle<JSFunction> constructor = Handle<JSFunction>::cast(object); | 792 Handle<JSFunction> constructor = Handle<JSFunction>::cast(object); |
| 797 Handle<JSObject> obj = factory->NewJSObject(constructor); | 793 Handle<JSObject> obj = factory->NewJSObject(constructor); |
| 798 Handle<String> first = factory->InternalizeUtf8String("first"); | 794 Handle<String> first = factory->InternalizeUtf8String("first"); |
| 799 Handle<String> second = factory->InternalizeUtf8String("second"); | 795 Handle<String> second = factory->InternalizeUtf8String("second"); |
| 800 | 796 |
| 801 Handle<Smi> one(Smi::FromInt(1), isolate); | 797 Handle<Smi> one(Smi::FromInt(1), isolate); |
| 802 Handle<Smi> two(Smi::FromInt(2), isolate); | 798 Handle<Smi> two(Smi::FromInt(2), isolate); |
| 803 | 799 |
| 804 JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY).Check(); | 800 JSReceiver::SetProperty(obj, first, one, SLOPPY).Check(); |
| 805 JSReceiver::SetProperty(obj, second, two, NONE, SLOPPY).Check(); | 801 JSReceiver::SetProperty(obj, second, two, SLOPPY).Check(); |
| 806 | 802 |
| 807 JSReceiver::SetElement(obj, 0, first, NONE, SLOPPY).Check(); | 803 JSReceiver::SetElement(obj, 0, first, NONE, SLOPPY).Check(); |
| 808 JSReceiver::SetElement(obj, 1, second, NONE, SLOPPY).Check(); | 804 JSReceiver::SetElement(obj, 1, second, NONE, SLOPPY).Check(); |
| 809 | 805 |
| 810 // Make the clone. | 806 // Make the clone. |
| 811 Handle<Object> value1, value2; | 807 Handle<Object> value1, value2; |
| 812 Handle<JSObject> clone = factory->CopyJSObject(obj); | 808 Handle<JSObject> clone = factory->CopyJSObject(obj); |
| 813 CHECK(!clone.is_identical_to(obj)); | 809 CHECK(!clone.is_identical_to(obj)); |
| 814 | 810 |
| 815 value1 = Object::GetElement(isolate, obj, 0).ToHandleChecked(); | 811 value1 = Object::GetElement(isolate, obj, 0).ToHandleChecked(); |
| 816 value2 = Object::GetElement(isolate, clone, 0).ToHandleChecked(); | 812 value2 = Object::GetElement(isolate, clone, 0).ToHandleChecked(); |
| 817 CHECK_EQ(*value1, *value2); | 813 CHECK_EQ(*value1, *value2); |
| 818 value1 = Object::GetElement(isolate, obj, 1).ToHandleChecked(); | 814 value1 = Object::GetElement(isolate, obj, 1).ToHandleChecked(); |
| 819 value2 = Object::GetElement(isolate, clone, 1).ToHandleChecked(); | 815 value2 = Object::GetElement(isolate, clone, 1).ToHandleChecked(); |
| 820 CHECK_EQ(*value1, *value2); | 816 CHECK_EQ(*value1, *value2); |
| 821 | 817 |
| 822 value1 = Object::GetProperty(obj, first).ToHandleChecked(); | 818 value1 = Object::GetProperty(obj, first).ToHandleChecked(); |
| 823 value2 = Object::GetProperty(clone, first).ToHandleChecked(); | 819 value2 = Object::GetProperty(clone, first).ToHandleChecked(); |
| 824 CHECK_EQ(*value1, *value2); | 820 CHECK_EQ(*value1, *value2); |
| 825 value1 = Object::GetProperty(obj, second).ToHandleChecked(); | 821 value1 = Object::GetProperty(obj, second).ToHandleChecked(); |
| 826 value2 = Object::GetProperty(clone, second).ToHandleChecked(); | 822 value2 = Object::GetProperty(clone, second).ToHandleChecked(); |
| 827 CHECK_EQ(*value1, *value2); | 823 CHECK_EQ(*value1, *value2); |
| 828 | 824 |
| 829 // Flip the values. | 825 // Flip the values. |
| 830 JSReceiver::SetProperty(clone, first, two, NONE, SLOPPY).Check(); | 826 JSReceiver::SetProperty(clone, first, two, SLOPPY).Check(); |
| 831 JSReceiver::SetProperty(clone, second, one, NONE, SLOPPY).Check(); | 827 JSReceiver::SetProperty(clone, second, one, SLOPPY).Check(); |
| 832 | 828 |
| 833 JSReceiver::SetElement(clone, 0, second, NONE, SLOPPY).Check(); | 829 JSReceiver::SetElement(clone, 0, second, NONE, SLOPPY).Check(); |
| 834 JSReceiver::SetElement(clone, 1, first, NONE, SLOPPY).Check(); | 830 JSReceiver::SetElement(clone, 1, first, NONE, SLOPPY).Check(); |
| 835 | 831 |
| 836 value1 = Object::GetElement(isolate, obj, 1).ToHandleChecked(); | 832 value1 = Object::GetElement(isolate, obj, 1).ToHandleChecked(); |
| 837 value2 = Object::GetElement(isolate, clone, 0).ToHandleChecked(); | 833 value2 = Object::GetElement(isolate, clone, 0).ToHandleChecked(); |
| 838 CHECK_EQ(*value1, *value2); | 834 CHECK_EQ(*value1, *value2); |
| 839 value1 = Object::GetElement(isolate, obj, 0).ToHandleChecked(); | 835 value1 = Object::GetElement(isolate, obj, 0).ToHandleChecked(); |
| 840 value2 = Object::GetElement(isolate, clone, 1).ToHandleChecked(); | 836 value2 = Object::GetElement(isolate, clone, 1).ToHandleChecked(); |
| 841 CHECK_EQ(*value1, *value2); | 837 CHECK_EQ(*value1, *value2); |
| (...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2757 | 2753 |
| 2758 static void AddPropertyTo( | 2754 static void AddPropertyTo( |
| 2759 int gc_count, Handle<JSObject> object, const char* property_name) { | 2755 int gc_count, Handle<JSObject> object, const char* property_name) { |
| 2760 Isolate* isolate = CcTest::i_isolate(); | 2756 Isolate* isolate = CcTest::i_isolate(); |
| 2761 Factory* factory = isolate->factory(); | 2757 Factory* factory = isolate->factory(); |
| 2762 Handle<String> prop_name = factory->InternalizeUtf8String(property_name); | 2758 Handle<String> prop_name = factory->InternalizeUtf8String(property_name); |
| 2763 Handle<Smi> twenty_three(Smi::FromInt(23), isolate); | 2759 Handle<Smi> twenty_three(Smi::FromInt(23), isolate); |
| 2764 i::FLAG_gc_interval = gc_count; | 2760 i::FLAG_gc_interval = gc_count; |
| 2765 i::FLAG_gc_global = true; | 2761 i::FLAG_gc_global = true; |
| 2766 CcTest::heap()->set_allocation_timeout(gc_count); | 2762 CcTest::heap()->set_allocation_timeout(gc_count); |
| 2767 JSReceiver::SetProperty( | 2763 JSReceiver::SetProperty(object, prop_name, twenty_three, SLOPPY).Check(); |
| 2768 object, prop_name, twenty_three, NONE, SLOPPY).Check(); | |
| 2769 } | 2764 } |
| 2770 | 2765 |
| 2771 | 2766 |
| 2772 TEST(TransitionArrayShrinksDuringAllocToZero) { | 2767 TEST(TransitionArrayShrinksDuringAllocToZero) { |
| 2773 i::FLAG_stress_compaction = false; | 2768 i::FLAG_stress_compaction = false; |
| 2774 i::FLAG_allow_natives_syntax = true; | 2769 i::FLAG_allow_natives_syntax = true; |
| 2775 CcTest::InitializeVM(); | 2770 CcTest::InitializeVM(); |
| 2776 v8::HandleScope scope(CcTest::isolate()); | 2771 v8::HandleScope scope(CcTest::isolate()); |
| 2777 static const int transitions_count = 10; | 2772 static const int transitions_count = 10; |
| 2778 CompileRun("function F() { }"); | 2773 CompileRun("function F() { }"); |
| (...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4409 #ifdef DEBUG | 4404 #ifdef DEBUG |
| 4410 TEST(PathTracer) { | 4405 TEST(PathTracer) { |
| 4411 CcTest::InitializeVM(); | 4406 CcTest::InitializeVM(); |
| 4412 v8::HandleScope scope(CcTest::isolate()); | 4407 v8::HandleScope scope(CcTest::isolate()); |
| 4413 | 4408 |
| 4414 v8::Local<v8::Value> result = CompileRun("'abc'"); | 4409 v8::Local<v8::Value> result = CompileRun("'abc'"); |
| 4415 Handle<Object> o = v8::Utils::OpenHandle(*result); | 4410 Handle<Object> o = v8::Utils::OpenHandle(*result); |
| 4416 CcTest::i_isolate()->heap()->TracePathToObject(*o); | 4411 CcTest::i_isolate()->heap()->TracePathToObject(*o); |
| 4417 } | 4412 } |
| 4418 #endif // DEBUG | 4413 #endif // DEBUG |
| OLD | NEW |