| 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, 664307604) \ | 19 V(_Smi, ~, Smi_bitNegate, 692936755) \ |
| 20 V(_Smi, get:bitLength, Smi_bitLength, 383387665) \ | 20 V(_Smi, get:bitLength, Smi_bitLength, 383417456) \ |
| 21 V(_Double, >, Double_greaterThan, 30544878) \ | 21 V(_Double, >, Double_greaterThan, 1187341070) \ |
| 22 V(_Double, >=, Double_greaterEqualThan, 2121667821) \ | 22 V(_Double, >=, Double_greaterEqualThan, 1770896399) \ |
| 23 V(_Double, <, Double_lessThan, 1108157428) \ | 23 V(_Double, <, Double_lessThan, 1238163699) \ |
| 24 V(_Double, <=, Double_lessEqualThan, 818626253) \ | 24 V(_Double, <=, Double_lessEqualThan, 467854831) \ |
| 25 V(_Double, ==, Double_equal, 1070770955) \ | 25 V(_Double, ==, Double_equal, 1917937673) \ |
| 26 V(_Double, +, Double_add, 1452669769) \ | 26 V(_Double, +, Double_add, 461982313) \ |
| 27 V(_Double, -, Double_sub, 189430030) \ | 27 V(_Double, -, Double_sub, 1346226222) \ |
| 28 V(_Double, *, Double_mul, 1009295597) \ | 28 V(_Double, *, Double_mul, 18608141) \ |
| 29 V(_Double, /, Double_div, 913321995) \ | 29 V(_Double, /, Double_div, 2070118187) \ |
| 30 V(_Double, get:isNaN, Double_getIsNaN, 916536531) \ | 30 V(_Double, get:isNaN, Double_getIsNaN, 916566322) \ |
| 31 V(_Double, get:isNegative, Double_getIsNegative, 1711362078) \ | 31 V(_Double, get:isNegative, Double_getIsNegative, 1711391869) \ |
| 32 V(_Double, _mulFromInteger, Double_mulFromInteger, 1084302993) \ | 32 V(_Double, _mulFromInteger, Double_mulFromInteger, 1238321808) \ |
| 33 V(_Double, .fromInteger, Double_fromInteger, 278928239) \ | 33 V(_Double, .fromInteger, Double_fromInteger, 82414734) \ |
| 34 V(_ObjectArray, ., ObjectArray_Allocate, 670697167) \ | 34 V(_ObjectArray, ., ObjectArray_Allocate, 1558200848) \ |
| 35 V(_ObjectArray, get:length, Array_getLength, 259352904) \ | 35 V(_ObjectArray, get:length, Array_getLength, 259382695) \ |
| 36 V(_ObjectArray, [], Array_getIndexed, 948693632) \ | 36 V(_ObjectArray, [], Array_getIndexed, 544020319) \ |
| 37 V(_ObjectArray, []=, Array_setIndexed, 1972174650) \ | 37 V(_ObjectArray, []=, Array_setIndexed, 304306010) \ |
| 38 V(_GrowableObjectArray, .withData, GrowableArray_Allocate, 816479366) \ | 38 V(_GrowableObjectArray, .withData, GrowableArray_Allocate, 619965861) \ |
| 39 V(_GrowableObjectArray, get:length, GrowableArray_getLength, 1160387405) \ | 39 V(_GrowableObjectArray, get:length, GrowableArray_getLength, 1160417196) \ |
| 40 V(_GrowableObjectArray, get:_capacity, GrowableArray_getCapacity, 1509811779)\ | 40 V(_GrowableObjectArray, get:_capacity, GrowableArray_getCapacity, 1509841570)\ |
| 41 V(_GrowableObjectArray, [], GrowableArray_getIndexed, 1355986080) \ | 41 V(_GrowableObjectArray, [], GrowableArray_getIndexed, 951312767) \ |
| 42 V(_GrowableObjectArray, []=, GrowableArray_setIndexed, 887241511) \ | 42 V(_GrowableObjectArray, []=, GrowableArray_setIndexed, 1366856519) \ |
| 43 V(_GrowableObjectArray, _setLength, GrowableArray_setLength, 1517447865) \ | 43 V(_GrowableObjectArray, _setLength, GrowableArray_setLength, 1112774552) \ |
| 44 V(_GrowableObjectArray, _setData, GrowableArray_setData, 1979105687) \ | 44 V(_GrowableObjectArray, _setData, GrowableArray_setData, 1574432374) \ |
| 45 V(_GrowableObjectArray, add, GrowableArray_add, 2112847740) \ | 45 V(_GrowableObjectArray, add, GrowableArray_add, 635801182) \ |
| 46 V(_ImmutableArray, [], ImmutableArray_getIndexed, 1750060378) \ | 46 V(_ImmutableArray, [], ImmutableArray_getIndexed, 1345387065) \ |
| 47 V(_ImmutableArray, get:length, ImmutableArray_getLength, 1341972207) \ | 47 V(_ImmutableArray, get:length, ImmutableArray_getLength, 1342001998) \ |
| 48 V(Object, ==, Object_equal, 806929805) \ | 48 V(Object, ==, Object_equal, 936042315) \ |
| 49 V(_StringBase, get:hashCode, String_getHashCode, 654513237) \ | 49 V(_StringBase, get:hashCode, String_getHashCode, 654543028) \ |
| 50 V(_StringBase, get:isEmpty, String_getIsEmpty, 160230109) \ | 50 V(_StringBase, get:isEmpty, String_getIsEmpty, 879849436) \ |
| 51 V(_StringBase, get:length, String_getLength, 1483490272) \ | 51 V(_StringBase, get:length, String_getLength, 1483520063) \ |
| 52 V(_StringBase, codeUnitAt, String_codeUnitAt, 1958436584) \ | 52 V(_StringBase, codeUnitAt, String_codeUnitAt, 1958436584) \ |
| 53 V(_OneByteString, get:hashCode, OneByteString_getHashCode, 1236434225) \ | 53 V(_OneByteString, get:hashCode, OneByteString_getHashCode, 1236464016) \ |
| 54 V(_OneByteString, _substringUncheckedNative, \ | 54 V(_OneByteString, _substringUncheckedNative, \ |
| 55 OneByteString_substringUnchecked, 25652388) \ | 55 OneByteString_substringUnchecked, 25652388) \ |
| 56 V(_OneByteString, _setAt, OneByteString_setAt, 2105360073) \ | 56 V(_OneByteString, _setAt, OneByteString_setAt, 308408714) \ |
| 57 V(_OneByteString, _allocate, OneByteString_allocate, 1404038896) \ | 57 V(_OneByteString, _allocate, OneByteString_allocate, 1744068081) \ |
| 58 | 58 |
| 59 | 59 |
| 60 #define CORE_INTEGER_LIB_INTRINSIC_LIST(V) \ | 60 #define CORE_INTEGER_LIB_INTRINSIC_LIST(V) \ |
| 61 V(_IntegerImplementation, _addFromInteger, Integer_addFromInteger, \ | 61 V(_IntegerImplementation, _addFromInteger, Integer_addFromInteger, \ |
| 62 740884607) \ | 62 740884607) \ |
| 63 V(_IntegerImplementation, +, Integer_add, 1817419856) \ | 63 V(_IntegerImplementation, +, Integer_add, 772815665) \ |
| 64 V(_IntegerImplementation, _subFromInteger, Integer_subFromInteger, \ | 64 V(_IntegerImplementation, _subFromInteger, Integer_subFromInteger, \ |
| 65 584777821) \ | 65 584777821) \ |
| 66 V(_IntegerImplementation, -, Integer_sub, 835680221) \ | 66 V(_IntegerImplementation, -, Integer_sub, 1938559678) \ |
| 67 V(_IntegerImplementation, _mulFromInteger, Integer_mulFromInteger, \ | 67 V(_IntegerImplementation, _mulFromInteger, Integer_mulFromInteger, \ |
| 68 1757603756) \ | 68 1757603756) \ |
| 69 V(_IntegerImplementation, *, Integer_mul, 890836061) \ | 69 V(_IntegerImplementation, *, Integer_mul, 1993715518) \ |
| 70 V(_IntegerImplementation, remainder, Integer_remainder, 1735980657) \ | 70 V(_IntegerImplementation, remainder, Integer_remainder, 1331308305) \ |
| 71 V(_IntegerImplementation, _moduloFromInteger, Integer_moduloFromInteger, \ | 71 V(_IntegerImplementation, _moduloFromInteger, Integer_moduloFromInteger, \ |
| 72 1398988805) \ | 72 1398988805) \ |
| 73 V(_IntegerImplementation, ~/, Integer_truncDivide, 1219779912) \ | 73 V(_IntegerImplementation, ~/, Integer_truncDivide, 41718791) \ |
| 74 V(_IntegerImplementation, unary-, Integer_negate, 536858161) \ | 74 V(_IntegerImplementation, unary-, Integer_negate, 341268208) \ |
| 75 V(_IntegerImplementation, _bitAndFromInteger, \ | 75 V(_IntegerImplementation, _bitAndFromInteger, \ |
| 76 Integer_bitAndFromInteger, 512285096) \ | 76 Integer_bitAndFromInteger, 512285096) \ |
| 77 V(_IntegerImplementation, &, Integer_bitAnd, 633030719) \ | 77 V(_IntegerImplementation, &, Integer_bitAnd, 1735910176) \ |
| 78 V(_IntegerImplementation, _bitOrFromInteger, \ | 78 V(_IntegerImplementation, _bitOrFromInteger, \ |
| 79 Integer_bitOrFromInteger, 333543947) \ | 79 Integer_bitOrFromInteger, 333543947) \ |
| 80 V(_IntegerImplementation, |, Integer_bitOr, 18012114) \ | 80 V(_IntegerImplementation, |, Integer_bitOr, 1120891571) \ |
| 81 V(_IntegerImplementation, _bitXorFromInteger, \ | 81 V(_IntegerImplementation, _bitXorFromInteger, \ |
| 82 Integer_bitXorFromInteger, 1746295953) \ | 82 Integer_bitXorFromInteger, 1746295953) \ |
| 83 V(_IntegerImplementation, ^, Integer_bitXor, 1066397650) \ | 83 V(_IntegerImplementation, ^, Integer_bitXor, 21793459) \ |
| 84 V(_IntegerImplementation, \ | 84 V(_IntegerImplementation, \ |
| 85 _greaterThanFromInteger, \ | 85 _greaterThanFromInteger, \ |
| 86 Integer_greaterThanFromInt, 1883218996) \ | 86 Integer_greaterThanFromInt, 1883218996) \ |
| 87 V(_IntegerImplementation, >, Integer_greaterThan, 1298422036) \ | 87 V(_IntegerImplementation, >, Integer_greaterThan, 253817845) \ |
| 88 V(_IntegerImplementation, ==, Integer_equal, 19900075) \ | 88 V(_IntegerImplementation, ==, Integer_equal, 1899239372) \ |
| 89 V(_IntegerImplementation, _equalToInteger, Integer_equalToInteger, \ | 89 V(_IntegerImplementation, _equalToInteger, Integer_equalToInteger, \ |
| 90 111745915) \ | 90 111745915) \ |
| 91 V(_IntegerImplementation, <, Integer_lessThan, 1263700530) \ | 91 V(_IntegerImplementation, <, Integer_lessThan, 1393706801) \ |
| 92 V(_IntegerImplementation, <=, Integer_lessEqualThan, 1373472523) \ | 92 V(_IntegerImplementation, <=, Integer_lessEqualThan, 1022701101) \ |
| 93 V(_IntegerImplementation, >=, Integer_greaterEqualThan, 529030443) \ | 93 V(_IntegerImplementation, >=, Integer_greaterEqualThan, 178259021) \ |
| 94 V(_IntegerImplementation, <<, Integer_shl, 463484145) \ | 94 V(_IntegerImplementation, <<, Integer_shl, 1566363602) \ |
| 95 V(_IntegerImplementation, >>, Integer_sar, 742235434) \ | 95 V(_IntegerImplementation, >>, Integer_sar, 1845114891) \ |
| 96 V(_Double, toInt, Double_toInt, 1328149975) | 96 V(_Double, toInt, Double_toInt, 1328149975) |
| 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, 465520247) \ |
| 101 V(::, sin, Math_sin, 730107143) \ | 101 V(::, sin, Math_sin, 730107143) \ |
| 102 V(::, cos, Math_cos, 1282146521) \ | 102 V(::, cos, Math_cos, 1282146521) \ |
| 103 V(_Random, _nextState, Random_nextState, 1117043120) \ | 103 V(_Random, _nextState, Random_nextState, 1145672271) \ |
| 104 | 104 |
| 105 | 105 |
| 106 #define TYPED_DATA_LIB_INTRINSIC_LIST(V) \ | 106 #define TYPED_DATA_LIB_INTRINSIC_LIST(V) \ |
| 107 V(_TypedList, get:length, TypedData_getLength, 26586537) \ | 107 V(_TypedList, get:length, TypedData_getLength, 26616328) \ |
| 108 V(_Int8Array, _new, TypedData_Int8Array_new, 1485775480) \ | 108 V(_Int8Array, _new, TypedData_Int8Array_new, 1825804665) \ |
| 109 V(_Uint8Array, _new, TypedData_Uint8Array_new, 1438013153) \ | 109 V(_Uint8Array, _new, TypedData_Uint8Array_new, 1778042338) \ |
| 110 V(_Uint8ClampedArray, _new, TypedData_Uint8ClampedArray_new, 228724812) \ | 110 V(_Uint8ClampedArray, _new, TypedData_Uint8ClampedArray_new, 568753997) \ |
| 111 V(_Int16Array, _new, TypedData_Int16Array_new, 1890311047) \ | 111 V(_Int16Array, _new, TypedData_Int16Array_new, 82856584) \ |
| 112 V(_Uint16Array, _new, TypedData_Uint16Array_new, 721486208) \ | 112 V(_Uint16Array, _new, TypedData_Uint16Array_new, 1061515393) \ |
| 113 V(_Int32Array, _new, TypedData_Int32Array_new, 1671532553) \ | 113 V(_Int32Array, _new, TypedData_Int32Array_new, 2011561738) \ |
| 114 V(_Uint32Array, _new, TypedData_Uint32Array_new, 261400574) \ | 114 V(_Uint32Array, _new, TypedData_Uint32Array_new, 601429759) \ |
| 115 V(_Int64Array, _new, TypedData_Int64Array_new, 342637584) \ | 115 V(_Int64Array, _new, TypedData_Int64Array_new, 682666769) \ |
| 116 V(_Uint64Array, _new, TypedData_Uint64Array_new, 48065680) \ | 116 V(_Uint64Array, _new, TypedData_Uint64Array_new, 388094865) \ |
| 117 V(_Float32Array, _new, TypedData_Float32Array_new, 1591154149) \ | 117 V(_Float32Array, _new, TypedData_Float32Array_new, 1931183334) \ |
| 118 V(_Float64Array, _new, TypedData_Float64Array_new, 1779390613) \ | 118 V(_Float64Array, _new, TypedData_Float64Array_new, 2119419798) \ |
| 119 V(_Float32x4Array, _new, TypedData_Float32x4Array_new, 95272430) \ | 119 V(_Float32x4Array, _new, TypedData_Float32x4Array_new, 435301615) \ |
| 120 V(_Int8Array, ., TypedData_Int8Array_factory, 1075524700) \ | 120 V(_Int8Array, ., TypedData_Int8Array_factory, 810750844) \ |
| 121 V(_Uint8Array, ., TypedData_Uint8Array_factory, 1510844786) \ | 121 V(_Uint8Array, ., TypedData_Uint8Array_factory, 1246070930) \ |
| 122 V(_Uint8ClampedArray, ., TypedData_Uint8ClampedArray_factory, 2147377816) \ | 122 V(_Uint8ClampedArray, ., TypedData_Uint8ClampedArray_factory, 1882603960) \ |
| 123 V(_Int16Array, ., TypedData_Int16Array_factory, 830476131) \ | 123 V(_Int16Array, ., TypedData_Int16Array_factory, 565702275) \ |
| 124 V(_Uint16Array, ., TypedData_Uint16Array_factory, 1010530416) \ | 124 V(_Uint16Array, ., TypedData_Uint16Array_factory, 745756560) \ |
| 125 V(_Int32Array, ., TypedData_Int32Array_factory, 258676028) \ | 125 V(_Int32Array, ., TypedData_Int32Array_factory, 2141385820) \ |
| 126 V(_Uint32Array, ., TypedData_Uint32Array_factory, 193757506) \ | 126 V(_Uint32Array, ., TypedData_Uint32Array_factory, 2076467298) \ |
| 127 V(_Int64Array, ., TypedData_Int64Array_factory, 1488296973) \ | 127 V(_Int64Array, ., TypedData_Int64Array_factory, 1223523117) \ |
| 128 V(_Uint64Array, ., TypedData_Uint64Array_factory, 1296886535) \ | 128 V(_Uint64Array, ., TypedData_Uint64Array_factory, 1032112679) \ |
| 129 V(_Float32Array, ., TypedData_Float32Array_factory, 103308215) \ | 129 V(_Float32Array, ., TypedData_Float32Array_factory, 1986018007) \ |
| 130 V(_Float64Array, ., TypedData_Float64Array_factory, 2128626244) \ | 130 V(_Float64Array, ., TypedData_Float64Array_factory, 1863852388) \ |
| 131 V(_Float32x4Array, ., TypedData_Float32x4Array_factory, 1409523113) \ | 131 V(_Float32x4Array, ., TypedData_Float32x4Array_factory, 1144749257) \ |
| 132 | 132 |
| 133 // TODO(srdjan): Implement _FixedSizeArrayIterator, get:current and | 133 // TODO(srdjan): Implement _FixedSizeArrayIterator, get:current and |
| 134 // _FixedSizeArrayIterator, moveNext. | 134 // _FixedSizeArrayIterator, moveNext. |
| 135 | 135 |
| 136 // Forward declarations. | 136 // Forward declarations. |
| 137 class Assembler; | 137 class Assembler; |
| 138 class Function; | 138 class Function; |
| 139 | 139 |
| 140 class Intrinsifier : public AllStatic { | 140 class Intrinsifier : public AllStatic { |
| 141 public: | 141 public: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 154 CORE_INTEGER_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 154 CORE_INTEGER_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
| 155 MATH_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 155 MATH_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
| 156 TYPED_DATA_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 156 TYPED_DATA_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
| 157 | 157 |
| 158 #undef DECLARE_FUNCTION | 158 #undef DECLARE_FUNCTION |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 } // namespace dart | 161 } // namespace dart |
| 162 | 162 |
| 163 #endif // VM_INTRINSIFIER_H_ | 163 #endif // VM_INTRINSIFIER_H_ |
| OLD | NEW |