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, 692936755) \ | 19 V(_Smi, ~, Smi_bitNegate, 721565906) \ |
20 V(_Smi, get:bitLength, Smi_bitLength, 383417456) \ | 20 V(_Smi, get:bitLength, Smi_bitLength, 383447247) \ |
21 V(_Double, >, Double_greaterThan, 1187341070) \ | 21 V(_Double, >, Double_greaterThan, 196653614) \ |
22 V(_Double, >=, Double_greaterEqualThan, 1770896399) \ | 22 V(_Double, >=, Double_greaterEqualThan, 1420124977) \ |
23 V(_Double, <, Double_lessThan, 1238163699) \ | 23 V(_Double, <, Double_lessThan, 1368169970) \ |
24 V(_Double, <=, Double_lessEqualThan, 467854831) \ | 24 V(_Double, <=, Double_lessEqualThan, 117083409) \ |
25 V(_Double, ==, Double_equal, 1917937673) \ | 25 V(_Double, ==, Double_equal, 617620743) \ |
26 V(_Double, +, Double_add, 461982313) \ | 26 V(_Double, +, Double_add, 1618778505) \ |
27 V(_Double, -, Double_sub, 1346226222) \ | 27 V(_Double, -, Double_sub, 355538766) \ |
28 V(_Double, *, Double_mul, 18608141) \ | 28 V(_Double, *, Double_mul, 1175404333) \ |
29 V(_Double, /, Double_div, 2070118187) \ | 29 V(_Double, /, Double_div, 1079430731) \ |
30 V(_Double, get:isNaN, Double_getIsNaN, 916566322) \ | 30 V(_Double, get:isNaN, Double_getIsNaN, 916596113) \ |
31 V(_Double, get:isNegative, Double_getIsNegative, 1711391869) \ | 31 V(_Double, get:isNegative, Double_getIsNegative, 1711421660) \ |
32 V(_Double, _mulFromInteger, Double_mulFromInteger, 1238321808) \ | 32 V(_Double, _mulFromInteger, Double_mulFromInteger, 1392340623) \ |
33 V(_Double, .fromInteger, Double_fromInteger, 82414734) \ | 33 V(_Double, .fromInteger, Double_fromInteger, 2033384877) \ |
34 V(_List, ., List_Allocate, 1436567945) \ | 34 V(_List, ., List_Allocate, 176587978) \ |
35 V(_List, get:length, Array_getLength, 215153395) \ | 35 V(_List, get:length, Array_getLength, 215183186) \ |
36 V(_List, [], Array_getIndexed, 1079829188) \ | 36 V(_List, [], Array_getIndexed, 675155875) \ |
37 V(_List, []=, Array_setIndexed, 748954698) \ | 37 V(_List, []=, Array_setIndexed, 1228569706) \ |
38 V(_GrowableList, .withData, GrowableList_Allocate, 461305701) \ | 38 V(_GrowableList, .withData, GrowableList_Allocate, 264792196) \ |
39 V(_GrowableList, get:length, GrowableList_getLength, 1654225242) \ | 39 V(_GrowableList, get:length, GrowableList_getLength, 1654255033) \ |
40 V(_GrowableList, get:_capacity, GrowableList_getCapacity, 817090003) \ | 40 V(_GrowableList, get:_capacity, GrowableList_getCapacity, 817119794) \ |
41 V(_GrowableList, [], GrowableList_getIndexed, 1686777561) \ | 41 V(_GrowableList, [], GrowableList_getIndexed, 1282104248) \ |
42 V(_GrowableList, []=, GrowableList_setIndexed, 327404102) \ | 42 V(_GrowableList, []=, GrowableList_setIndexed, 807019110) \ |
43 V(_GrowableList, _setLength, GrowableList_setLength, 1227678442) \ | 43 V(_GrowableList, _setLength, GrowableList_setLength, 823005129) \ |
44 V(_GrowableList, _setData, GrowableList_setData, 1375509957) \ | 44 V(_GrowableList, _setData, GrowableList_setData, 970836644) \ |
45 V(_GrowableList, add, GrowableList_add, 996912766) \ | 45 V(_GrowableList, add, GrowableList_add, 1667349856) \ |
46 V(_ImmutableList, [], ImmutableList_getIndexed, 25983597) \ | 46 V(_ImmutableList, [], ImmutableList_getIndexed, 1768793932) \ |
47 V(_ImmutableList, get:length, ImmutableList_getLength, 578733070) \ | 47 V(_ImmutableList, get:length, ImmutableList_getLength, 578762861) \ |
48 V(Object, ==, Object_equal, 180968008) \ | 48 V(Object, ==, Object_equal, 1068471689) \ |
49 V(_StringBase, get:hashCode, String_getHashCode, 654543028) \ | 49 V(_StringBase, get:hashCode, String_getHashCode, 654572819) \ |
50 V(_StringBase, get:isEmpty, String_getIsEmpty, 879849436) \ | 50 V(_StringBase, get:isEmpty, String_getIsEmpty, 1599468763) \ |
51 V(_StringBase, get:length, String_getLength, 1483520063) \ | 51 V(_StringBase, get:length, String_getLength, 1483549854) \ |
52 V(_StringBase, codeUnitAt, String_codeUnitAt, 1958436584) \ | 52 V(_StringBase, codeUnitAt, String_codeUnitAt, 1958436584) \ |
53 V(_OneByteString, get:hashCode, OneByteString_getHashCode, 1236464016) \ | 53 V(_OneByteString, get:hashCode, OneByteString_getHashCode, 1236493807) \ |
54 V(_OneByteString, _substringUncheckedNative, \ | 54 V(_OneByteString, _substringUncheckedNative, \ |
55 OneByteString_substringUnchecked, 25652388) \ | 55 OneByteString_substringUnchecked, 25652388) \ |
56 V(_OneByteString, _setAt, OneByteString_setAt, 308408714) \ | 56 V(_OneByteString, _setAt, OneByteString_setAt, 658941003) \ |
57 V(_OneByteString, _allocate, OneByteString_allocate, 1744068081) \ | 57 V(_OneByteString, _allocate, OneByteString_allocate, 2084097266) \ |
58 V(_OneByteString, ==, OneByteString_equality, 1064139944) \ | 58 V(_OneByteString, ==, OneByteString_equality, 1194175975) \ |
59 V(_TwoByteString, ==, TwoByteString_equality, 1616855207) \ | 59 V(_TwoByteString, ==, TwoByteString_equality, 1746891238) \ |
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, 772815665) \ | 65 V(_IntegerImplementation, +, Integer_add, 1875695122) \ |
66 V(_IntegerImplementation, _subFromInteger, Integer_subFromInteger, \ | 66 V(_IntegerImplementation, _subFromInteger, Integer_subFromInteger, \ |
67 584777821) \ | 67 584777821) \ |
68 V(_IntegerImplementation, -, Integer_sub, 1938559678) \ | 68 V(_IntegerImplementation, -, Integer_sub, 893955487) \ |
69 V(_IntegerImplementation, _mulFromInteger, Integer_mulFromInteger, \ | 69 V(_IntegerImplementation, _mulFromInteger, Integer_mulFromInteger, \ |
70 1757603756) \ | 70 1757603756) \ |
71 V(_IntegerImplementation, *, Integer_mul, 1993715518) \ | 71 V(_IntegerImplementation, *, Integer_mul, 949111327) \ |
72 V(_IntegerImplementation, remainder, Integer_remainder, 1331308305) \ | |
73 V(_IntegerImplementation, _moduloFromInteger, Integer_moduloFromInteger, \ | 72 V(_IntegerImplementation, _moduloFromInteger, Integer_moduloFromInteger, \ |
74 1398988805) \ | 73 1398988805) \ |
75 V(_IntegerImplementation, ~/, Integer_truncDivide, 41718791) \ | 74 V(_IntegerImplementation, ~/, Integer_truncDivide, 1011141318) \ |
76 V(_IntegerImplementation, unary-, Integer_negate, 341268208) \ | 75 V(_IntegerImplementation, unary-, Integer_negate, 145678255) \ |
77 V(_IntegerImplementation, _bitAndFromInteger, \ | 76 V(_IntegerImplementation, _bitAndFromInteger, \ |
78 Integer_bitAndFromInteger, 512285096) \ | 77 Integer_bitAndFromInteger, 512285096) \ |
79 V(_IntegerImplementation, &, Integer_bitAnd, 1735910176) \ | 78 V(_IntegerImplementation, &, Integer_bitAnd, 691305985) \ |
80 V(_IntegerImplementation, _bitOrFromInteger, \ | 79 V(_IntegerImplementation, _bitOrFromInteger, \ |
81 Integer_bitOrFromInteger, 333543947) \ | 80 Integer_bitOrFromInteger, 333543947) \ |
82 V(_IntegerImplementation, |, Integer_bitOr, 1120891571) \ | 81 V(_IntegerImplementation, |, Integer_bitOr, 76287380) \ |
83 V(_IntegerImplementation, _bitXorFromInteger, \ | 82 V(_IntegerImplementation, _bitXorFromInteger, \ |
84 Integer_bitXorFromInteger, 1746295953) \ | 83 Integer_bitXorFromInteger, 1746295953) \ |
85 V(_IntegerImplementation, ^, Integer_bitXor, 21793459) \ | 84 V(_IntegerImplementation, ^, Integer_bitXor, 1124672916) \ |
86 V(_IntegerImplementation, \ | 85 V(_IntegerImplementation, \ |
87 _greaterThanFromInteger, \ | 86 _greaterThanFromInteger, \ |
88 Integer_greaterThanFromInt, 1883218996) \ | 87 Integer_greaterThanFromInt, 1883218996) \ |
89 V(_IntegerImplementation, >, Integer_greaterThan, 253817845) \ | 88 V(_IntegerImplementation, >, Integer_greaterThan, 1356697302) \ |
90 V(_IntegerImplementation, ==, Integer_equal, 1899239372) \ | 89 V(_IntegerImplementation, ==, Integer_equal, 1631095021) \ |
91 V(_IntegerImplementation, _equalToInteger, Integer_equalToInteger, \ | 90 V(_IntegerImplementation, _equalToInteger, Integer_equalToInteger, \ |
92 111745915) \ | 91 111745915) \ |
93 V(_IntegerImplementation, <, Integer_lessThan, 1393706801) \ | 92 V(_IntegerImplementation, <, Integer_lessThan, 1523713072) \ |
94 V(_IntegerImplementation, <=, Integer_lessEqualThan, 1022701101) \ | 93 V(_IntegerImplementation, <=, Integer_lessEqualThan, 671929679) \ |
95 V(_IntegerImplementation, >=, Integer_greaterEqualThan, 178259021) \ | 94 V(_IntegerImplementation, >=, Integer_greaterEqualThan, 1974971247) \ |
96 V(_IntegerImplementation, <<, Integer_shl, 1566363602) \ | 95 V(_IntegerImplementation, <<, Integer_shl, 521759411) \ |
97 V(_IntegerImplementation, >>, Integer_sar, 1845114891) \ | 96 V(_IntegerImplementation, >>, Integer_sar, 800510700) \ |
98 V(_Double, toInt, Double_toInt, 1328149975) | 97 V(_Double, toInt, Double_toInt, 1328149975) |
99 | 98 |
100 | 99 |
101 #define MATH_LIB_INTRINSIC_LIST(V) \ | 100 #define MATH_LIB_INTRINSIC_LIST(V) \ |
102 V(::, sqrt, Math_sqrt, 465520247) \ | 101 V(::, sqrt, Math_sqrt, 465520247) \ |
103 V(::, sin, Math_sin, 730107143) \ | 102 V(::, sin, Math_sin, 730107143) \ |
104 V(::, cos, Math_cos, 1282146521) \ | 103 V(::, cos, Math_cos, 1282146521) \ |
105 V(_Random, _nextState, Random_nextState, 1145672271) \ | 104 V(_Random, _nextState, Random_nextState, 1174301422) \ |
106 | 105 |
107 | 106 |
108 #define TYPED_DATA_LIB_INTRINSIC_LIST(V) \ | 107 #define TYPED_DATA_LIB_INTRINSIC_LIST(V) \ |
109 V(_TypedList, get:length, TypedData_getLength, 26616328) \ | 108 V(_TypedList, get:length, TypedData_getLength, 26646119) \ |
110 V(_Int8Array, _new, TypedData_Int8Array_new, 1825804665) \ | 109 V(_Int8Array, _new, TypedData_Int8Array_new, 18350202) \ |
111 V(_Uint8Array, _new, TypedData_Uint8Array_new, 1778042338) \ | 110 V(_Uint8Array, _new, TypedData_Uint8Array_new, 2118071523) \ |
112 V(_Uint8ClampedArray, _new, TypedData_Uint8ClampedArray_new, 568753997) \ | 111 V(_Uint8ClampedArray, _new, TypedData_Uint8ClampedArray_new, 908783182) \ |
113 V(_Int16Array, _new, TypedData_Int16Array_new, 82856584) \ | 112 V(_Int16Array, _new, TypedData_Int16Array_new, 422885769) \ |
114 V(_Uint16Array, _new, TypedData_Uint16Array_new, 1061515393) \ | 113 V(_Uint16Array, _new, TypedData_Uint16Array_new, 1401544578) \ |
115 V(_Int32Array, _new, TypedData_Int32Array_new, 2011561738) \ | 114 V(_Int32Array, _new, TypedData_Int32Array_new, 204107275) \ |
116 V(_Uint32Array, _new, TypedData_Uint32Array_new, 601429759) \ | 115 V(_Uint32Array, _new, TypedData_Uint32Array_new, 941458944) \ |
117 V(_Int64Array, _new, TypedData_Int64Array_new, 682666769) \ | 116 V(_Int64Array, _new, TypedData_Int64Array_new, 1022695954) \ |
118 V(_Uint64Array, _new, TypedData_Uint64Array_new, 388094865) \ | 117 V(_Uint64Array, _new, TypedData_Uint64Array_new, 728124050) \ |
119 V(_Float32Array, _new, TypedData_Float32Array_new, 1931183334) \ | 118 V(_Float32Array, _new, TypedData_Float32Array_new, 123728871) \ |
120 V(_Float64Array, _new, TypedData_Float64Array_new, 2119419798) \ | 119 V(_Float64Array, _new, TypedData_Float64Array_new, 311965335) \ |
121 V(_Float32x4Array, _new, TypedData_Float32x4Array_new, 435301615) \ | 120 V(_Float32x4Array, _new, TypedData_Float32x4Array_new, 775330800) \ |
122 V(_Int32x4Array, _new, TypedData_Int32x4Array_new, 1734048395) \ | 121 V(_Int32x4Array, _new, TypedData_Int32x4Array_new, 2074077580) \ |
123 V(_Int8Array, ., TypedData_Int8Array_factory, 810750844) \ | 122 V(_Int8Array, ., TypedData_Int8Array_factory, 545976988) \ |
124 V(_Uint8Array, ., TypedData_Uint8Array_factory, 1246070930) \ | 123 V(_Uint8Array, ., TypedData_Uint8Array_factory, 981297074) \ |
125 V(_Uint8ClampedArray, ., TypedData_Uint8ClampedArray_factory, 1882603960) \ | 124 V(_Uint8ClampedArray, ., TypedData_Uint8ClampedArray_factory, 1617830104) \ |
126 V(_Int16Array, ., TypedData_Int16Array_factory, 565702275) \ | 125 V(_Int16Array, ., TypedData_Int16Array_factory, 300928419) \ |
127 V(_Uint16Array, ., TypedData_Uint16Array_factory, 745756560) \ | 126 V(_Uint16Array, ., TypedData_Uint16Array_factory, 480982704) \ |
128 V(_Int32Array, ., TypedData_Int32Array_factory, 2141385820) \ | 127 V(_Int32Array, ., TypedData_Int32Array_factory, 1876611964) \ |
129 V(_Uint32Array, ., TypedData_Uint32Array_factory, 2076467298) \ | 128 V(_Uint32Array, ., TypedData_Uint32Array_factory, 1811693442) \ |
130 V(_Int64Array, ., TypedData_Int64Array_factory, 1223523117) \ | 129 V(_Int64Array, ., TypedData_Int64Array_factory, 958749261) \ |
131 V(_Uint64Array, ., TypedData_Uint64Array_factory, 1032112679) \ | 130 V(_Uint64Array, ., TypedData_Uint64Array_factory, 767338823) \ |
132 V(_Float32Array, ., TypedData_Float32Array_factory, 1986018007) \ | 131 V(_Float32Array, ., TypedData_Float32Array_factory, 1721244151) \ |
133 V(_Float64Array, ., TypedData_Float64Array_factory, 1863852388) \ | 132 V(_Float64Array, ., TypedData_Float64Array_factory, 1599078532) \ |
134 V(_Float32x4Array, ., TypedData_Float32x4Array_factory, 1144749257) \ | 133 V(_Float32x4Array, ., TypedData_Float32x4Array_factory, 879975401) \ |
135 V(_Int32x4Array, ., TypedData_Int32x4Array_factory, 1189356537) \ | 134 V(_Int32x4Array, ., TypedData_Int32x4Array_factory, 924582681) \ |
136 | 135 |
137 | 136 |
138 // TODO(srdjan): Implement _FixedSizeArrayIterator, get:current and | 137 // TODO(srdjan): Implement _FixedSizeArrayIterator, get:current and |
139 // _FixedSizeArrayIterator, moveNext. | 138 // _FixedSizeArrayIterator, moveNext. |
140 | 139 |
141 // Forward declarations. | 140 // Forward declarations. |
142 class Assembler; | 141 class Assembler; |
143 class Function; | 142 class Function; |
144 | 143 |
145 class Intrinsifier : public AllStatic { | 144 class Intrinsifier : public AllStatic { |
(...skipping 13 matching lines...) Expand all Loading... |
159 CORE_INTEGER_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 158 CORE_INTEGER_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
160 MATH_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 159 MATH_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
161 TYPED_DATA_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) | 160 TYPED_DATA_LIB_INTRINSIC_LIST(DECLARE_FUNCTION) |
162 | 161 |
163 #undef DECLARE_FUNCTION | 162 #undef DECLARE_FUNCTION |
164 }; | 163 }; |
165 | 164 |
166 } // namespace dart | 165 } // namespace dart |
167 | 166 |
168 #endif // VM_INTRINSIFIER_H_ | 167 #endif // VM_INTRINSIFIER_H_ |
OLD | NEW |