| 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 // Class for intrinsifying functions. | 4 // Class for intrinsifying functions. |
| 5 | 5 |
| 6 #ifndef VM_INTRINSIFIER_H_ | 6 #ifndef VM_INTRINSIFIER_H_ |
| 7 #define VM_INTRINSIFIER_H_ | 7 #define VM_INTRINSIFIER_H_ |
| 8 | 8 |
| 9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
| 10 | 10 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 // List of intrinsics: | 13 // List of intrinsics: |
| 14 // (class-name, function-name, intrinsification method, fingerprint). | 14 // (class-name, function-name, intrinsification method, fingerprint). |
| 15 // | 15 // |
| 16 // When adding a new function for intrinsification add a 0 as fingerprint, | 16 // When adding a new function for intrinsification add a 0 as fingerprint, |
| 17 // build and run to get the correct fingerprint from the mismatch error. | 17 // build and run to get the correct fingerprint from the mismatch error. |
| 18 #define CORE_LIB_INTRINSIC_LIST(V) \ | 18 #define CORE_LIB_INTRINSIC_LIST(V) \ |
| 19 V(_Smi, ~, Smi_bitNegate, 721565906) \ | 19 V(_Smi, ~, Smi_bitNegate, 105519892) \ |
| 20 V(_Smi, get:bitLength, Smi_bitLength, 383447247) \ | 20 V(_Smi, get:bitLength, Smi_bitLength, 869956497) \ |
| 21 V(_Double, >, Double_greaterThan, 196653614) \ | 21 V(_Double, >, Double_greaterThan, 381325711) \ |
| 22 V(_Double, >=, Double_greaterEqualThan, 1420124977) \ | 22 V(_Double, >=, Double_greaterEqualThan, 1409267140) \ |
| 23 V(_Double, <, Double_lessThan, 1368169970) \ | 23 V(_Double, <, Double_lessThan, 2080387973) \ |
| 24 V(_Double, <=, Double_lessEqualThan, 117083409) \ | 24 V(_Double, <=, Double_lessEqualThan, 106225572) \ |
| 25 V(_Double, ==, Double_equal, 617620743) \ | 25 V(_Double, ==, Double_equal, 2093918133) \ |
| 26 V(_Double, +, Double_add, 1618778505) \ | 26 V(_Double, +, Double_add, 1646350451) \ |
| 27 V(_Double, -, Double_sub, 355538766) \ | 27 V(_Double, -, Double_sub, 1477459276) \ |
| 28 V(_Double, *, Double_mul, 1175404333) \ | 28 V(_Double, *, Double_mul, 1334580777) \ |
| 29 V(_Double, /, Double_div, 1079430731) \ | 29 V(_Double, /, Double_div, 1938037155) \ |
| 30 V(_Double, get:isNaN, Double_getIsNaN, 916596113) \ | 30 V(_Double, get:isNaN, Double_getIsNaN, 843050033) \ |
| 31 V(_Double, get:isNegative, Double_getIsNegative, 1711421660) \ | 31 V(_Double, get:isNegative, Double_getIsNegative, 1637875580) \ |
| 32 V(_Double, _mulFromInteger, Double_mulFromInteger, 1392340623) \ | 32 V(_Double, _mulFromInteger, Double_mulFromInteger, 1594796483) \ |
| 33 V(_Double, .fromInteger, Double_fromInteger, 2033384877) \ | 33 V(_Double, .fromInteger, Double_fromInteger, 999771940) \ |
| 34 V(_List, get:length, Array_getLength, 215183186) \ | 34 V(_List, get:length, Array_getLength, 1181352729) \ |
| 35 V(_List, [], Array_getIndexed, 675155875) \ | 35 V(_List, [], Array_getIndexed, 795612476) \ |
| 36 V(_List, []=, Array_setIndexed, 1228569706) \ | 36 V(_List, []=, Array_setIndexed, 1288827575) \ |
| 37 V(_GrowableList, .withData, GrowableList_Allocate, 264792196) \ | 37 V(_GrowableList, .withData, GrowableList_Allocate, 732923072) \ |
| 38 V(_GrowableList, get:length, GrowableList_getLength, 1654255033) \ | 38 V(_GrowableList, get:length, GrowableList_getLength, 778505107) \ |
| 39 V(_GrowableList, get:_capacity, GrowableList_getCapacity, 817119794) \ | 39 V(_GrowableList, get:_capacity, GrowableList_getCapacity, 555140075) \ |
| 40 V(_GrowableList, [], GrowableList_getIndexed, 1282104248) \ | 40 V(_GrowableList, [], GrowableList_getIndexed, 919108233) \ |
| 41 V(_GrowableList, []=, GrowableList_setIndexed, 807019110) \ | 41 V(_GrowableList, []=, GrowableList_setIndexed, 1218649853) \ |
| 42 V(_GrowableList, _setLength, GrowableList_setLength, 823005129) \ | 42 V(_GrowableList, _setLength, GrowableList_setLength, 89389299) \ |
| 43 V(_GrowableList, _setData, GrowableList_setData, 970836644) \ | 43 V(_GrowableList, _setData, GrowableList_setData, 2126927509) \ |
| 44 V(_GrowableList, add, GrowableList_add, 1667349856) \ | 44 V(_GrowableList, add, GrowableList_add, 1899133961) \ |
| 45 V(_ImmutableList, [], ImmutableList_getIndexed, 1768793932) \ | 45 V(_ImmutableList, [], ImmutableList_getIndexed, 1990177341) \ |
| 46 V(_ImmutableList, get:length, ImmutableList_getLength, 578762861) \ | 46 V(_ImmutableList, get:length, ImmutableList_getLength, 274917727) \ |
| 47 V(Object, ==, Object_equal, 1068471689) \ | 47 V(Object, ==, Object_equal, 1068471689) \ |
| 48 V(_StringBase, get:hashCode, String_getHashCode, 654572819) \ | 48 V(_StringBase, get:hashCode, String_getHashCode, 2102906241) \ |
| 49 V(_StringBase, get:isEmpty, String_getIsEmpty, 1599468763) \ | 49 V(_StringBase, get:isEmpty, String_getIsEmpty, 49873871) \ |
| 50 V(_StringBase, get:length, String_getLength, 1483549854) \ | 50 V(_StringBase, get:length, String_getLength, 784399628) \ |
| 51 V(_StringBase, codeUnitAt, String_codeUnitAt, 1958436584) \ | 51 V(_StringBase, codeUnitAt, String_codeUnitAt, 397735324) \ |
| 52 V(_OneByteString, get:hashCode, OneByteString_getHashCode, 1236493807) \ | 52 V(_OneByteString, get:hashCode, OneByteString_getHashCode, 1111837929) \ |
| 53 V(_OneByteString, _substringUncheckedNative, \ | 53 V(_OneByteString, _substringUncheckedNative, \ |
| 54 OneByteString_substringUnchecked, 25652388) \ | 54 OneByteString_substringUnchecked, 1527498975) \ |
| 55 V(_OneByteString, _setAt, OneByteString_setAt, 658941003) \ | 55 V(_OneByteString, _setAt, OneByteString_setAt, 468605749) \ |
| 56 V(_OneByteString, _allocate, OneByteString_allocate, 2084097266) \ | 56 V(_OneByteString, _allocate, OneByteString_allocate, 2035417022) \ |
| 57 V(_OneByteString, ==, OneByteString_equality, 1194175975) \ | 57 V(_OneByteString, ==, OneByteString_equality, 1727047023) \ |
| 58 V(_TwoByteString, ==, TwoByteString_equality, 1746891238) \ | 58 V(_TwoByteString, ==, TwoByteString_equality, 951149689) \ |
| 59 | 59 |
| 60 | 60 |
| 61 #define CORE_INTEGER_LIB_INTRINSIC_LIST(V) \ | 61 #define CORE_INTEGER_LIB_INTRINSIC_LIST(V) \ |
| 62 V(_IntegerImplementation, _addFromInteger, Integer_addFromInteger, \ | 62 V(_IntegerImplementation, _addFromInteger, Integer_addFromInteger, \ |
| 63 740884607) \ | 63 438687793) \ |
| 64 V(_IntegerImplementation, +, Integer_add, 1875695122) \ | 64 V(_IntegerImplementation, +, Integer_add, 837070328) \ |
| 65 V(_IntegerImplementation, _subFromInteger, Integer_subFromInteger, \ | 65 V(_IntegerImplementation, _subFromInteger, Integer_subFromInteger, \ |
| 66 584777821) \ | 66 562800077) \ |
| 67 V(_IntegerImplementation, -, Integer_sub, 893955487) \ | 67 V(_IntegerImplementation, -, Integer_sub, 1904782019) \ |
| 68 V(_IntegerImplementation, _mulFromInteger, Integer_mulFromInteger, \ | 68 V(_IntegerImplementation, _mulFromInteger, Integer_mulFromInteger, \ |
| 69 1757603756) \ | 69 67891834) \ |
| 70 V(_IntegerImplementation, *, Integer_mul, 949111327) \ | 70 V(_IntegerImplementation, *, Integer_mul, 1012952097) \ |
| 71 V(_IntegerImplementation, _moduloFromInteger, Integer_moduloFromInteger, \ | 71 V(_IntegerImplementation, _moduloFromInteger, Integer_moduloFromInteger, \ |
| 72 1398988805) \ | 72 93478264) \ |
| 73 V(_IntegerImplementation, ~/, Integer_truncDivide, 1011141318) \ | 73 V(_IntegerImplementation, ~/, Integer_truncDivide, 724644222) \ |
| 74 V(_IntegerImplementation, unary-, Integer_negate, 145678255) \ | 74 V(_IntegerImplementation, unary-, Integer_negate, 2095203689) \ |
| 75 V(_IntegerImplementation, _bitAndFromInteger, \ | 75 V(_IntegerImplementation, _bitAndFromInteger, \ |
| 76 Integer_bitAndFromInteger, 512285096) \ | 76 Integer_bitAndFromInteger, 504496713) \ |
| 77 V(_IntegerImplementation, &, Integer_bitAnd, 691305985) \ | 77 V(_IntegerImplementation, &, Integer_bitAnd, 347192674) \ |
| 78 V(_IntegerImplementation, _bitOrFromInteger, \ | 78 V(_IntegerImplementation, _bitOrFromInteger, \ |
| 79 Integer_bitOrFromInteger, 333543947) \ | 79 Integer_bitOrFromInteger, 1763728073) \ |
| 80 V(_IntegerImplementation, |, Integer_bitOr, 76287380) \ | 80 V(_IntegerImplementation, |, Integer_bitOr, 1293445202) \ |
| 81 V(_IntegerImplementation, _bitXorFromInteger, \ | 81 V(_IntegerImplementation, _bitXorFromInteger, \ |
| 82 Integer_bitXorFromInteger, 1746295953) \ | 82 Integer_bitXorFromInteger, 281425907) \ |
| 83 V(_IntegerImplementation, ^, Integer_bitXor, 1124672916) \ | 83 V(_IntegerImplementation, ^, Integer_bitXor, 2139935734) \ |
| 84 V(_IntegerImplementation, \ | 84 V(_IntegerImplementation, \ |
| 85 _greaterThanFromInteger, \ | 85 _greaterThanFromInteger, \ |
| 86 Integer_greaterThanFromInt, 1883218996) \ | 86 Integer_greaterThanFromInt, 787426822) \ |
| 87 V(_IntegerImplementation, >, Integer_greaterThan, 1356697302) \ | 87 V(_IntegerImplementation, >, Integer_greaterThan, 123961041) \ |
| 88 V(_IntegerImplementation, ==, Integer_equal, 1631095021) \ | 88 V(_IntegerImplementation, ==, Integer_equal, 1423724294) \ |
| 89 V(_IntegerImplementation, _equalToInteger, Integer_equalToInteger, \ | 89 V(_IntegerImplementation, _equalToInteger, Integer_equalToInteger, \ |
| 90 111745915) \ | 90 1790821042) \ |
| 91 V(_IntegerImplementation, <, Integer_lessThan, 1523713072) \ | 91 V(_IntegerImplementation, <, Integer_lessThan, 425560117) \ |
| 92 V(_IntegerImplementation, <=, Integer_lessEqualThan, 671929679) \ | 92 V(_IntegerImplementation, <=, Integer_lessEqualThan, 1512735828) \ |
| 93 V(_IntegerImplementation, >=, Integer_greaterEqualThan, 1974971247) \ | 93 V(_IntegerImplementation, >=, Integer_greaterEqualThan, 668293748) \ |
| 94 V(_IntegerImplementation, <<, Integer_shl, 521759411) \ | 94 V(_IntegerImplementation, <<, Integer_shl, 34265041) \ |
| 95 V(_IntegerImplementation, >>, Integer_sar, 800510700) \ | 95 V(_IntegerImplementation, >>, Integer_sar, 1797129864) \ |
| 96 V(_Double, toInt, Double_toInt, 1328149975) | 96 V(_Double, toInt, Double_toInt, 1547535151) |
| 97 | 97 |
| 98 | 98 |
| 99 #define MATH_LIB_INTRINSIC_LIST(V) \ | 99 #define MATH_LIB_INTRINSIC_LIST(V) \ |
| 100 V(::, sqrt, Math_sqrt, 465520247) \ | 100 V(::, sqrt, Math_sqrt, 101545548) \ |
| 101 V(_Random, _nextState, Random_nextState, 1174301422) \ | 101 V(_Random, _nextState, Random_nextState, 55890711) \ |
| 102 | 102 |
| 103 | 103 |
| 104 #define TYPED_DATA_LIB_INTRINSIC_LIST(V) \ | 104 #define TYPED_DATA_LIB_INTRINSIC_LIST(V) \ |
| 105 V(_TypedList, get:length, TypedData_getLength, 26646119) \ | 105 V(_TypedList, get:length, TypedData_getLength, 522565357) \ |
| 106 V(_Int8Array, _new, TypedData_Int8Array_new, 18350202) \ | 106 V(_Int8Array, _new, TypedData_Int8Array_new, 1150131819) \ |
| 107 V(_Uint8Array, _new, TypedData_Uint8Array_new, 2118071523) \ | 107 V(_Uint8Array, _new, TypedData_Uint8Array_new, 2019665760) \ |
| 108 V(_Uint8ClampedArray, _new, TypedData_Uint8ClampedArray_new, 908783182) \ | 108 V(_Uint8ClampedArray, _new, TypedData_Uint8ClampedArray_new, 726412668) \ |
| 109 V(_Int16Array, _new, TypedData_Int16Array_new, 422885769) \ | 109 V(_Int16Array, _new, TypedData_Int16Array_new, 1879541015) \ |
| 110 V(_Uint16Array, _new, TypedData_Uint16Array_new, 1401544578) \ | 110 V(_Uint16Array, _new, TypedData_Uint16Array_new, 189496401) \ |
| 111 V(_Int32Array, _new, TypedData_Int32Array_new, 204107275) \ | 111 V(_Int32Array, _new, TypedData_Int32Array_new, 1725327048) \ |
| 112 V(_Uint32Array, _new, TypedData_Uint32Array_new, 941458944) \ | 112 V(_Uint32Array, _new, TypedData_Uint32Array_new, 10306485) \ |
| 113 V(_Int64Array, _new, TypedData_Int64Array_new, 1022695954) \ | 113 V(_Int64Array, _new, TypedData_Int64Array_new, 1299501918) \ |
| 114 V(_Uint64Array, _new, TypedData_Uint64Array_new, 728124050) \ | 114 V(_Uint64Array, _new, TypedData_Uint64Array_new, 1635318703) \ |
| 115 V(_Float32Array, _new, TypedData_Float32Array_new, 123728871) \ | 115 V(_Float32Array, _new, TypedData_Float32Array_new, 577737480) \ |
| 116 V(_Float64Array, _new, TypedData_Float64Array_new, 311965335) \ | 116 V(_Float64Array, _new, TypedData_Float64Array_new, 645355686) \ |
| 117 V(_Float32x4Array, _new, TypedData_Float32x4Array_new, 775330800) \ | 117 V(_Float32x4Array, _new, TypedData_Float32x4Array_new, 596639418) \ |
| 118 V(_Int32x4Array, _new, TypedData_Int32x4Array_new, 2074077580) \ | 118 V(_Int32x4Array, _new, TypedData_Int32x4Array_new, 496358233) \ |
| 119 V(_Float64x2Array, _new, TypedData_Float64x2Array_new, 1540328543) \ | 119 V(_Float64x2Array, _new, TypedData_Float64x2Array_new, 1506975080) \ |
| 120 V(_Int8Array, ., TypedData_Int8Array_factory, 545976988) \ | 120 V(_Int8Array, ., TypedData_Int8Array_factory, 1499010120) \ |
| 121 V(_Uint8Array, ., TypedData_Uint8Array_factory, 981297074) \ | 121 V(_Uint8Array, ., TypedData_Uint8Array_factory, 354210806) \ |
| 122 V(_Uint8ClampedArray, ., TypedData_Uint8ClampedArray_factory, 1617830104) \ | 122 V(_Uint8ClampedArray, ., TypedData_Uint8ClampedArray_factory, 231626935) \ |
| 123 V(_Int16Array, ., TypedData_Int16Array_factory, 300928419) \ | 123 V(_Int16Array, ., TypedData_Int16Array_factory, 1044203454) \ |
| 124 V(_Uint16Array, ., TypedData_Uint16Array_factory, 480982704) \ | 124 V(_Uint16Array, ., TypedData_Uint16Array_factory, 616427808) \ |
| 125 V(_Int32Array, ., TypedData_Int32Array_factory, 1876611964) \ | 125 V(_Int32Array, ., TypedData_Int32Array_factory, 26656923) \ |
| 126 V(_Uint32Array, ., TypedData_Uint32Array_factory, 1811693442) \ | 126 V(_Uint32Array, ., TypedData_Uint32Array_factory, 297463966) \ |
| 127 V(_Int64Array, ., TypedData_Int64Array_factory, 958749261) \ | 127 V(_Int64Array, ., TypedData_Int64Array_factory, 105050331) \ |
| 128 V(_Uint64Array, ., TypedData_Uint64Array_factory, 767338823) \ | 128 V(_Uint64Array, ., TypedData_Uint64Array_factory, 1469861670) \ |
| 129 V(_Float32Array, ., TypedData_Float32Array_factory, 1721244151) \ | 129 V(_Float32Array, ., TypedData_Float32Array_factory, 105860920) \ |
| 130 V(_Float64Array, ., TypedData_Float64Array_factory, 1599078532) \ | 130 V(_Float64Array, ., TypedData_Float64Array_factory, 342242776) \ |
| 131 V(_Float32x4Array, ., TypedData_Float32x4Array_factory, 879975401) \ | 131 V(_Float32x4Array, ., TypedData_Float32x4Array_factory, 1217848993) \ |
| 132 V(_Int32x4Array, ., TypedData_Int32x4Array_factory, 924582681) \ | 132 V(_Int32x4Array, ., TypedData_Int32x4Array_factory, 100825417) \ |
| 133 V(_Float64x2Array, ., TypedData_Float64x2Array_factory, 1654170890) \ | 133 V(_Float64x2Array, ., TypedData_Float64x2Array_factory, 611308575) \ |
| 134 V(_Uint8Array, [], Uint8Array_getIndexed, 738731818) \ | 134 V(_Uint8Array, [], Uint8Array_getIndexed, 16125140) \ |
| 135 V(_ExternalUint8Array, [], ExternalUint8Array_getIndexed, 2067666479) \ | 135 V(_ExternalUint8Array, [], ExternalUint8Array_getIndexed, 1678777951) \ |
| 136 | 136 |
| 137 | 137 |
| 138 #define PROFILER_LIB_INTRINSIC_LIST(V) \ | 138 #define PROFILER_LIB_INTRINSIC_LIST(V) \ |
| 139 V(_UserTag, makeCurrent, UserTag_makeCurrent, 2084603703) \ | 139 V(_UserTag, makeCurrent, UserTag_makeCurrent, 370414636) \ |
| 140 V(::, _getDefaultTag, UserTag_defaultTag, 624228668) \ | 140 V(::, _getDefaultTag, UserTag_defaultTag, 1159885970) \ |
| 141 V(::, _getCurrentTag, Profiler_getCurrentTag, 1559793589) \ | 141 V(::, _getCurrentTag, Profiler_getCurrentTag, 1182126114) \ |
| 142 | 142 |
| 143 // TODO(srdjan): Implement _FixedSizeArrayIterator, get:current and | 143 // TODO(srdjan): Implement _FixedSizeArrayIterator, get:current and |
| 144 // _FixedSizeArrayIterator, moveNext. | 144 // _FixedSizeArrayIterator, moveNext. |
| 145 | 145 |
| 146 // Forward declarations. | 146 // Forward declarations. |
| 147 class Assembler; | 147 class Assembler; |
| 148 class Function; | 148 class Function; |
| 149 | 149 |
| 150 class Intrinsifier : public AllStatic { | 150 class Intrinsifier : public AllStatic { |
| 151 public: | 151 public: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 165 MATH_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 165 MATH_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
| 166 TYPED_DATA_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 166 TYPED_DATA_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
| 167 PROFILER_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 167 PROFILER_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
| 168 | 168 |
| 169 #undef DECLARE_FUNCTION | 169 #undef DECLARE_FUNCTION |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 } // namespace dart | 172 } // namespace dart |
| 173 | 173 |
| 174 #endif // VM_INTRINSIFIER_H_ | 174 #endif // VM_INTRINSIFIER_H_ |
| OLD | NEW |