Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 570 // Super type set below, after Object is allocated. | 570 // Super type set below, after Object is allocated. |
| 571 | 571 |
| 572 cls = Class::New<JSRegExp>(); | 572 cls = Class::New<JSRegExp>(); |
| 573 object_store->set_jsregexp_class(cls); | 573 object_store->set_jsregexp_class(cls); |
| 574 RegisterClass(cls, "JSSyntaxRegExp", impl_script, core_impl_lib); | 574 RegisterClass(cls, "JSSyntaxRegExp", impl_script, core_impl_lib); |
| 575 pending_classes.Add(cls, Heap::kOld); | 575 pending_classes.Add(cls, Heap::kOld); |
| 576 | 576 |
| 577 // Initialize the base interfaces used by the core VM classes. | 577 // Initialize the base interfaces used by the core VM classes. |
| 578 const Script& script = Script::Handle(Bootstrap::LoadScript()); | 578 const Script& script = Script::Handle(Bootstrap::LoadScript()); |
| 579 | 579 |
| 580 // Allocate and initialize the Object class and type. | 580 // Allocate and initialize the Object class and type. The Object |
| 581 // The Object and ExternalByteArray classes are the only pre-allocated | 581 // class and ByteArray subclasses are the only pre-allocated, |
| 582 // non-interface classes in the core library. | 582 // non-interface classes in the core library. |
| 583 cls = Class::New<Instance>(); | 583 cls = Class::New<Instance>(); |
| 584 object_store->set_object_class(cls); | 584 object_store->set_object_class(cls); |
| 585 cls.set_name(String::Handle(String::NewSymbol("Object"))); | 585 cls.set_name(String::Handle(String::NewSymbol("Object"))); |
| 586 cls.set_script(script); | 586 cls.set_script(script); |
| 587 core_lib.AddClass(cls); | 587 core_lib.AddClass(cls); |
| 588 pending_classes.Add(cls, Heap::kOld); | 588 pending_classes.Add(cls, Heap::kOld); |
| 589 type = Type::NewNonParameterizedType(cls); | 589 type = Type::NewNonParameterizedType(cls); |
| 590 object_store->set_object_type(type); | 590 object_store->set_object_type(type); |
| 591 | 591 |
| 592 cls = Class::New<InternalByteArray>(); | 592 cls = Class::New<Int8Array>(); |
| 593 object_store->set_internal_byte_array_class(cls); | 593 object_store->set_int8_array_class(cls); |
| 594 String& public_class_name = String::Handle(); | 594 String& public_class_name = String::Handle(); |
| 595 public_class_name = String::New("_InternalByteArray"); | 595 public_class_name = String::New("_Int8Array"); |
|
Ivan Posva
2012/05/02 08:19:17
How about adding a RegisterPrivateClass similar to
cshapiro
2012/05/03 04:01:50
Sounds good. Done.
| |
| 596 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | 596 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); |
| 597 cls.set_script(script); | 597 cls.set_script(script); |
| 598 core_lib.AddClass(cls); | 598 core_lib.AddClass(cls); |
| 599 | 599 |
| 600 cls = Class::New<ExternalByteArray>(); | 600 cls = Class::New<Uint8Array>(); |
| 601 object_store->set_external_byte_array_class(cls); | 601 object_store->set_uint8_array_class(cls); |
| 602 public_class_name = String::New("_ExternalByteArray"); | 602 public_class_name = String::New("_Uint8Array"); |
| 603 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | 603 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); |
| 604 cls.set_script(script); | 604 cls.set_script(script); |
| 605 core_lib.AddClass(cls); | 605 core_lib.AddClass(cls); |
| 606 | |
| 607 cls = Class::New<Int16Array>(); | |
| 608 object_store->set_int16_array_class(cls); | |
| 609 public_class_name = String::New("_Int16Array"); | |
| 610 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 611 cls.set_script(script); | |
| 612 core_lib.AddClass(cls); | |
| 613 | |
| 614 cls = Class::New<Uint16Array>(); | |
| 615 object_store->set_uint16_array_class(cls); | |
| 616 public_class_name = String::New("_Uint16Array"); | |
| 617 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 618 cls.set_script(script); | |
| 619 core_lib.AddClass(cls); | |
| 620 | |
| 621 cls = Class::New<Int32Array>(); | |
| 622 object_store->set_int32_array_class(cls); | |
| 623 public_class_name = String::New("_Int32Array"); | |
| 624 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 625 cls.set_script(script); | |
| 626 core_lib.AddClass(cls); | |
| 627 | |
| 628 cls = Class::New<Uint32Array>(); | |
| 629 object_store->set_uint32_array_class(cls); | |
| 630 public_class_name = String::New("_Uint32Array"); | |
| 631 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 632 cls.set_script(script); | |
| 633 core_lib.AddClass(cls); | |
| 634 | |
| 635 cls = Class::New<Int64Array>(); | |
| 636 object_store->set_int64_array_class(cls); | |
| 637 public_class_name = String::New("_Int64Array"); | |
| 638 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 639 cls.set_script(script); | |
| 640 core_lib.AddClass(cls); | |
| 641 | |
| 642 cls = Class::New<Uint64Array>(); | |
| 643 object_store->set_uint64_array_class(cls); | |
| 644 public_class_name = String::New("_Uint64Array"); | |
| 645 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 646 cls.set_script(script); | |
| 647 core_lib.AddClass(cls); | |
| 648 | |
| 649 cls = Class::New<Float32Array>(); | |
| 650 object_store->set_float32_array_class(cls); | |
| 651 public_class_name = String::New("_Float32Array"); | |
| 652 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 653 cls.set_script(script); | |
| 654 core_lib.AddClass(cls); | |
| 655 | |
| 656 cls = Class::New<Float64Array>(); | |
| 657 object_store->set_float64_array_class(cls); | |
| 658 public_class_name = String::New("_Float64Array"); | |
| 659 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 660 cls.set_script(script); | |
| 661 core_lib.AddClass(cls); | |
| 662 | |
| 663 cls = Class::New<ExternalInt8Array>(); | |
| 664 object_store->set_external_int8_array_class(cls); | |
| 665 public_class_name = String::New("_ExternalInt8Array"); | |
| 666 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 667 cls.set_script(script); | |
| 668 core_lib.AddClass(cls); | |
| 669 | |
| 670 cls = Class::New<ExternalUint8Array>(); | |
| 671 object_store->set_external_uint8_array_class(cls); | |
| 672 public_class_name = String::New("_ExternalUint8Array"); | |
| 673 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 674 cls.set_script(script); | |
| 675 core_lib.AddClass(cls); | |
| 676 | |
| 677 cls = Class::New<ExternalInt16Array>(); | |
| 678 object_store->set_external_int16_array_class(cls); | |
| 679 public_class_name = String::New("_ExternalInt16Array"); | |
| 680 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 681 cls.set_script(script); | |
| 682 core_lib.AddClass(cls); | |
| 683 | |
| 684 cls = Class::New<ExternalUint16Array>(); | |
| 685 object_store->set_external_uint16_array_class(cls); | |
| 686 public_class_name = String::New("_ExternalUint16Array"); | |
| 687 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 688 cls.set_script(script); | |
| 689 core_lib.AddClass(cls); | |
| 690 | |
| 691 cls = Class::New<ExternalInt32Array>(); | |
| 692 object_store->set_external_int32_array_class(cls); | |
| 693 public_class_name = String::New("_ExternalInt32Array"); | |
| 694 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 695 cls.set_script(script); | |
| 696 core_lib.AddClass(cls); | |
| 697 | |
| 698 cls = Class::New<ExternalUint32Array>(); | |
| 699 object_store->set_external_uint32_array_class(cls); | |
| 700 public_class_name = String::New("_ExternalUint32Array"); | |
| 701 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 702 cls.set_script(script); | |
| 703 core_lib.AddClass(cls); | |
| 704 | |
| 705 cls = Class::New<ExternalInt64Array>(); | |
| 706 object_store->set_external_int64_array_class(cls); | |
| 707 public_class_name = String::New("_ExternalInt64Array"); | |
| 708 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 709 cls.set_script(script); | |
| 710 core_lib.AddClass(cls); | |
| 711 | |
| 712 cls = Class::New<ExternalUint64Array>(); | |
| 713 object_store->set_external_uint64_array_class(cls); | |
| 714 public_class_name = String::New("_ExternalUint64Array"); | |
| 715 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 716 cls.set_script(script); | |
| 717 core_lib.AddClass(cls); | |
| 718 | |
| 719 cls = Class::New<ExternalFloat32Array>(); | |
| 720 object_store->set_external_float32_array_class(cls); | |
| 721 public_class_name = String::New("_ExternalFloat32Array"); | |
| 722 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 723 cls.set_script(script); | |
| 724 core_lib.AddClass(cls); | |
| 725 | |
| 726 cls = Class::New<ExternalFloat64Array>(); | |
| 727 object_store->set_external_float64_array_class(cls); | |
| 728 public_class_name = String::New("_ExternalFloat64Array"); | |
| 729 cls.set_name(String::Handle(core_lib.PrivateName(public_class_name))); | |
| 730 cls.set_script(script); | |
| 731 core_lib.AddClass(cls); | |
| 606 | 732 |
| 607 // Set the super type of class Stacktrace to Object type so that the | 733 // Set the super type of class Stacktrace to Object type so that the |
| 608 // 'toString' method is implemented. | 734 // 'toString' method is implemented. |
| 609 cls = object_store->stacktrace_class(); | 735 cls = object_store->stacktrace_class(); |
| 610 cls.set_super_type(type); | 736 cls.set_super_type(type); |
| 611 | 737 |
| 612 cls = CreateAndRegisterInterface("Function", script, core_lib); | 738 cls = CreateAndRegisterInterface("Function", script, core_lib); |
| 613 pending_classes.Add(cls, Heap::kOld); | 739 pending_classes.Add(cls, Heap::kOld); |
| 614 type = Type::NewNonParameterizedType(cls); | 740 type = Type::NewNonParameterizedType(cls); |
| 615 object_store->set_function_interface(type); | 741 object_store->set_function_interface(type); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 736 Array& empty_array = Array::Handle(); | 862 Array& empty_array = Array::Handle(); |
| 737 empty_array = Array::New(0); | 863 empty_array = Array::New(0); |
| 738 object_store->set_empty_array(empty_array); | 864 object_store->set_empty_array(empty_array); |
| 739 | 865 |
| 740 cls = Class::New<ImmutableArray>(); | 866 cls = Class::New<ImmutableArray>(); |
| 741 object_store->set_immutable_array_class(cls); | 867 object_store->set_immutable_array_class(cls); |
| 742 | 868 |
| 743 cls = Class::New<GrowableObjectArray>(); | 869 cls = Class::New<GrowableObjectArray>(); |
| 744 object_store->set_growable_object_array_class(cls); | 870 object_store->set_growable_object_array_class(cls); |
| 745 | 871 |
| 746 cls = Class::New<InternalByteArray>(); | 872 cls = Class::New<Int8Array>(); |
| 747 object_store->set_internal_byte_array_class(cls); | 873 object_store->set_int8_array_class(cls); |
| 748 | 874 |
| 749 cls = Class::New<ExternalByteArray>(); | 875 cls = Class::New<Uint8Array>(); |
| 750 object_store->set_external_byte_array_class(cls); | 876 object_store->set_uint8_array_class(cls); |
| 877 | |
| 878 cls = Class::New<Int16Array>(); | |
| 879 object_store->set_int16_array_class(cls); | |
| 880 | |
| 881 cls = Class::New<Uint16Array>(); | |
| 882 object_store->set_uint16_array_class(cls); | |
| 883 | |
| 884 cls = Class::New<Int32Array>(); | |
| 885 object_store->set_int32_array_class(cls); | |
| 886 | |
| 887 cls = Class::New<Uint32Array>(); | |
| 888 object_store->set_uint32_array_class(cls); | |
| 889 | |
| 890 cls = Class::New<Int64Array>(); | |
| 891 object_store->set_int64_array_class(cls); | |
| 892 | |
| 893 cls = Class::New<Uint64Array>(); | |
| 894 object_store->set_uint64_array_class(cls); | |
| 895 | |
| 896 cls = Class::New<Float32Array>(); | |
| 897 object_store->set_float32_array_class(cls); | |
| 898 | |
| 899 cls = Class::New<Float64Array>(); | |
| 900 object_store->set_float64_array_class(cls); | |
| 901 | |
| 902 cls = Class::New<ExternalInt8Array>(); | |
| 903 object_store->set_external_int8_array_class(cls); | |
| 904 | |
| 905 cls = Class::New<ExternalUint8Array>(); | |
| 906 object_store->set_external_uint8_array_class(cls); | |
| 907 | |
| 908 cls = Class::New<ExternalInt16Array>(); | |
| 909 object_store->set_external_int16_array_class(cls); | |
| 910 | |
| 911 cls = Class::New<ExternalUint16Array>(); | |
| 912 object_store->set_external_uint16_array_class(cls); | |
| 913 | |
| 914 cls = Class::New<ExternalInt32Array>(); | |
| 915 object_store->set_external_int32_array_class(cls); | |
| 916 | |
| 917 cls = Class::New<ExternalUint32Array>(); | |
| 918 object_store->set_external_uint32_array_class(cls); | |
| 919 | |
| 920 cls = Class::New<ExternalInt64Array>(); | |
| 921 object_store->set_external_int64_array_class(cls); | |
| 922 | |
| 923 cls = Class::New<ExternalUint64Array>(); | |
| 924 object_store->set_external_uint64_array_class(cls); | |
| 925 | |
| 926 cls = Class::New<ExternalFloat32Array>(); | |
| 927 object_store->set_external_float32_array_class(cls); | |
| 928 | |
| 929 cls = Class::New<ExternalFloat64Array>(); | |
| 930 object_store->set_external_float64_array_class(cls); | |
| 751 | 931 |
| 752 cls = Class::New<Instance>(); | 932 cls = Class::New<Instance>(); |
| 753 object_store->set_object_class(cls); | 933 object_store->set_object_class(cls); |
| 754 | 934 |
| 755 cls = Class::New<Smi>(); | 935 cls = Class::New<Smi>(); |
| 756 object_store->set_smi_class(cls); | 936 object_store->set_smi_class(cls); |
| 757 | 937 |
| 758 cls = Class::New<Mint>(); | 938 cls = Class::New<Mint>(); |
| 759 object_store->set_mint_class(cls); | 939 object_store->set_mint_class(cls); |
| 760 | 940 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 930 // TODO(srdjan): Make functions_cache growable and start with a smaller size. | 1110 // TODO(srdjan): Make functions_cache growable and start with a smaller size. |
| 931 Array& fcache = | 1111 Array& fcache = |
| 932 Array::Handle(Array::New(FunctionsCache::kNumEntries * 32, Heap::kOld)); | 1112 Array::Handle(Array::New(FunctionsCache::kNumEntries * 32, Heap::kOld)); |
| 933 StorePointer(&raw_ptr()->functions_cache_, fcache.raw()); | 1113 StorePointer(&raw_ptr()->functions_cache_, fcache.raw()); |
| 934 StorePointer(&raw_ptr()->constants_, empty_array.raw()); | 1114 StorePointer(&raw_ptr()->constants_, empty_array.raw()); |
| 935 StorePointer(&raw_ptr()->canonical_types_, empty_array.raw()); | 1115 StorePointer(&raw_ptr()->canonical_types_, empty_array.raw()); |
| 936 StorePointer(&raw_ptr()->functions_, empty_array.raw()); | 1116 StorePointer(&raw_ptr()->functions_, empty_array.raw()); |
| 937 StorePointer(&raw_ptr()->fields_, empty_array.raw()); | 1117 StorePointer(&raw_ptr()->fields_, empty_array.raw()); |
| 938 } | 1118 } |
| 939 | 1119 |
| 1120 | |
| 1121 bool Class::HasInstanceFields() const { | |
| 1122 const Array& field_array = Array::Handle(fields()); | |
| 1123 Field& field = Field::Handle(); | |
| 1124 for (intptr_t i = 0; i < field_array.Length(); ++i) { | |
| 1125 field ^= field_array.At(i); | |
| 1126 if (!field.is_static()) { | |
| 1127 return true; | |
| 1128 } | |
| 1129 } | |
| 1130 return false; | |
| 1131 } | |
| 1132 | |
| 940 void Class::SetFunctions(const Array& value) const { | 1133 void Class::SetFunctions(const Array& value) const { |
| 941 ASSERT(!value.IsNull()); | 1134 ASSERT(!value.IsNull()); |
| 942 // Bind all the functions in the array to this class. | 1135 // Bind all the functions in the array to this class. |
| 943 Function& func = Function::Handle(); | 1136 Function& func = Function::Handle(); |
| 944 intptr_t len = value.Length(); | 1137 intptr_t len = value.Length(); |
| 945 for (intptr_t i = 0; i < len; i++) { | 1138 for (intptr_t i = 0; i < len; i++) { |
| 946 func ^= value.At(i); | 1139 func ^= value.At(i); |
| 947 func.set_owner(*this); | 1140 func.set_owner(*this); |
| 948 } | 1141 } |
| 949 StorePointer(&raw_ptr()->functions_, value.raw()); | 1142 StorePointer(&raw_ptr()->functions_, value.raw()); |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1352 return object_store->bool_class(); | 1545 return object_store->bool_class(); |
| 1353 case kArray: | 1546 case kArray: |
| 1354 ASSERT(object_store->array_class() != Class::null()); | 1547 ASSERT(object_store->array_class() != Class::null()); |
| 1355 return object_store->array_class(); | 1548 return object_store->array_class(); |
| 1356 case kImmutableArray: | 1549 case kImmutableArray: |
| 1357 ASSERT(object_store->immutable_array_class() != Class::null()); | 1550 ASSERT(object_store->immutable_array_class() != Class::null()); |
| 1358 return object_store->immutable_array_class(); | 1551 return object_store->immutable_array_class(); |
| 1359 case kGrowableObjectArray: | 1552 case kGrowableObjectArray: |
| 1360 ASSERT(object_store->growable_object_array_class() != Class::null()); | 1553 ASSERT(object_store->growable_object_array_class() != Class::null()); |
| 1361 return object_store->growable_object_array_class(); | 1554 return object_store->growable_object_array_class(); |
| 1362 case kInternalByteArray: | 1555 case kInt8Array: |
| 1363 ASSERT(object_store->internal_byte_array_class() != Class::null()); | 1556 ASSERT(object_store->int8_array_class() != Class::null()); |
| 1364 return object_store->internal_byte_array_class(); | 1557 return object_store->int8_array_class(); |
| 1365 case kExternalByteArray: | 1558 case kUint8Array: |
| 1366 ASSERT(object_store->external_byte_array_class() != Class::null()); | 1559 ASSERT(object_store->uint8_array_class() != Class::null()); |
| 1367 return object_store->external_byte_array_class(); | 1560 return object_store->uint8_array_class(); |
| 1561 case kInt16Array: | |
| 1562 ASSERT(object_store->int16_array_class() != Class::null()); | |
| 1563 return object_store->int16_array_class(); | |
| 1564 case kUint16Array: | |
| 1565 ASSERT(object_store->uint16_array_class() != Class::null()); | |
| 1566 return object_store->uint16_array_class(); | |
| 1567 case kInt32Array: | |
| 1568 ASSERT(object_store->int32_array_class() != Class::null()); | |
| 1569 return object_store->int32_array_class(); | |
| 1570 case kUint32Array: | |
| 1571 ASSERT(object_store->uint32_array_class() != Class::null()); | |
| 1572 return object_store->uint32_array_class(); | |
| 1573 case kInt64Array: | |
| 1574 ASSERT(object_store->int64_array_class() != Class::null()); | |
| 1575 return object_store->int64_array_class(); | |
| 1576 case kUint64Array: | |
| 1577 ASSERT(object_store->uint64_array_class() != Class::null()); | |
| 1578 return object_store->uint64_array_class(); | |
| 1579 case kFloat32Array: | |
| 1580 ASSERT(object_store->float32_array_class() != Class::null()); | |
| 1581 return object_store->float32_array_class(); | |
| 1582 case kFloat64Array: | |
| 1583 ASSERT(object_store->float64_array_class() != Class::null()); | |
| 1584 return object_store->float64_array_class(); | |
| 1585 case kExternalInt8Array: | |
| 1586 ASSERT(object_store->external_int8_array_class() != Class::null()); | |
| 1587 return object_store->external_int8_array_class(); | |
| 1588 case kExternalUint8Array: | |
| 1589 ASSERT(object_store->external_uint8_array_class() != Class::null()); | |
| 1590 return object_store->external_uint8_array_class(); | |
| 1591 case kExternalInt16Array: | |
| 1592 ASSERT(object_store->external_int16_array_class() != Class::null()); | |
| 1593 return object_store->external_int16_array_class(); | |
| 1594 case kExternalUint16Array: | |
| 1595 ASSERT(object_store->external_uint16_array_class() != Class::null()); | |
| 1596 return object_store->external_uint16_array_class(); | |
| 1597 case kExternalInt32Array: | |
| 1598 ASSERT(object_store->external_int32_array_class() != Class::null()); | |
| 1599 return object_store->external_int32_array_class(); | |
| 1600 case kExternalUint32Array: | |
| 1601 ASSERT(object_store->external_uint32_array_class() != Class::null()); | |
| 1602 return object_store->external_uint32_array_class(); | |
| 1603 case kExternalInt64Array: | |
| 1604 ASSERT(object_store->external_int64_array_class() != Class::null()); | |
| 1605 return object_store->external_int64_array_class(); | |
| 1606 case kExternalUint64Array: | |
| 1607 ASSERT(object_store->external_uint64_array_class() != Class::null()); | |
| 1608 return object_store->external_uint64_array_class(); | |
| 1609 case kExternalFloat32Array: | |
| 1610 ASSERT(object_store->external_float32_array_class() != Class::null()); | |
| 1611 return object_store->external_float32_array_class(); | |
| 1612 case kExternalFloat64Array: | |
| 1613 ASSERT(object_store->external_float64_array_class() != Class::null()); | |
| 1614 return object_store->external_float64_array_class(); | |
| 1368 case kStacktrace: | 1615 case kStacktrace: |
| 1369 ASSERT(object_store->stacktrace_class() != Class::null()); | 1616 ASSERT(object_store->stacktrace_class() != Class::null()); |
| 1370 return object_store->stacktrace_class(); | 1617 return object_store->stacktrace_class(); |
| 1371 case kJSRegExp: | 1618 case kJSRegExp: |
| 1372 ASSERT(object_store->jsregexp_class() != Class::null()); | 1619 ASSERT(object_store->jsregexp_class() != Class::null()); |
| 1373 return object_store->jsregexp_class(); | 1620 return object_store->jsregexp_class(); |
| 1374 case kClosure: | 1621 case kClosure: |
| 1375 return Class::New<Closure>(); | 1622 return Class::New<Closure>(); |
| 1376 case kInstance: | 1623 case kInstance: |
| 1377 return Class::New<Instance>(); | 1624 return Class::New<Instance>(); |
| (...skipping 7411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8789 } | 9036 } |
| 8790 return result.raw(); | 9037 return result.raw(); |
| 8791 } | 9038 } |
| 8792 | 9039 |
| 8793 | 9040 |
| 8794 const char* GrowableObjectArray::ToCString() const { | 9041 const char* GrowableObjectArray::ToCString() const { |
| 8795 return "GrowableObjectArray"; | 9042 return "GrowableObjectArray"; |
| 8796 } | 9043 } |
| 8797 | 9044 |
| 8798 | 9045 |
| 8799 intptr_t ByteArray::Length() const { | 9046 void ByteArray::Copy(void* dst, |
| 8800 // ByteArray is an abstract class. | |
| 8801 UNREACHABLE(); | |
| 8802 return 0; | |
| 8803 } | |
| 8804 | |
| 8805 | |
| 8806 void ByteArray::Copy(uint8_t* dst, | |
| 8807 const ByteArray& src, | 9047 const ByteArray& src, |
| 8808 intptr_t src_offset, | 9048 intptr_t src_offset, |
| 8809 intptr_t length) { | 9049 intptr_t length) { |
| 8810 ASSERT(Utils::RangeCheck(src_offset, length, src.Length())); | 9050 ASSERT(Utils::RangeCheck(src_offset, length, src.ByteLength())); |
| 8811 { | 9051 { |
| 8812 NoGCScope no_gc; | 9052 NoGCScope no_gc; |
| 8813 if (length > 0) { | 9053 if (length > 0) { |
| 8814 memmove(dst, src.ByteAddr(src_offset), length); | 9054 memmove(dst, src.ByteAddr(src_offset), length); |
| 8815 } | 9055 } |
| 8816 } | 9056 } |
| 8817 } | 9057 } |
| 8818 | 9058 |
| 8819 | 9059 |
| 8820 void ByteArray::Copy(const ByteArray& dst, | 9060 void ByteArray::Copy(const ByteArray& dst, |
| 8821 intptr_t dst_offset, | 9061 intptr_t dst_offset, |
| 8822 const uint8_t* src, | 9062 const void* src, |
| 8823 intptr_t length) { | 9063 intptr_t length) { |
| 8824 ASSERT(Utils::RangeCheck(dst_offset, length, dst.Length())); | 9064 ASSERT(Utils::RangeCheck(dst_offset, length, dst.ByteLength())); |
| 8825 { | 9065 { |
| 8826 NoGCScope no_gc; | 9066 NoGCScope no_gc; |
| 8827 if (length > 0) { | 9067 if (length > 0) { |
| 8828 memmove(dst.ByteAddr(dst_offset), src, length); | 9068 memmove(dst.ByteAddr(dst_offset), src, length); |
| 8829 } | 9069 } |
| 8830 } | 9070 } |
| 8831 } | 9071 } |
| 8832 | 9072 |
| 8833 | 9073 |
| 8834 void ByteArray::Copy(const ByteArray& dst, | 9074 void ByteArray::Copy(const ByteArray& dst, |
| 8835 intptr_t dst_offset, | 9075 intptr_t dst_offset, |
| 8836 const ByteArray& src, | 9076 const ByteArray& src, |
| 8837 intptr_t src_offset, | 9077 intptr_t src_offset, |
| 8838 intptr_t length) { | 9078 intptr_t length) { |
| 8839 ASSERT(Utils::RangeCheck(src_offset, length, src.Length())); | 9079 ASSERT(Utils::RangeCheck(src_offset, length, src.ByteLength())); |
| 8840 ASSERT(Utils::RangeCheck(dst_offset, length, dst.Length())); | 9080 ASSERT(Utils::RangeCheck(dst_offset, length, dst.ByteLength())); |
| 8841 { | 9081 { |
| 8842 NoGCScope no_gc; | 9082 NoGCScope no_gc; |
| 8843 if (length > 0) { | 9083 if (length > 0) { |
| 8844 memmove(dst.ByteAddr(dst_offset), src.ByteAddr(src_offset), length); | 9084 memmove(dst.ByteAddr(dst_offset), src.ByteAddr(src_offset), length); |
| 8845 } | 9085 } |
| 8846 } | 9086 } |
| 8847 } | 9087 } |
| 8848 | 9088 |
| 8849 | 9089 |
| 9090 template<typename T> | |
| 9091 static void ExternalByteArrayFinalize(Dart_Handle handle, void* peer) { | |
| 9092 delete reinterpret_cast<ExternalByteArrayData<T>*>(peer); | |
| 9093 DeleteWeakPersistentHandle(handle); | |
| 9094 } | |
| 9095 | |
| 9096 | |
| 9097 template<typename HandleT, typename RawT, typename ElementT> | |
| 9098 RawT* ByteArray::NewExternalImpl(const Class& cls, | |
| 9099 ElementT* data, | |
| 9100 intptr_t len, | |
| 9101 void* peer, | |
| 9102 Dart_PeerFinalizer callback, | |
| 9103 Heap::Space space) { | |
| 9104 HandleT& result = HandleT::Handle(); | |
| 9105 ExternalByteArrayData<ElementT>* external_data = | |
| 9106 new ExternalByteArrayData<ElementT>(data, peer, callback); | |
| 9107 { | |
| 9108 RawObject* raw = Object::Allocate(cls, HandleT::InstanceSize(), space); | |
| 9109 NoGCScope no_gc; | |
| 9110 result ^= raw; | |
| 9111 result.SetLength(len); | |
| 9112 result.SetExternalData(external_data); | |
| 9113 } | |
| 9114 AddFinalizer(result, external_data, ExternalByteArrayFinalize<ElementT>); | |
| 9115 return result.raw(); | |
| 9116 } | |
| 9117 | |
| 9118 | |
| 9119 intptr_t ByteArray::ByteLength() const { | |
| 9120 // ByteArray is an abstract class. | |
| 9121 UNREACHABLE(); | |
| 9122 return 0; | |
| 9123 } | |
| 9124 | |
| 9125 | |
| 8850 uint8_t* ByteArray::ByteAddr(intptr_t byte_offset) const { | 9126 uint8_t* ByteArray::ByteAddr(intptr_t byte_offset) const { |
| 8851 // ByteArray is an abstract class. | 9127 // ByteArray is an abstract class. |
| 8852 UNREACHABLE(); | 9128 UNREACHABLE(); |
| 8853 return NULL; | 9129 return NULL; |
| 8854 } | 9130 } |
| 8855 | 9131 |
| 8856 | 9132 |
| 8857 const char* ByteArray::ToCString() const { | 9133 const char* ByteArray::ToCString() const { |
| 8858 // ByteArray is an abstract class. | 9134 // ByteArray is an abstract class. |
| 8859 UNREACHABLE(); | 9135 UNREACHABLE(); |
| 8860 return "ByteArray"; | 9136 return "ByteArray"; |
| 8861 } | 9137 } |
| 8862 | 9138 |
| 8863 | 9139 |
| 8864 RawInternalByteArray* InternalByteArray::New(intptr_t len, | 9140 template<typename HandleT, typename RawT> |
| 8865 Heap::Space space) { | 9141 RawT* ByteArray::NewImpl(const Class& cls, intptr_t len, Heap::Space space) { |
| 8866 Isolate* isolate = Isolate::Current(); | 9142 HandleT& result = HandleT::Handle(); |
| 8867 const Class& internal_byte_array_class = | |
| 8868 Class::Handle(isolate->object_store()->internal_byte_array_class()); | |
| 8869 InternalByteArray& result = InternalByteArray::Handle(); | |
| 8870 { | 9143 { |
| 8871 RawObject* raw = Object::Allocate(internal_byte_array_class, | 9144 RawObject* raw = Object::Allocate(cls, HandleT::InstanceSize(len), space); |
| 8872 InternalByteArray::InstanceSize(len), | |
| 8873 space); | |
| 8874 NoGCScope no_gc; | 9145 NoGCScope no_gc; |
| 8875 result ^= raw; | 9146 result ^= raw; |
| 8876 result.SetLength(len); | 9147 result.SetLength(len); |
| 8877 if (len > 0) { | 9148 if (len > 0) { |
| 8878 memset(result.Addr<uint8_t>(0), 0, len); | 9149 memset(result.ByteAddr(0), 0, result.ByteLength()); |
| 8879 } | 9150 } |
| 8880 } | 9151 } |
| 8881 return result.raw(); | 9152 return result.raw(); |
| 8882 } | 9153 } |
| 8883 | 9154 |
| 8884 | 9155 |
| 8885 RawInternalByteArray* InternalByteArray::New(const uint8_t* data, | 9156 template<typename HandleT, typename RawT, typename ElementT> |
| 8886 intptr_t len, | 9157 RawT* ByteArray::NewImpl(const Class& cls, |
| 8887 Heap::Space space) { | 9158 const ElementT* data, |
| 8888 InternalByteArray& result = | 9159 intptr_t len, |
| 8889 InternalByteArray::Handle(InternalByteArray::New(len, space)); | 9160 Heap::Space space) { |
| 9161 HandleT& result = HandleT::Handle(); | |
| 8890 { | 9162 { |
| 9163 RawObject* raw = Object::Allocate(cls, HandleT::InstanceSize(len), space); | |
| 8891 NoGCScope no_gc; | 9164 NoGCScope no_gc; |
| 9165 result ^= raw; | |
| 9166 result.SetLength(len); | |
| 8892 if (len > 0) { | 9167 if (len > 0) { |
| 8893 memmove(result.Addr<uint8_t>(0), data, len); | 9168 memmove(result.ByteAddr(0), data, result.ByteLength()); |
| 8894 } | 9169 } |
| 8895 } | 9170 } |
| 8896 return result.raw(); | 9171 return result.raw(); |
| 8897 } | 9172 } |
| 8898 | 9173 |
| 8899 | 9174 |
| 8900 const char* InternalByteArray::ToCString() const { | 9175 RawInt8Array* Int8Array::New(intptr_t len, Heap::Space space) { |
| 8901 return "_InternalByteArray"; | 9176 Isolate* isolate = Isolate::Current(); |
| 8902 } | 9177 const Class& cls = |
| 8903 | 9178 Class::Handle(isolate->object_store()->int8_array_class()); |
| 8904 | 9179 return NewImpl<Int8Array, RawInt8Array>(cls, len, space); |
| 8905 void ExternalByteArray::Finalize(Dart_Handle handle, void* peer) { | 9180 } |
| 8906 delete reinterpret_cast<ExternalByteArrayData*>(peer); | 9181 |
| 8907 DeleteWeakPersistentHandle(handle); | 9182 |
| 8908 } | 9183 RawInt8Array* Int8Array::New(const int8_t* data, |
| 8909 | 9184 intptr_t len, |
| 8910 | 9185 Heap::Space space) { |
| 8911 RawExternalByteArray* ExternalByteArray::New(uint8_t* data, | 9186 Isolate* isolate = Isolate::Current(); |
| 9187 const Class& cls = | |
| 9188 Class::Handle(isolate->object_store()->int8_array_class()); | |
| 9189 return NewImpl<Int8Array, RawInt8Array>(cls, data, len, space); | |
| 9190 } | |
| 9191 | |
| 9192 | |
| 9193 const char* Int8Array::ToCString() const { | |
| 9194 return "_Int8Array"; | |
| 9195 } | |
| 9196 | |
| 9197 | |
| 9198 RawUint8Array* Uint8Array::New(intptr_t len, Heap::Space space) { | |
| 9199 Isolate* isolate = Isolate::Current(); | |
| 9200 const Class& cls = | |
| 9201 Class::Handle(isolate->object_store()->uint8_array_class()); | |
| 9202 return NewImpl<Uint8Array, RawUint8Array>(cls, len, space); | |
| 9203 } | |
| 9204 | |
| 9205 | |
| 9206 RawUint8Array* Uint8Array::New(const uint8_t* data, | |
| 9207 intptr_t len, | |
| 9208 Heap::Space space) { | |
| 9209 Isolate* isolate = Isolate::Current(); | |
| 9210 const Class& cls = | |
| 9211 Class::Handle(isolate->object_store()->uint8_array_class()); | |
| 9212 return NewImpl<Uint8Array, RawUint8Array>(cls, data, len, space); | |
| 9213 } | |
| 9214 | |
| 9215 | |
| 9216 const char* Uint8Array::ToCString() const { | |
| 9217 return "_Uint8Array"; | |
| 9218 } | |
| 9219 | |
| 9220 | |
| 9221 RawInt16Array* Int16Array::New(intptr_t len, Heap::Space space) { | |
| 9222 Isolate* isolate = Isolate::Current(); | |
| 9223 const Class& cls = | |
| 9224 Class::Handle(isolate->object_store()->int16_array_class()); | |
| 9225 return NewImpl<Int16Array, RawInt16Array>(cls, len, space); | |
| 9226 } | |
| 9227 | |
| 9228 | |
| 9229 RawInt16Array* Int16Array::New(const int16_t* data, | |
| 9230 intptr_t len, | |
| 9231 Heap::Space space) { | |
| 9232 Isolate* isolate = Isolate::Current(); | |
| 9233 const Class& cls = | |
| 9234 Class::Handle(isolate->object_store()->int16_array_class()); | |
| 9235 return NewImpl<Int16Array, RawInt16Array>(cls, data, len, space); | |
| 9236 } | |
| 9237 | |
| 9238 | |
| 9239 const char* Int16Array::ToCString() const { | |
| 9240 return "_Int16Array"; | |
| 9241 } | |
| 9242 | |
| 9243 | |
| 9244 RawUint16Array* Uint16Array::New(intptr_t len, Heap::Space space) { | |
| 9245 Isolate* isolate = Isolate::Current(); | |
| 9246 const Class& cls = | |
| 9247 Class::Handle(isolate->object_store()->uint16_array_class()); | |
| 9248 return NewImpl<Uint16Array, RawUint16Array>(cls, len, space); | |
| 9249 } | |
| 9250 | |
| 9251 | |
| 9252 RawUint16Array* Uint16Array::New(const uint16_t* data, | |
| 9253 intptr_t len, | |
| 9254 Heap::Space space) { | |
| 9255 Isolate* isolate = Isolate::Current(); | |
| 9256 const Class& cls = | |
| 9257 Class::Handle(isolate->object_store()->uint16_array_class()); | |
| 9258 return NewImpl<Uint16Array, RawUint16Array>(cls, data, len, space); | |
| 9259 } | |
| 9260 | |
| 9261 | |
| 9262 const char* Uint16Array::ToCString() const { | |
| 9263 return "_Uint16Array"; | |
| 9264 } | |
| 9265 | |
| 9266 | |
| 9267 RawInt32Array* Int32Array::New(intptr_t len, Heap::Space space) { | |
| 9268 Isolate* isolate = Isolate::Current(); | |
| 9269 const Class& cls = | |
| 9270 Class::Handle(isolate->object_store()->int32_array_class()); | |
| 9271 return NewImpl<Int32Array, RawInt32Array>(cls, len, space); | |
| 9272 } | |
| 9273 | |
| 9274 | |
| 9275 RawInt32Array* Int32Array::New(const int32_t* data, | |
| 9276 intptr_t len, | |
| 9277 Heap::Space space) { | |
| 9278 Isolate* isolate = Isolate::Current(); | |
| 9279 const Class& cls = | |
| 9280 Class::Handle(isolate->object_store()->int32_array_class()); | |
| 9281 return NewImpl<Int32Array, RawInt32Array>(cls, data, len, space); | |
| 9282 } | |
| 9283 | |
| 9284 | |
| 9285 const char* Int32Array::ToCString() const { | |
| 9286 return "_Int32Array"; | |
| 9287 } | |
| 9288 | |
| 9289 | |
| 9290 RawUint32Array* Uint32Array::New(intptr_t len, Heap::Space space) { | |
| 9291 Isolate* isolate = Isolate::Current(); | |
| 9292 const Class& cls = | |
| 9293 Class::Handle(isolate->object_store()->uint32_array_class()); | |
| 9294 return NewImpl<Uint32Array, RawUint32Array>(cls, len, space); | |
| 9295 } | |
| 9296 | |
| 9297 | |
| 9298 RawUint32Array* Uint32Array::New(const uint32_t* data, | |
| 9299 intptr_t len, | |
| 9300 Heap::Space space) { | |
| 9301 Isolate* isolate = Isolate::Current(); | |
| 9302 const Class& cls = | |
| 9303 Class::Handle(isolate->object_store()->uint32_array_class()); | |
| 9304 return NewImpl<Uint32Array, RawUint32Array>(cls, data, len, space); | |
| 9305 } | |
| 9306 | |
| 9307 | |
| 9308 const char* Uint32Array::ToCString() const { | |
| 9309 return "_Uint32Array"; | |
| 9310 } | |
| 9311 | |
| 9312 | |
| 9313 RawInt64Array* Int64Array::New(intptr_t len, Heap::Space space) { | |
| 9314 Isolate* isolate = Isolate::Current(); | |
| 9315 const Class& cls = | |
| 9316 Class::Handle(isolate->object_store()->int64_array_class()); | |
| 9317 return NewImpl<Int64Array, RawInt64Array>(cls, len, space); | |
| 9318 } | |
| 9319 | |
| 9320 | |
| 9321 RawInt64Array* Int64Array::New(const int64_t* data, | |
| 9322 intptr_t len, | |
| 9323 Heap::Space space) { | |
| 9324 Isolate* isolate = Isolate::Current(); | |
| 9325 const Class& cls = | |
| 9326 Class::Handle(isolate->object_store()->int64_array_class()); | |
| 9327 return NewImpl<Int64Array, RawInt64Array>(cls, data, len, space); | |
| 9328 } | |
| 9329 | |
| 9330 | |
| 9331 const char* Int64Array::ToCString() const { | |
| 9332 return "_Int64Array"; | |
| 9333 } | |
| 9334 | |
| 9335 | |
| 9336 RawUint64Array* Uint64Array::New(intptr_t len, Heap::Space space) { | |
| 9337 Isolate* isolate = Isolate::Current(); | |
| 9338 const Class& cls = | |
| 9339 Class::Handle(isolate->object_store()->uint64_array_class()); | |
| 9340 return NewImpl<Uint64Array, RawUint64Array>(cls, len, space); | |
| 9341 } | |
| 9342 | |
| 9343 | |
| 9344 RawUint64Array* Uint64Array::New(const uint64_t* data, | |
| 9345 intptr_t len, | |
| 9346 Heap::Space space) { | |
| 9347 Isolate* isolate = Isolate::Current(); | |
| 9348 const Class& cls = | |
| 9349 Class::Handle(isolate->object_store()->uint64_array_class()); | |
| 9350 return NewImpl<Uint64Array, RawUint64Array>(cls, data, len, space); | |
| 9351 } | |
| 9352 | |
| 9353 | |
| 9354 const char* Uint64Array::ToCString() const { | |
| 9355 return "_Uint64Array"; | |
| 9356 } | |
| 9357 | |
| 9358 | |
| 9359 RawFloat32Array* Float32Array::New(intptr_t len, Heap::Space space) { | |
| 9360 Isolate* isolate = Isolate::Current(); | |
| 9361 const Class& cls = | |
| 9362 Class::Handle(isolate->object_store()->float32_array_class()); | |
| 9363 return NewImpl<Float32Array, RawFloat32Array>(cls, len, space); | |
| 9364 } | |
| 9365 | |
| 9366 | |
| 9367 RawFloat32Array* Float32Array::New(const float* data, | |
| 9368 intptr_t len, | |
| 9369 Heap::Space space) { | |
| 9370 Isolate* isolate = Isolate::Current(); | |
| 9371 const Class& cls = | |
| 9372 Class::Handle(isolate->object_store()->float32_array_class()); | |
| 9373 return NewImpl<Float32Array, RawFloat32Array>(cls, data, len, space); | |
| 9374 } | |
| 9375 | |
| 9376 | |
| 9377 const char* Float32Array::ToCString() const { | |
| 9378 return "_Float32Array"; | |
| 9379 } | |
| 9380 | |
| 9381 | |
| 9382 RawFloat64Array* Float64Array::New(intptr_t len, Heap::Space space) { | |
| 9383 Isolate* isolate = Isolate::Current(); | |
| 9384 const Class& cls = | |
| 9385 Class::Handle(isolate->object_store()->float64_array_class()); | |
| 9386 return NewImpl<Float64Array, RawFloat64Array>(cls, len, space); | |
| 9387 } | |
| 9388 | |
| 9389 | |
| 9390 RawFloat64Array* Float64Array::New(const double* data, | |
| 9391 intptr_t len, | |
| 9392 Heap::Space space) { | |
| 9393 Isolate* isolate = Isolate::Current(); | |
| 9394 const Class& cls = | |
| 9395 Class::Handle(isolate->object_store()->float64_array_class()); | |
| 9396 return NewImpl<Float64Array, RawFloat64Array>(cls, data, len, space); | |
| 9397 } | |
| 9398 | |
| 9399 | |
| 9400 const char* Float64Array::ToCString() const { | |
| 9401 return "_Float64Array"; | |
| 9402 } | |
| 9403 | |
| 9404 | |
| 9405 RawExternalInt8Array* ExternalInt8Array::New(int8_t* data, | |
| 8912 intptr_t len, | 9406 intptr_t len, |
| 8913 void* peer, | 9407 void* peer, |
| 8914 Dart_PeerFinalizer callback, | 9408 Dart_PeerFinalizer callback, |
| 8915 Heap::Space space) { | 9409 Heap::Space space) { |
| 8916 Isolate* isolate = Isolate::Current(); | 9410 Isolate* isolate = Isolate::Current(); |
| 8917 const Class& external_byte_array_class = | 9411 const Class& cls = |
| 8918 Class::Handle(isolate->object_store()->external_byte_array_class()); | 9412 Class::Handle(isolate->object_store()->external_int8_array_class()); |
| 8919 ExternalByteArray& result = ExternalByteArray::Handle(); | 9413 return NewExternalImpl<ExternalInt8Array, RawExternalInt8Array>( |
| 8920 ExternalByteArrayData* external_data = | 9414 cls, data, len, peer, callback, space); |
| 8921 new ExternalByteArrayData(data, peer, callback); | 9415 } |
| 8922 { | 9416 |
| 8923 RawObject* raw = Object::Allocate(external_byte_array_class, | 9417 |
| 8924 ExternalByteArray::InstanceSize(), | 9418 const char* ExternalInt8Array::ToCString() const { |
| 8925 space); | 9419 return "_ExternalInt8Array"; |
| 8926 NoGCScope no_gc; | 9420 } |
| 8927 result ^= raw; | 9421 |
| 8928 result.SetLength(len); | 9422 |
| 8929 result.SetExternalData(external_data); | 9423 RawExternalUint8Array* ExternalUint8Array::New(uint8_t* data, |
| 8930 } | 9424 intptr_t len, |
| 8931 AddFinalizer(result, external_data, ExternalByteArray::Finalize); | 9425 void* peer, |
| 8932 return result.raw(); | 9426 Dart_PeerFinalizer callback, |
| 8933 } | 9427 Heap::Space space) { |
| 8934 | 9428 Isolate* isolate = Isolate::Current(); |
| 8935 | 9429 const Class& cls = |
| 8936 const char* ExternalByteArray::ToCString() const { | 9430 Class::Handle(isolate->object_store()->external_uint8_array_class()); |
| 8937 return "_ExternalByteArray"; | 9431 return NewExternalImpl<ExternalUint8Array, RawExternalUint8Array>( |
| 8938 } | 9432 cls, data, len, peer, callback, space); |
| 9433 } | |
| 9434 | |
| 9435 | |
| 9436 const char* ExternalUint8Array::ToCString() const { | |
| 9437 return "_ExternalUint8Array"; | |
| 9438 } | |
| 9439 | |
| 9440 | |
| 9441 RawExternalInt16Array* ExternalInt16Array::New(int16_t* data, | |
| 9442 intptr_t len, | |
| 9443 void* peer, | |
| 9444 Dart_PeerFinalizer callback, | |
| 9445 Heap::Space space) { | |
| 9446 Isolate* isolate = Isolate::Current(); | |
| 9447 const Class& cls = | |
| 9448 Class::Handle(isolate->object_store()->external_int16_array_class()); | |
| 9449 return NewExternalImpl<ExternalInt16Array, RawExternalInt16Array>( | |
| 9450 cls, data, len, peer, callback, space); | |
| 9451 } | |
| 9452 | |
| 9453 | |
| 9454 const char* ExternalInt16Array::ToCString() const { | |
| 9455 return "_ExternalInt16Array"; | |
| 9456 } | |
| 9457 | |
| 9458 | |
| 9459 RawExternalUint16Array* ExternalUint16Array::New(uint16_t* data, | |
| 9460 intptr_t len, | |
| 9461 void* peer, | |
| 9462 Dart_PeerFinalizer callback, | |
| 9463 Heap::Space space) { | |
| 9464 Isolate* isolate = Isolate::Current(); | |
| 9465 const Class& cls = | |
| 9466 Class::Handle(isolate->object_store()->external_uint16_array_class()); | |
| 9467 return NewExternalImpl<ExternalUint16Array, RawExternalUint16Array>( | |
| 9468 cls, data, len, peer, callback, space); | |
| 9469 } | |
| 9470 | |
| 9471 | |
| 9472 const char* ExternalUint16Array::ToCString() const { | |
| 9473 return "_ExternalUint16Array"; | |
| 9474 } | |
| 9475 | |
| 9476 | |
| 9477 RawExternalInt32Array* ExternalInt32Array::New(int32_t* data, | |
| 9478 intptr_t len, | |
| 9479 void* peer, | |
| 9480 Dart_PeerFinalizer callback, | |
| 9481 Heap::Space space) { | |
| 9482 Isolate* isolate = Isolate::Current(); | |
| 9483 const Class& cls = | |
| 9484 Class::Handle(isolate->object_store()->external_int32_array_class()); | |
| 9485 return NewExternalImpl<ExternalInt32Array, RawExternalInt32Array>( | |
| 9486 cls, data, len, peer, callback, space); | |
| 9487 } | |
| 9488 | |
| 9489 | |
| 9490 const char* ExternalInt32Array::ToCString() const { | |
| 9491 return "_ExternalInt32Array"; | |
| 9492 } | |
| 9493 | |
| 9494 | |
| 9495 RawExternalUint32Array* ExternalUint32Array::New(uint32_t* data, | |
| 9496 intptr_t len, | |
| 9497 void* peer, | |
| 9498 Dart_PeerFinalizer callback, | |
| 9499 Heap::Space space) { | |
| 9500 Isolate* isolate = Isolate::Current(); | |
| 9501 const Class& cls = | |
| 9502 Class::Handle(isolate->object_store()->external_uint32_array_class()); | |
| 9503 return NewExternalImpl<ExternalUint32Array, RawExternalUint32Array>( | |
| 9504 cls, data, len, peer, callback, space); | |
| 9505 } | |
| 9506 | |
| 9507 | |
| 9508 const char* ExternalUint32Array::ToCString() const { | |
| 9509 return "_ExternalUint32Array"; | |
| 9510 } | |
| 9511 | |
| 9512 | |
| 9513 RawExternalInt64Array* ExternalInt64Array::New(int64_t* data, | |
| 9514 intptr_t len, | |
| 9515 void* peer, | |
| 9516 Dart_PeerFinalizer callback, | |
| 9517 Heap::Space space) { | |
| 9518 Isolate* isolate = Isolate::Current(); | |
| 9519 const Class& cls = | |
| 9520 Class::Handle(isolate->object_store()->external_int64_array_class()); | |
| 9521 return NewExternalImpl<ExternalInt64Array, RawExternalInt64Array>( | |
| 9522 cls, data, len, peer, callback, space); | |
| 9523 } | |
| 9524 | |
| 9525 | |
| 9526 const char* ExternalInt64Array::ToCString() const { | |
| 9527 return "_ExternalInt64Array"; | |
| 9528 } | |
| 9529 | |
| 9530 | |
| 9531 RawExternalUint64Array* ExternalUint64Array::New(uint64_t* data, | |
| 9532 intptr_t len, | |
| 9533 void* peer, | |
| 9534 Dart_PeerFinalizer callback, | |
| 9535 Heap::Space space) { | |
| 9536 Isolate* isolate = Isolate::Current(); | |
| 9537 const Class& cls = | |
| 9538 Class::Handle(isolate->object_store()->external_uint64_array_class()); | |
| 9539 return NewExternalImpl<ExternalUint64Array, RawExternalUint64Array>( | |
| 9540 cls, data, len, peer, callback, space); | |
| 9541 } | |
| 9542 | |
| 9543 | |
| 9544 const char* ExternalUint64Array::ToCString() const { | |
| 9545 return "_ExternalUint64Array"; | |
| 9546 } | |
| 9547 | |
| 9548 | |
| 9549 RawExternalFloat32Array* ExternalFloat32Array::New(float* data, | |
| 9550 intptr_t len, | |
| 9551 void* peer, | |
| 9552 Dart_PeerFinalizer callback, | |
| 9553 Heap::Space space) { | |
| 9554 Isolate* isolate = Isolate::Current(); | |
| 9555 const Class& cls = | |
| 9556 Class::Handle(isolate->object_store()->external_float32_array_class()); | |
| 9557 return NewExternalImpl<ExternalFloat32Array, RawExternalFloat32Array>( | |
| 9558 cls, data, len, peer, callback, space); | |
| 9559 } | |
| 9560 | |
| 9561 | |
| 9562 const char* ExternalFloat32Array::ToCString() const { | |
| 9563 return "_ExternalFloat32Array"; | |
| 9564 } | |
| 9565 | |
| 9566 | |
| 9567 RawExternalFloat64Array* ExternalFloat64Array::New(double* data, | |
| 9568 intptr_t len, | |
| 9569 void* peer, | |
| 9570 Dart_PeerFinalizer callback, | |
| 9571 Heap::Space space) { | |
| 9572 Isolate* isolate = Isolate::Current(); | |
| 9573 const Class& cls = | |
| 9574 Class::Handle(isolate->object_store()->external_float64_array_class()); | |
| 9575 return NewExternalImpl<ExternalFloat64Array, RawExternalFloat64Array>( | |
| 9576 cls, data, len, peer, callback, space); | |
| 9577 } | |
| 9578 | |
| 9579 | |
| 9580 const char* ExternalFloat64Array::ToCString() const { | |
| 9581 return "_ExternalFloat64Array"; | |
| 9582 } | |
| 9583 | |
| 8939 | 9584 |
| 8940 | 9585 |
| 8941 RawClosure* Closure::New(const Function& function, | 9586 RawClosure* Closure::New(const Function& function, |
| 8942 const Context& context, | 9587 const Context& context, |
| 8943 Heap::Space space) { | 9588 Heap::Space space) { |
| 8944 Isolate* isolate = Isolate::Current(); | 9589 Isolate* isolate = Isolate::Current(); |
| 8945 ASSERT(context.isolate() == isolate); | 9590 ASSERT(context.isolate() == isolate); |
| 8946 | 9591 |
| 8947 const Class& cls = Class::Handle(function.signature_class()); | 9592 const Class& cls = Class::Handle(function.signature_class()); |
| 8948 Closure& result = Closure::Handle(); | 9593 Closure& result = Closure::Handle(); |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9250 const String& str = String::Handle(pattern()); | 9895 const String& str = String::Handle(pattern()); |
| 9251 const char* format = "JSRegExp: pattern=%s flags=%s"; | 9896 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 9252 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 9897 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 9253 char* chars = reinterpret_cast<char*>( | 9898 char* chars = reinterpret_cast<char*>( |
| 9254 Isolate::Current()->current_zone()->Allocate(len + 1)); | 9899 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 9255 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 9900 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 9256 return chars; | 9901 return chars; |
| 9257 } | 9902 } |
| 9258 | 9903 |
| 9259 } // namespace dart | 9904 } // namespace dart |
| OLD | NEW |