| 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, 778824208) \ |
| 20 V(_Smi, get:bitLength, Smi_bitLength, 383447247) \ | 20 V(_Smi, get:bitLength, Smi_bitLength, 383506829) \ |
| 21 V(_Double, >, Double_greaterThan, 196653614) \ | 21 V(_Double, >, Double_greaterThan, 362762350) \ |
| 22 V(_Double, >=, Double_greaterEqualThan, 1420124977) \ | 22 V(_Double, >=, Double_greaterEqualThan, 718582133) \ |
| 23 V(_Double, <, Double_lessThan, 1368169970) \ | 23 V(_Double, <, Double_lessThan, 1628182512) \ |
| 24 V(_Double, <=, Double_lessEqualThan, 117083409) \ | 24 V(_Double, <=, Double_lessEqualThan, 1563024213) \ |
| 25 V(_Double, ==, Double_equal, 617620743) \ | 25 V(_Double, ==, Double_equal, 164470531) \ |
| 26 V(_Double, +, Double_add, 1618778505) \ | 26 V(_Double, +, Double_add, 1784887241) \ |
| 27 V(_Double, -, Double_sub, 355538766) \ | 27 V(_Double, -, Double_sub, 521647502) \ |
| 28 V(_Double, *, Double_mul, 1175404333) \ | 28 V(_Double, *, Double_mul, 1341513069) \ |
| 29 V(_Double, /, Double_div, 1079430731) \ | 29 V(_Double, /, Double_div, 1245539467) \ |
| 30 V(_Double, get:isNaN, Double_getIsNaN, 916596113) \ | 30 V(_Double, get:isNaN, Double_getIsNaN, 916655695) \ |
| 31 V(_Double, get:isNegative, Double_getIsNegative, 1711421660) \ | 31 V(_Double, get:isNegative, Double_getIsNegative, 1711481242) \ |
| 32 V(_Double, _mulFromInteger, Double_mulFromInteger, 1392340623) \ | 32 V(_Double, _mulFromInteger, Double_mulFromInteger, 1700378253) \ |
| 33 V(_Double, .fromInteger, Double_fromInteger, 2033384877) \ | 33 V(_Double, .fromInteger, Double_fromInteger, 1640357867) \ |
| 34 V(_List, ., List_Allocate, 176587978) \ | 34 V(_List, ., List_Allocate, 1951595340) \ |
| 35 V(_List, get:length, Array_getLength, 215183186) \ | 35 V(_List, get:length, Array_getLength, 215242768) \ |
| 36 V(_List, [], Array_getIndexed, 675155875) \ | 36 V(_List, [], Array_getIndexed, 2013292897) \ |
| 37 V(_List, []=, Array_setIndexed, 1228569706) \ | 37 V(_List, []=, Array_setIndexed, 40316074) \ |
| 38 V(_GrowableList, .withData, GrowableList_Allocate, 264792196) \ | 38 V(_GrowableList, .withData, GrowableList_Allocate, 2019248834) \ |
| 39 V(_GrowableList, get:length, GrowableList_getLength, 1654255033) \ | 39 V(_GrowableList, get:length, GrowableList_getLength, 1654314615) \ |
| 40 V(_GrowableList, get:_capacity, GrowableList_getCapacity, 817119794) \ | 40 V(_GrowableList, get:_capacity, GrowableList_getCapacity, 817179376) \ |
| 41 V(_GrowableList, [], GrowableList_getIndexed, 1282104248) \ | 41 V(_GrowableList, [], GrowableList_getIndexed, 472757622) \ |
| 42 V(_GrowableList, []=, GrowableList_setIndexed, 807019110) \ | 42 V(_GrowableList, []=, GrowableList_setIndexed, 1766249126) \ |
| 43 V(_GrowableList, _setLength, GrowableList_setLength, 823005129) \ | 43 V(_GrowableList, _setLength, GrowableList_setLength, 13658503) \ |
| 44 V(_GrowableList, _setData, GrowableList_setData, 970836644) \ | 44 V(_GrowableList, _setData, GrowableList_setData, 161490018) \ |
| 45 V(_GrowableList, add, GrowableList_add, 1667349856) \ | 45 V(_GrowableList, add, GrowableList_add, 860740388) \ |
| 46 V(_ImmutableList, [], ImmutableList_getIndexed, 1768793932) \ | 46 V(_ImmutableList, [], ImmutableList_getIndexed, 959447306) \ |
| 47 V(_ImmutableList, get:length, ImmutableList_getLength, 578762861) \ | 47 V(_ImmutableList, get:length, ImmutableList_getLength, 578822443) \ |
| 48 V(Object, ==, Object_equal, 1068471689) \ | 48 V(Object, ==, Object_equal, 695995403) \ |
| 49 V(_StringBase, get:hashCode, String_getHashCode, 654572819) \ | 49 V(_StringBase, get:hashCode, String_getHashCode, 654632401) \ |
| 50 V(_StringBase, get:isEmpty, String_getIsEmpty, 1599468763) \ | 50 V(_StringBase, get:isEmpty, String_getIsEmpty, 891223769) \ |
| 51 V(_StringBase, get:length, String_getLength, 1483549854) \ | 51 V(_StringBase, get:length, String_getLength, 1483609436) \ |
| 52 V(_StringBase, codeUnitAt, String_codeUnitAt, 1958436584) \ | 52 V(_StringBase, codeUnitAt, String_codeUnitAt, 1958436584) \ |
| 53 V(_OneByteString, get:hashCode, OneByteString_getHashCode, 1236493807) \ | 53 V(_OneByteString, get:hashCode, OneByteString_getHashCode, 1236553389) \ |
| 54 V(_OneByteString, _substringUncheckedNative, \ | 54 V(_OneByteString, _substringUncheckedNative, \ |
| 55 OneByteString_substringUnchecked, 25652388) \ | 55 OneByteString_substringUnchecked, 25652388) \ |
| 56 V(_OneByteString, _setAt, OneByteString_setAt, 658941003) \ | 56 V(_OneByteString, _setAt, OneByteString_setAt, 1360005581) \ |
| 57 V(_OneByteString, _allocate, OneByteString_allocate, 2084097266) \ | 57 V(_OneByteString, _allocate, OneByteString_allocate, 616671988) \ |
| 58 V(_OneByteString, ==, OneByteString_equality, 1194175975) \ | 58 V(_OneByteString, ==, OneByteString_equality, 1454248037) \ |
| 59 V(_TwoByteString, ==, TwoByteString_equality, 1746891238) \ | 59 V(_TwoByteString, ==, TwoByteString_equality, 2006963300) \ |
| 60 | 60 |
| 61 | 61 |
| 62 #define CORE_INTEGER_LIB_INTRINSIC_LIST(V) \ | 62 #define CORE_INTEGER_LIB_INTRINSIC_LIST(V) \ |
| 63 V(_IntegerImplementation, _addFromInteger, Integer_addFromInteger, \ | 63 V(_IntegerImplementation, _addFromInteger, Integer_addFromInteger, \ |
| 64 740884607) \ | 64 740884607) \ |
| 65 V(_IntegerImplementation, +, Integer_add, 1875695122) \ | 65 V(_IntegerImplementation, +, Integer_add, 1933970388) \ |
| 66 V(_IntegerImplementation, _subFromInteger, Integer_subFromInteger, \ | 66 V(_IntegerImplementation, _subFromInteger, Integer_subFromInteger, \ |
| 67 584777821) \ | 67 584777821) \ |
| 68 V(_IntegerImplementation, -, Integer_sub, 893955487) \ | 68 V(_IntegerImplementation, -, Integer_sub, 952230753) \ |
| 69 V(_IntegerImplementation, _mulFromInteger, Integer_mulFromInteger, \ | 69 V(_IntegerImplementation, _mulFromInteger, Integer_mulFromInteger, \ |
| 70 1757603756) \ | 70 1757603756) \ |
| 71 V(_IntegerImplementation, *, Integer_mul, 949111327) \ | 71 V(_IntegerImplementation, *, Integer_mul, 1007386593) \ |
| 72 V(_IntegerImplementation, _moduloFromInteger, Integer_moduloFromInteger, \ | 72 V(_IntegerImplementation, _moduloFromInteger, Integer_moduloFromInteger, \ |
| 73 1398988805) \ | 73 1398988805) \ |
| 74 V(_IntegerImplementation, ~/, Integer_truncDivide, 1011141318) \ | 74 V(_IntegerImplementation, ~/, Integer_truncDivide, 802502724) \ |
| 75 V(_IntegerImplementation, unary-, Integer_negate, 145678255) \ | 75 V(_IntegerImplementation, unary-, Integer_negate, 1901981997) \ |
| 76 V(_IntegerImplementation, _bitAndFromInteger, \ | 76 V(_IntegerImplementation, _bitAndFromInteger, \ |
| 77 Integer_bitAndFromInteger, 512285096) \ | 77 Integer_bitAndFromInteger, 512285096) \ |
| 78 V(_IntegerImplementation, &, Integer_bitAnd, 691305985) \ | 78 V(_IntegerImplementation, &, Integer_bitAnd, 749581251) \ |
| 79 V(_IntegerImplementation, _bitOrFromInteger, \ | 79 V(_IntegerImplementation, _bitOrFromInteger, \ |
| 80 Integer_bitOrFromInteger, 333543947) \ | 80 Integer_bitOrFromInteger, 333543947) \ |
| 81 V(_IntegerImplementation, |, Integer_bitOr, 76287380) \ | 81 V(_IntegerImplementation, |, Integer_bitOr, 134562646) \ |
| 82 V(_IntegerImplementation, _bitXorFromInteger, \ | 82 V(_IntegerImplementation, _bitXorFromInteger, \ |
| 83 Integer_bitXorFromInteger, 1746295953) \ | 83 Integer_bitXorFromInteger, 1746295953) \ |
| 84 V(_IntegerImplementation, ^, Integer_bitXor, 1124672916) \ | 84 V(_IntegerImplementation, ^, Integer_bitXor, 1182948182) \ |
| 85 V(_IntegerImplementation, \ | 85 V(_IntegerImplementation, \ |
| 86 _greaterThanFromInteger, \ | 86 _greaterThanFromInteger, \ |
| 87 Integer_greaterThanFromInt, 1883218996) \ | 87 Integer_greaterThanFromInt, 1883218996) \ |
| 88 V(_IntegerImplementation, >, Integer_greaterThan, 1356697302) \ | 88 V(_IntegerImplementation, >, Integer_greaterThan, 1414972568) \ |
| 89 V(_IntegerImplementation, ==, Integer_equal, 1631095021) \ | 89 V(_IntegerImplementation, ==, Integer_equal, 1094806319) \ |
| 90 V(_IntegerImplementation, _equalToInteger, Integer_equalToInteger, \ | 90 V(_IntegerImplementation, _equalToInteger, Integer_equalToInteger, \ |
| 91 111745915) \ | 91 111745915) \ |
| 92 V(_IntegerImplementation, <, Integer_lessThan, 1523713072) \ | 92 V(_IntegerImplementation, <, Integer_lessThan, 1783725614) \ |
| 93 V(_IntegerImplementation, <=, Integer_lessEqualThan, 671929679) \ | 93 V(_IntegerImplementation, <=, Integer_lessEqualThan, 2117870483) \ |
| 94 V(_IntegerImplementation, >=, Integer_greaterEqualThan, 1974971247) \ | 94 V(_IntegerImplementation, >=, Integer_greaterEqualThan, 1273428403) \ |
| 95 V(_IntegerImplementation, <<, Integer_shl, 521759411) \ | 95 V(_IntegerImplementation, <<, Integer_shl, 580034677) \ |
| 96 V(_IntegerImplementation, >>, Integer_sar, 800510700) \ | 96 V(_IntegerImplementation, >>, Integer_sar, 858785966) \ |
| 97 V(_Double, toInt, Double_toInt, 1328149975) | 97 V(_Double, toInt, Double_toInt, 1328149975) |
| 98 | 98 |
| 99 | 99 |
| 100 #define MATH_LIB_INTRINSIC_LIST(V) \ | 100 #define MATH_LIB_INTRINSIC_LIST(V) \ |
| 101 V(::, sqrt, Math_sqrt, 465520247) \ | 101 V(::, sqrt, Math_sqrt, 465520247) \ |
| 102 V(::, sin, Math_sin, 730107143) \ | 102 V(::, sin, Math_sin, 730107143) \ |
| 103 V(::, cos, Math_cos, 1282146521) \ | 103 V(::, cos, Math_cos, 1282146521) \ |
| 104 V(_Random, _nextState, Random_nextState, 1174301422) \ | 104 V(_Random, _nextState, Random_nextState, 1231559724) \ |
| 105 | 105 |
| 106 | 106 |
| 107 #define TYPED_DATA_LIB_INTRINSIC_LIST(V) \ | 107 #define TYPED_DATA_LIB_INTRINSIC_LIST(V) \ |
| 108 V(_TypedList, get:length, TypedData_getLength, 26646119) \ | 108 V(_TypedList, get:length, TypedData_getLength, 26705701) \ |
| 109 V(_Int8Array, _new, TypedData_Int8Array_new, 18350202) \ | 109 V(_Int8Array, _new, TypedData_Int8Array_new, 698408572) \ |
| 110 V(_Uint8Array, _new, TypedData_Uint8Array_new, 2118071523) \ | 110 V(_Uint8Array, _new, TypedData_Uint8Array_new, 650646245) \ |
| 111 V(_Uint8ClampedArray, _new, TypedData_Uint8ClampedArray_new, 908783182) \ | 111 V(_Uint8ClampedArray, _new, TypedData_Uint8ClampedArray_new, 1588841552) \ |
| 112 V(_Int16Array, _new, TypedData_Int16Array_new, 422885769) \ | 112 V(_Int16Array, _new, TypedData_Int16Array_new, 1102944139) \ |
| 113 V(_Uint16Array, _new, TypedData_Uint16Array_new, 1401544578) \ | 113 V(_Uint16Array, _new, TypedData_Uint16Array_new, 2081602948) \ |
| 114 V(_Int32Array, _new, TypedData_Int32Array_new, 204107275) \ | 114 V(_Int32Array, _new, TypedData_Int32Array_new, 884165645) \ |
| 115 V(_Uint32Array, _new, TypedData_Uint32Array_new, 941458944) \ | 115 V(_Uint32Array, _new, TypedData_Uint32Array_new, 1621517314) \ |
| 116 V(_Int64Array, _new, TypedData_Int64Array_new, 1022695954) \ | 116 V(_Int64Array, _new, TypedData_Int64Array_new, 1702754324) \ |
| 117 V(_Uint64Array, _new, TypedData_Uint64Array_new, 728124050) \ | 117 V(_Uint64Array, _new, TypedData_Uint64Array_new, 1408182420) \ |
| 118 V(_Float32Array, _new, TypedData_Float32Array_new, 123728871) \ | 118 V(_Float32Array, _new, TypedData_Float32Array_new, 803787241) \ |
| 119 V(_Float64Array, _new, TypedData_Float64Array_new, 311965335) \ | 119 V(_Float64Array, _new, TypedData_Float64Array_new, 992023705) \ |
| 120 V(_Float32x4Array, _new, TypedData_Float32x4Array_new, 775330800) \ | 120 V(_Float32x4Array, _new, TypedData_Float32x4Array_new, 1455389170) \ |
| 121 V(_Int32x4Array, _new, TypedData_Int32x4Array_new, 2074077580) \ | 121 V(_Int32x4Array, _new, TypedData_Int32x4Array_new, 606652302) \ |
| 122 V(_Int8Array, ., TypedData_Int8Array_factory, 545976988) \ | 122 V(_Int8Array, ., TypedData_Int8Array_factory, 16429276) \ |
| 123 V(_Uint8Array, ., TypedData_Uint8Array_factory, 981297074) \ | 123 V(_Uint8Array, ., TypedData_Uint8Array_factory, 451749362) \ |
| 124 V(_Uint8ClampedArray, ., TypedData_Uint8ClampedArray_factory, 1617830104) \ | 124 V(_Uint8ClampedArray, ., TypedData_Uint8ClampedArray_factory, 1088282392) \ |
| 125 V(_Int16Array, ., TypedData_Int16Array_factory, 300928419) \ | 125 V(_Int16Array, ., TypedData_Int16Array_factory, 1918864355) \ |
| 126 V(_Uint16Array, ., TypedData_Uint16Array_factory, 480982704) \ | 126 V(_Uint16Array, ., TypedData_Uint16Array_factory, 2098918640) \ |
| 127 V(_Int32Array, ., TypedData_Int32Array_factory, 1876611964) \ | 127 V(_Int32Array, ., TypedData_Int32Array_factory, 1347064252) \ |
| 128 V(_Uint32Array, ., TypedData_Uint32Array_factory, 1811693442) \ | 128 V(_Uint32Array, ., TypedData_Uint32Array_factory, 1282145730) \ |
| 129 V(_Int64Array, ., TypedData_Int64Array_factory, 958749261) \ | 129 V(_Int64Array, ., TypedData_Int64Array_factory, 429201549) \ |
| 130 V(_Uint64Array, ., TypedData_Uint64Array_factory, 767338823) \ | 130 V(_Uint64Array, ., TypedData_Uint64Array_factory, 237791111) \ |
| 131 V(_Float32Array, ., TypedData_Float32Array_factory, 1721244151) \ | 131 V(_Float32Array, ., TypedData_Float32Array_factory, 1191696439) \ |
| 132 V(_Float64Array, ., TypedData_Float64Array_factory, 1599078532) \ | 132 V(_Float64Array, ., TypedData_Float64Array_factory, 1069530820) \ |
| 133 V(_Float32x4Array, ., TypedData_Float32x4Array_factory, 879975401) \ | 133 V(_Float32x4Array, ., TypedData_Float32x4Array_factory, 350427689) \ |
| 134 V(_Int32x4Array, ., TypedData_Int32x4Array_factory, 924582681) \ | 134 V(_Int32x4Array, ., TypedData_Int32x4Array_factory, 395034969) \ |
| 135 | 135 |
| 136 | 136 |
| 137 // TODO(srdjan): Implement _FixedSizeArrayIterator, get:current and | 137 // TODO(srdjan): Implement _FixedSizeArrayIterator, get:current and |
| 138 // _FixedSizeArrayIterator, moveNext. | 138 // _FixedSizeArrayIterator, moveNext. |
| 139 | 139 |
| 140 // Forward declarations. | 140 // Forward declarations. |
| 141 class Assembler; | 141 class Assembler; |
| 142 class Function; | 142 class Function; |
| 143 | 143 |
| 144 class Intrinsifier : public AllStatic { | 144 class Intrinsifier : public AllStatic { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 158 CORE_INTEGER_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 158 CORE_INTEGER_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
| 159 MATH_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 159 MATH_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
| 160 TYPED_DATA_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 160 TYPED_DATA_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
| 161 | 161 |
| 162 #undef DECLARE_FUNCTION | 162 #undef DECLARE_FUNCTION |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 } // namespace dart | 165 } // namespace dart |
| 166 | 166 |
| 167 #endif // VM_INTRINSIFIER_H_ | 167 #endif // VM_INTRINSIFIER_H_ |
| OLD | NEW |